Re: Struts tags with Groovy meta programming

2009-11-10 Thread Ronny Løvtangen

Anyone?

Does the struts tags do some reflection magic that bypass the Groovy  
MetaClass?



On Nov 9, 2009, at 5:55 PM, Ronny Løvtangen wrote:



How can I from a Struts tag access properties that is overridden by  
Groovy meta programming?

Example:

Bar.groovy
---

class Bar {
String baz
}



FooAction.groovy
-

class FooAction extends ActionSupport {

Bar bar

String retrieveBar() {
bar = new Bar(baz: original value)
bar.metaClass.getBaz = {new value}
return SUCCESS
}
}

foo.jsp


%@ taglib prefix=s uri=/struts-tags %
Baz is: s:property value=bar.baz/




Which yields the output  Baz is: original value

I was expecting Baz is: new value, which is true for this test:


class FooActionTest extends GroovyTestCase {

void testRetrieveBar() {
FooAction action = new FooAction()
action.retrieveBar()
assertEquals new value, action.bar.baz
}
}


Any idea on how I from a Struts tag can invoke the overridden getBaz  
method instead of the original one?



Ronny

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts tags with Groovy meta programming

2009-11-09 Thread Ronny Løvtangen


How can I from a Struts tag access properties that is overridden by  
Groovy meta programming?

Example:

Bar.groovy
---

class Bar {
String baz
}



FooAction.groovy
-

class FooAction extends ActionSupport {

Bar bar

String retrieveBar() {
bar = new Bar(baz: original value)
bar.metaClass.getBaz = {new value}
return SUCCESS
}
}

foo.jsp


%@ taglib prefix=s uri=/struts-tags %
Baz is: s:property value=bar.baz/




Which yields the output  Baz is: original value

I was expecting Baz is: new value, which is true for this test:


class FooActionTest extends GroovyTestCase {

void testRetrieveBar() {
FooAction action = new FooAction()
action.retrieveBar()
assertEquals new value, action.bar.baz
}
}


Any idea on how I from a Struts tag can invoke the overridden getBaz  
method instead of the original one?



Ronny

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: advice on building front-end rapidly

2009-11-09 Thread Ronny Løvtangen


On Nov 9, 2009, at 5:53 PM, Bill Bohnenberger wrote:


 I suggest you avoid
using MS Word to generate HTML, however, otherwise you will find the  
clean

it up phase rather daunting :)


From what I remember, DreamWeaver has a clean up Word HTML menu item.
Says something about the ugliness of the Word generated HTML ;)


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: advice on building front-end rapidly

2009-11-09 Thread Ronny Løvtangen
You could easily interactively debug from our IDE when running tomcat  
or other servers outside the IDE as well. As long as you start your  
server with some command line parameters.
e.g. -Xdebug - 
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

I usually just run 'mvn tomcat:run'.


On Nov 9, 2009, at 9:44 PM, Bill Bohnenberger wrote:

I've used the standard edition for years, also. But for web projects  
I think
the enterprise edition is better because I can run my web server  
(Tomcat)
from within the IDE and therefore interactively debug servlet (in  
this case,

struts2) code.

- Bill

2009/11/9 Paweł Wielgus poulw...@gmail.com


Hi all,
i have been using eclipse (standard edition) + amateras jsp/html/xml
editor for years now.
What i like in it best is full support for CTRL+Space.
It also has some kind of wysiwyg editor but i have never used it so i
can't say if it's ok.
You can check it out here:

http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor

Best greetings,
Paweł Wielgus.


2009/11/9  erikwe...@mindspring.com:
That's what I use (vim). Although my front ends are Java code and  
not

HTML/CSS.


Hand-coding takes longer but in my experience results in a better  
product

and also in my opinion makes you a better programmer.


With that said I partnered on a project with a guy who did the  
HTML front
end and he got good results with Dreamweaver. I then used vim to  
insert the

tag work, scriptlets, etc., into his files.


Erik


-Original Message-

From: Musachy Barroso musa...@gmail.com
Sent: Nov 9, 2009 12:24 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: advice on building front-end rapidly

Vi

just kidding, it is monday you know :)

On Sun, Nov 8, 2009 at 5:39 AM, Farshad Rabbani
farshadrabb...@hotmail.com wrote:


Hello:



I am currently building all my JSPs using notepad.  It is a very  
slow
and tedius process to get the struts tags to align and show exactly  
as I

want and also to format the page so it looks good.  Is there a tool -
something that will allow me to quickly build well-designed pages by
providing me with a WYSIWYG interface where I can drag and drop  
struts
elements, format them and the page easily and then see what the  
outcome will
look like?  If there is such a tool that you are using (and it is  
easy to

configure etc. :-) ) can you please let me know.  If there isn't, how
exactly are you all building your pages?  I apologize if this is an  
absurd
question but I find myself spending unnecessary time on this  
issue.  Thank

you all in advance, any advice is very much appreciated.




Regards,

Farshad


_
Find the right PC with Windows 7 and Windows Live.


http://www.microsoft.com/Windows/pc-scout/laptop-set-criteria.aspx?cbid=wlfilt=200,2400,10,19,1,3,1,7,50,650,2,12,0,1000cat=1,2,3,4,5,6brands=5,6,7,8,9,10,11,12,13,14,15,16addf=4,5,9ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:112009


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



s:include fails with BufferOverflowException, jsp:include works fine

2009-02-10 Thread Ronny Løvtangen

Hi

I have a problem with s:include and BufferOverflowException.
If I replace s:include with jsp:include then everything is fine.
Is it something I'm missing, or should I not rely on s:include?



main jsp (from result = success):
--

s:include value=include/measurementSearchInput.jsp/



measurementSearchInput.jsp:


s:select list=trainNumbers name=searchInput.trainNumber  
emptyOption=true /
s:select list=measureUnitNumbers name=searchInput.measureUnitNr  
emptyOption=true/

s:submit/





The first list is enormous: 2093 elements. The second list is not that  
big, only 170 elements.


If I remove one of the dropdowns, the page just dies silently. The  
list of options is truncated and I never see the submit button:


   option value=XX2741XX2741/option
option value=XXSK


If I include both list, then at least I get an exception  
(BufferOverflowException). See stacktrace beneath.



Of course, I could just stick to jsp:include in this case. But I  
wonder if this is a known problem with s:include, and is there  
something I could do about it?


(Struts version is 2.1.6, and I run with 'mvn tomcat:run', haven't  
tried to deploy to a 'real' tomcat yet')



Regards
Ronny Løvtangen




01:08,913 WARN org.apache.struts2.components.Include - Exception  
thrown during include of include/measurementSearchInput.jsp

java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:165)
	at  
org 
.apache 
.struts2 
.util 
.FastByteArrayOutputStream 
.decodeAndWriteOut(FastByteArrayOutputStream.java:151)
	at  
org 
.apache 
.struts2 
.util.FastByteArrayOutputStream.writeTo(FastByteArrayOutputStream.java: 
94)

at org.apache.struts2.components.Include.include(Include.java:261)
at org.apache.struts2.components.Include.end(Include.java:166)
	at  
org 
.apache 
.struts2 
.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
	at  
org 
.apache 
.jsp 
.WEB_002dINF 
.jsp 
.reports 
.energy_jsp 
._jspx_meth_s_include_1 
(org.apache.jsp.WEB_002dINF.jsp.reports.energy_jsp:300)
	at  
org 
.apache 
.jsp 
.WEB_002dINF 
.jsp 
.reports 
.energy_jsp 
._jspx_meth_s_form_0(org.apache.jsp.WEB_002dINF.jsp.reports.energy_jsp: 
269)
	at  
org 
.apache 
.jsp 
.WEB_002dINF 
.jsp 
.reports 
.energy_jsp 
._jspx_meth_s_param_1 
(org.apache.jsp.WEB_002dINF.jsp.reports.energy_jsp:225)
	at  
org 
.apache 
.jsp 
.WEB_002dINF 
.jsp 
.reports 
.energy_jsp 
._jspx_meth_s_component_0 
(org.apache.jsp.WEB_002dINF.jsp.reports.energy_jsp:130)
	at  
org 
.apache 
.jsp 
.WEB_002dINF 
.jsp 
.reports 
.energy_jsp 
._jspService(org.apache.jsp.WEB_002dINF.jsp.reports.energy_jsp:75)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at  
org 
.apache 
.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
	at  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at  
org 
.apache 
.catalina 
.core 
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
252)
	at  
org 
.apache 
.catalina 
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at  
org 
.apache 
.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java: 
672)
	at  
org 
.apache 
.catalina 
.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java: 
463)
	at  
org 
.apache 
.catalina 
.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
	at  
org 
.apache 
.catalina 
.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
	at  
org 
.apache 
.struts2 
.dispatcher 
.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
	at  
org 
.apache 
.struts2 
.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
	at  
com 
.opensymphony 
.xwork2 
.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)
	at  
com 
.opensymphony 
.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)

at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)

at java.lang.reflect.Method.invoke(Method.java:597)
	at  
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
	at  
org 
.codehaus 
.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
	at  
org 
.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java: 
754)
	at  
org 
.codehaus 
.groovy