Nasty exception in struts2 ognl
Also posted in stackoverflow: http://stackoverflow.com/questions/3895961/nasty-java-lang-numberformatexception-in-struts2-ognl Any help appreciated! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
How to create a costume struts2 tag? any demo?
Hello all, I create a simple tag following this link http://joshuajava.wordpress.com/2008/12/27/creating-custom-components-with-struts-2/ http://joshuajava.wordpress.com/2008/12/27/creating-custom-components-with-struts-2/but, I am trying to add some extra functions into that tag. Actually, I create a template/simple-theme named:lab.ftl the content: a href=#${parameters.name?html}/a But, finally failed, I add a method:evaluateExtraParams, I have no clue at all. Brilliant Thanks @StrutsTag( name=tab, tldTagClass=lab.struts2.components.Hello, description=Render a checkbox input field ) public class Hello extends Component { protected String name; public Hello(ValueStack stack) { super(stack); } public String getName() { return name; } @StrutsTagAttribute(description=The actual HTML value attribute of the checkbox., defaultValue=true) public void setName(String name) { this.name = name; } public boolean start(Writer writer) { try { writer.write(Hello + name); } catch (IOException e) { e.printStackTrace(); } return true; } protected void evaluateExtraParams() { if (name != null) { addParameter(name, findString(name)); } else { addParameter(name, ); } } public boolean end(Writer writer) { return true; } @Override public boolean usesBody() { return false; } } Regards, Mead
Re: How to create a costume struts2 tag? any demo?
I read the attribute name in the template, the Exception log: Attribute theme invalid for tag hello according to TLD org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1235) Regards, Mead
Re: Nasty exception in struts2 ognl
I get an error when I click on that. Cut and paste, don't make me work to help. On Saturday, October 9, 2010, Ricardo Oliveira rvelo...@gmail.com wrote: Also posted in stackoverflow: http://stackoverflow.com/questions/3895961/nasty-java-lang-numberformatexception-in-struts2-ognl Any help appreciated! - 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
Re: Nasty exception in struts2 ognl
The link is Ok, stackoverflow seems to have some problems at the moment. I get an error when I click on that. Cut and paste, don't make me work to help. Also posted in stackoverflow: http://stackoverflow.com/questions/3895961/nasty-java-lang-numberformatexception-in-struts2-ognl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
Hi Lai: The error message looks like the value of the attribute [theme] (in your jsp) is invalid. Can you show us your jsp and TLD file? 2010/10/9 Mead Lai laiqi...@gmail.com: I read the attribute name in the template, the Exception log: Attribute theme invalid for tag hello according to TLD org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1235) Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
Thank you very much. JSP file: %...@taglib prefix=s uri=/struts-tags % %...@taglib prefix=lab uri=/lab % html head titleHello World/title s:head / /head body lab:hello name=Hello_in_Value theme=simple/ /body /html TLD file: ?xml version=1.0 encoding=UTF-8? !DOCTYPE taglib PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd; taglib tlib-version2.2.3/tlib-version jsp-version1.2/jsp-version short-namelab/short-name uri/lab/uri display-nameLab Tags/display-name description![CDATA[lab]]/description tag namehello/name tag-classlab.struts2.taglib.HelloTag/tag-class body-contentJSP/body-content description![CDATA[Render a hello]]/description attribute nameid/name requiredfalse/required rtexprvaluefalse/rtexprvalue description ![CDATA[id for referencing element]]/description /attribute attribute namename/name requiredtrue/required rtexprvaluefalse/rtexprvalue description![CDATA[ Name]]/description /attribute /tag /taglib Regards, Mead On Sat, Oct 9, 2010 at 9:31 PM, Li Ying liying.cn.2...@gmail.com wrote: Hi Lai: The error message looks like the value of the attribute [theme] (in your jsp) is invalid. Can you show us your jsp and TLD file? 2010/10/9 Mead Lai laiqi...@gmail.com: I read the attribute name in the template, the Exception log: Attribute theme invalid for tag hello according to TLD org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1235) Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
Hi Lai: I readed some source code of Struts2, and realized that the property [theme] is defined in class [org.apache.struts2.components.UIBean] but not in class [org.apache.struts2.components.Component]. So i think if you want to render something with your tag, and appoint the theme by the attribute [theme], maybe you should extend your tag class from [UIBean] instead of [Component]. Which means, your class should like: public class Hello extends UIBean { ... ... } 2010/10/9 Li Ying liying.cn.2...@gmail.com: Hi Lai: The error message looks like the value of the attribute [theme] (in your jsp) is invalid. Can you show us your jsp and TLD file? 2010/10/9 Mead Lai laiqi...@gmail.com: I read the attribute name in the template, the Exception log: Attribute theme invalid for tag hello according to TLD org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1235) Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
Thank you again. Any Demo or tutorial? I search all of the Struts2 document, but find nothing.
Re: How to create a costume struts2 tag? any demo?
Hi Lai: I used to read the documents of Struts2, but mostly it can't answer my question. So i had to read the source, or debug it. For your question, i think you should read the source code of classes in package [org.apache.struts2.views.jsp.ui]. Get a look at the entire Class Hierarchy before you can choose a right class as your super class. I guess [org.apache.struts2.views.jsp.ui.AnchorTag] is a good sample for you, since you likes trying to render an [a] tag of html. 2010/10/9 Mead Lai laiqi...@gmail.com: Thank you again. Any Demo or tutorial? I search all of the Struts2 document, but find nothing. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
The same error, I have modified the extends class to BaseUI JasperException: /demo.jsp(14,4) Attribute theme invalid for tag hello according to TLD I ref the ui.CheckBox.java, but confused me. Thanks for your replies, All of them inspirit me very much. I will look insight source. Appreciate you.
Re: How to create a costume struts2 tag? any demo?
Hi Lai: Of course you should extend your class from [BaseUI], so you can inherit the property [theme] in your class. But also, you should define the attribute [theme] (and all the other attributes you want to use) in you TLD file, or the jsp compiler can not recognize it in your jsp. You can read the tld file of struts2 ([struts-tags.tld]) as a sample. [struts-tags.tld] can be found in file [struts2-core-2.2.1.jar/META-INF/struts-tags.tld]. 2010/10/9 Mead Lai laiqi...@gmail.com: The same error, I have modified the extends class to BaseUI JasperException: /demo.jsp(14,4) Attribute theme invalid for tag hello according to TLD I ref the ui.CheckBox.java, but confused me. Thanks for your replies, All of them inspirit me very much. I will look insight source. Appreciate you. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Create Text Box Dynamically
Hi, I want to create 'n' text box dynamically, the 'n' should comes from database Whether 'n' should be 3 or 4 or 12 it will be vary dynamically and decided by the end user. Is it possible to create 'n' text Box dynamically or at run time with struts2, Also how text box can be accessed because i don't know the name! suppose I want to access a specific text box? Thanks,Vinodh
Re: Create Text Box Dynamically
Hi I think you can use tags looks like this: s:iterator var=counter begin=1 end={n} s:textfield name=data / /s:iterator to generate 'n' text box dynamically. The html code should be: input type=text name=data repeats 'n' times. When user input text in these text boxes and submit the form, the request should include several parameters which has the same name data and the different value. I think the Action class should have a property named [data] (same as the name of input tag), and the data type of this property should be array of String, so it can hold all the value input in the text boxes. 2010/10/9 vinodh r vinodh_itf...@yahoo.com: Hi, I want to create 'n' text box dynamically, the 'n' should comes from database Whether 'n' should be 3 or 4 or 12 it will be vary dynamically and decided by the end user. Is it possible to create 'n' text Box dynamically or at run time with struts2, Also how text box can be accessed because i don't know the name! suppose I want to access a specific text box? Thanks,Vinodh - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Create Text Box Dynamically
Better to use a Collection, but may not matter much. Also, if order needs to be guaranteed, use index notation (square brackets along with an index). If you need to add the text boxes dynamically (via JavaScript) just create DOM elements that match the HTML generated by the S2 tags. Dave On Saturday, October 9, 2010, Li Ying liying.cn.2...@gmail.com wrote: Hi I think you can use tags looks like this: s:iterator var=counter begin=1 end={n} s:textfield name=data / /s:iterator to generate 'n' text box dynamically. The html code should be: input type=text name=data repeats 'n' times. When user input text in these text boxes and submit the form, the request should include several parameters which has the same name data and the different value. I think the Action class should have a property named [data] (same as the name of input tag), and the data type of this property should be array of String, so it can hold all the value input in the text boxes. 2010/10/9 vinodh r vinodh_itf...@yahoo.com: Hi, I want to create 'n' text box dynamically, the 'n' should comes from database Whether 'n' should be 3 or 4 or 12 it will be vary dynamically and decided by the end user. Is it possible to create 'n' text Box dynamically or at run time with struts2, Also how text box can be accessed because i don't know the name! suppose I want to access a specific text box? Thanks,Vinodh - 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
Re: Nasty exception in struts2 ognl
Integer.MAX_VALUE is less then 1286579871769. See (http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Integer.html#MAX_VALUE). Maybe Long will suit you. Maurizio Cucchiara 2010/10/9 Matthias Rakowski matth...@rakowski.biz: The link is Ok, stackoverflow seems to have some problems at the moment. I get an error when click on that. Cut and paste, don't make me work to help. Also posted in stackoverflow: http://stackoverflow.com/questions/3895961/nasty-java-lang-numberformatexception-in-struts2-ognl - 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
[S2] How to add a custom parameter to an existing Struts UI Tag?
I am trying to override a struts tag template (specifically s:checkboxlist), and I can't figure out how to add a parameter to the tag. I have successfully overridden the template by copying checkboxlist.tld to my template/simple directory and all works well. Now I would like to add a parameter. It appears that I need to override the the META-INF/struts-tags.tld file because I keep getting the error below. However, using the same method as checkboxlist.tld, I copy a modified version of struts-tags.tld to my META-INF/struts-tags.tld directory. However, I still get the same error below. Not sure if I need to modify another file or if struts-tags.tld cannot be overridden. Anyone given this a try? Trying not to have to create a new custom tag since all I want is a simple modification to checkboxlist.tld. ERROR /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD Caused by: org.apache.jasper.JasperException: /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD --- Tag with added parameter (breakCount): s:checkboxlist name=ownerIds list=%{activeAppUserList} listKey=appUserId listValue=nameInformal required=true breakCount=3 !-- New Parameter, will enter the breakString after every 3 items -- breakString=br/ / Excerpt from modified struts-tags.tld: tag description![CDATA[Render a list of checkboxes]]/description namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content attribute description![CDATA[Set the html accesskey attribute on rendered html element]]/description nameaccesskey/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Number of elements to display before inserting 'break' element.]]/description namebreakCount/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Used to override the default 'break' string. Default is br.]]/description namebreakString/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Validation Problem
It's a know bug. If your application doesn't run in a production environment you could download latest struts release from https://hudson.apache.org/hudson/view/Struts/job/struts2/ Maurizio Cucchiara 2010/10/9 Chris Miles ch...@chrismiles.org: Whenever the validation procedure returns to the input result, any s:action elements are not executed. Is there a reason for this? Is there anything which needs to be configured or toggled to allow it? Thanks Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Do you need to insert a breaking string every 3 items? I think this approach is too much expansive in term of time. Furthermore, after that, you should deal with subcassing process. You should have valid reasons for do that. Why don't you simply use mod operator?: s:iterator status=stat value={1,2,3,4,5} s:if test=(#stat.index % 3)==0 insert breaking string /s:if . /s:iterator Maurizio Cucchiara 2010/10/9 Burton Rhodes burtonrho...@gmail.com: I am trying to override a struts tag template (specifically s:checkboxlist), and I can't figure out how to add a parameter to the tag. I have successfully overridden the template by copying checkboxlist.tld to my template/simple directory and all works well. Now I would like to add a parameter. It appears that I need to override the the META-INF/struts-tags.tld file because I keep getting the error below. However, using the same method as checkboxlist.tld, I copy a modified version of struts-tags.tld to my META-INF/struts-tags.tld directory. However, I still get the same error below. Not sure if I need to modify another file or if struts-tags.tld cannot be overridden. Anyone given this a try? Trying not to have to create a new custom tag since all I want is a simple modification to checkboxlist.tld. ERROR /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD Caused by: org.apache.jasper.JasperException: /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD --- Tag with added parameter (breakCount): s:checkboxlist name=ownerIds list=%{activeAppUserList} listKey=appUserId listValue=nameInformal required=true breakCount=3 !-- New Parameter, will enter the breakString after every 3 items -- breakString=br/ / Excerpt from modified struts-tags.tld: tag description![CDATA[Render a list of checkboxes]]/description namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content attribute description![CDATA[Set the html accesskey attribute on rendered html element]]/description nameaccesskey/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Number of elements to display before inserting 'break' element.]]/description namebreakCount/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Used to override the default 'break' string. Default is br.]]/description namebreakString/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute - 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
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
I think encapsulating this kind of behavior in a custom tag is why custom tags exist--and since the iteration is handled by the checkboxlist tag internally, using an iterator/etc. doesn't really work. Dave On Saturday, October 9, 2010, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Do you need to insert a breaking string every 3 items? I think this approach is too much expansive in term of time. Furthermore, after that, you should deal with subcassing process. You should have valid reasons for do that. Why don't you simply use mod operator?: s:iterator status=stat value={1,2,3,4,5} s:if test=(#stat.index % 3)==0 insert breaking string /s:if . /s:iterator Maurizio Cucchiara 2010/10/9 Burton Rhodes burtonrho...@gmail.com: I am trying to override a struts tag template (specifically s:checkboxlist), and I can't figure out how to add a parameter to the tag. I have successfully overridden the template by copying checkboxlist.tld to my template/simple directory and all works well. Now I would like to add a parameter. It appears that I need to override the the META-INF/struts-tags.tld file because I keep getting the error below. However, using the same method as checkboxlist.tld, I copy a modified version of struts-tags.tld to my META-INF/struts-tags.tld directory. However, I still get the same error below. Not sure if I need to modify another file or if struts-tags.tld cannot be overridden. Anyone given this a try? Trying not to have to create a new custom tag since all I want is a simple modification to checkboxlist.tld. ERROR /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD Caused by: org.apache.jasper.JasperException: /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD --- Tag with added parameter (breakCount): s:checkboxlist name=ownerIds list=%{activeAppUserList} listKey=appUserId listValue=nameInformal required=true breakCount=3 !-- New Parameter, will enter the breakString after every 3 items -- breakString=br/ / Excerpt from modified struts-tags.tld: tag description![CDATA[Render a list of checkboxes]]/description namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content attribute description![CDATA[Set the html accesskey attribute on rendered html element]]/description nameaccesskey/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Number of elements to display before inserting 'break' element.]]/description namebreakCount/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Used to override the default 'break' string. Default is br.]]/description namebreakString/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute - 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
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Dave you're right, I was not clear I'll try to explain better: s:iterator status=stat value=list s:checkbox label=checkbox label name=checkboxName value=checkboxValue/ s:if test=(#stat.index % 3)==0 insert breaking string /s:if Maurizio Cucchiara 2010/10/9 Dave Newton davelnew...@gmail.com: I think encapsulating this kind of behavior in a custom tag is why custom tags exist--and since the iteration is handled by the checkboxlist tag internally, using an iterator/etc. doesn't really work. Dave On Saturday, October 9, 2010, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Do you need to insert a breaking string every 3 items? I think this approach is too much expansive in term of time. Furthermore, after that, you should deal with subcassing process. You should have valid reasons for do that. Why don't you simply use mod operator?: s:iterator status=stat value={1,2,3,4,5} s:if test=(#stat.index % 3)==0 insert breaking string /s:if . /s:iterator Maurizio Cucchiara 2010/10/9 Burton Rhodes burtonrho...@gmail.com: I am trying to override a struts tag template (specifically s:checkboxlist), and I can't figure out how to add a parameter to the tag. I have successfully overridden the template by copying checkboxlist.tld to my template/simple directory and all works well. Now I would like to add a parameter. It appears that I need to override the the META-INF/struts-tags.tld file because I keep getting the error below. However, using the same method as checkboxlist.tld, I copy a modified version of struts-tags.tld to my META-INF/struts-tags.tld directory. However, I still get the same error below. Not sure if I need to modify another file or if struts-tags.tld cannot be overridden. Anyone given this a try? Trying not to have to create a new custom tag since all I want is a simple modification to checkboxlist.tld. ERROR /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD Caused by: org.apache.jasper.JasperException: /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD --- Tag with added parameter (breakCount): s:checkboxlist name=ownerIds list=%{activeAppUserList} listKey=appUserId listValue=nameInformal required=true breakCount=3 !-- New Parameter, will enter the breakString after every 3 items -- breakString=br/ / Excerpt from modified struts-tags.tld: tag description![CDATA[Render a list of checkboxes]]/description namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content attribute description![CDATA[Set the html accesskey attribute on rendered html element]]/description nameaccesskey/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Number of elements to display before inserting 'break' element.]]/description namebreakCount/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute description![CDATA[Used to override the default 'break' string. Default is br.]]/description namebreakString/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute - 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
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Much cleaner to encapsulate the behavior, especially if it's used often. It might be easier to use a JSP-based tag, though, than to extend an S2 tag. On Saturday, October 9, 2010, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Dave you're right, I was not clear I'll try to explain better: s:iterator status=stat value=list s:checkbox label=checkbox label name=checkboxName value=checkboxValue/ s:if test=(#stat.index % 3)==0 insert breaking string /s:if Maurizio Cucchiara 2010/10/9 Dave Newton davelnew...@gmail.com: I think encapsulating this kind of behavior in a custom tag is why custom tags exist--and since the iteration is handled by the checkboxlist tag internally, using an iterator/etc. doesn't really work. Dave On Saturday, October 9, 2010, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Do you need to insert a breaking string every 3 items? I think this approach is too much expansive in term of time. Furthermore, after that, you should deal with subcassing process. You should have valid reasons for do that. Why don't you simply use mod operator?: s:iterator status=stat value={1,2,3,4,5} s:if test=(#stat.index % 3)==0 insert breaking string /s:if . /s:iterator Maurizio Cucchiara 2010/10/9 Burton Rhodes burtonrho...@gmail.com: I am trying to override a struts tag template (specifically s:checkboxlist), and I can't figure out how to add a parameter to the tag. I have successfully overridden the template by copying checkboxlist.tld to my template/simple directory and all works well. Now I would like to add a parameter. It appears that I need to override the the META-INF/struts-tags.tld file because I keep getting the error below. However, using the same method as checkboxlist.tld, I copy a modified version of struts-tags.tld to my META-INF/struts-tags.tld directory. However, I still get the same error below. Not sure if I need to modify another file or if struts-tags.tld cannot be overridden. Anyone given this a try? Trying not to have to create a new custom tag since all I want is a simple modification to checkboxlist.tld. ERROR /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD Caused by: org.apache.jasper.JasperException: /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD --- Tag with added parameter (breakCount): s:checkboxlist name=ownerIds list=%{activeAppUserList} listKey=appUserId listValue=nameInformal required=true breakCount=3 !-- New Parameter, will enter the breakString after every 3 items -- breakString=br/ / Excerpt from modified struts-tags.tld: tag description![CDATA[Render a list of checkboxes]]/description namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content attribute description![CDATA[Set the html accesskey attribute on rendered html element]]/description nameaccesskey/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute attribute - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
2 View, and optional JSON
hi all we need all ur tips we wanna to create a REST Action but with optional JSON, and 2 view the idea we wanna to create a full blown website, mobile edition using sencha touch, and optional JSON to make REST as service producer (consume by android) but not all the Action can become JSON any idea all? F - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: 2 View, and optional JSON
The REST plugin already returns data based on the URL suffix--what's wrong with using that mechanism? On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: hi all we need all ur tips we wanna to create a REST Action but with optional JSON, and 2 view the idea we wanna to create a full blown website, mobile edition using sencha touch, and optional JSON to make REST as service producer (consume by android) but not all the Action can become JSON any idea all? F - 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
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Agreed. I think an upgrade to the checklistbox tag is in warranted. Through my searches there are many posts looking for ways to layout the checkboxlist better. Most frustrating on this tag is the actual checkbox and the label will break lines making this unacceptable from a UI perspective. Also, many users I saw just wanted a one column format. I would propose surrounding the input type=checkbox and label html elements in a div tag (you could even supply an additional class and style attribute to the tag). This way a user could set widths, floats, etc for the div tag. This hack below did the trick for me. By setting the div Class properties: float in combination with width you can easily set up one column lists or fixed width layouts that extend to the next line easily. Would make this tag much more versatile - especially with just a small modification. #-- Modified checklistbox.tld with surrounding div tag -- div class=myCustomDivClass input type=checkbox name=${parameters.name?html} value=${itemKeyStr?html} id=${parameters.name?html}-${itemCount}#rt/ #if tag.contains(parameters.nameValue, itemKey) checked=checked#rt/ /#if #if parameters.disabled?default(false) disabled=disabled#rt/ /#if #if parameters.title?? title=${parameters.title?html}#rt/ /#if #include /${parameters.templateDir}/simple/scripting-events.ftl / #include /${parameters.templateDir}/simple/common-attributes.ftl / / label for=${parameters.name?html}-${itemCount} class=checkboxLabel${itemValue?html}/label #-- Add ending div tag -- /div On Sat, Oct 9, 2010 at 3:08 PM, Dave Newton davelnew...@gmail.com wrote: Much cleaner to encapsulate the behavior, especially if it's used often. It might be easier to use a JSP-based tag, though, than to extend an S2 tag. On Saturday, October 9, 2010, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Dave you're right, I was not clear I'll try to explain better: s:iterator status=stat value=list s:checkbox label=checkbox label name=checkboxName value=checkboxValue/ s:if test=(#stat.index % 3)==0 insert breaking string /s:if Maurizio Cucchiara 2010/10/9 Dave Newton davelnew...@gmail.com: I think encapsulating this kind of behavior in a custom tag is why custom tags exist--and since the iteration is handled by the checkboxlist tag internally, using an iterator/etc. doesn't really work. Dave On Saturday, October 9, 2010, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Do you need to insert a breaking string every 3 items? I think this approach is too much expansive in term of time. Furthermore, after that, you should deal with subcassing process. You should have valid reasons for do that. Why don't you simply use mod operator?: s:iterator status=stat value={1,2,3,4,5} s:if test=(#stat.index % 3)==0 insert breaking string /s:if . /s:iterator Maurizio Cucchiara 2010/10/9 Burton Rhodes burtonrho...@gmail.com: I am trying to override a struts tag template (specifically s:checkboxlist), and I can't figure out how to add a parameter to the tag. I have successfully overridden the template by copying checkboxlist.tld to my template/simple directory and all works well. Now I would like to add a parameter. It appears that I need to override the the META-INF/struts-tags.tld file because I keep getting the error below. However, using the same method as checkboxlist.tld, I copy a modified version of struts-tags.tld to my META-INF/struts-tags.tld directory. However, I still get the same error below. Not sure if I need to modify another file or if struts-tags.tld cannot be overridden. Anyone given this a try? Trying not to have to create a new custom tag since all I want is a simple modification to checkboxlist.tld. ERROR /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD Caused by: org.apache.jasper.JasperException: /contact/contactCreate.jsp(286,6) PWC6131: Attribute breakCount invalid for tag checkboxlist according to TLD --- Tag with added parameter (breakCount): s:checkboxlist name=ownerIds list=%{activeAppUserList} listKey=appUserId listValue=nameInformal required=true breakCount=3 !-- New Parameter, will enter the breakString after every 3 items -- breakString=br/ / Excerpt from modified struts-tags.tld: tag description![CDATA[Render a list of checkboxes]]/description namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content attribute description![CDATA[Set the html accesskey attribute on rendered html element]]/description nameaccesskey/name requiredfalse/required rtexprvaluefalse/rtexprvalue
Re: 2 View, and optional JSON
the REST automatically create JSON and XML F On Sun, Oct 10, 2010 at 3:24 AM, Dave Newton davelnew...@gmail.com wrote: The REST plugin already returns data based on the URL suffix--what's wrong with using that mechanism? On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: hi all we need all ur tips we wanna to create a REST Action but with optional JSON, and 2 view the idea we wanna to create a full blown website, mobile edition using sencha touch, and optional JSON to make REST as service producer (consume by android) but not all the Action can become JSON any idea all? F - 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
Re: 2 View, and optional JSON
And HTML, and could be extended to create anything else you wanted. On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: the REST automatically create JSON and XML F On Sun, Oct 10, 2010 at 3:24 AM, Dave Newton davelnew...@gmail.com wrote: The REST plugin already returns data based on the URL suffix--what's wrong with using that mechanism? On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: hi all we need all ur tips we wanna to create a REST Action but with optional JSON, and 2 view the idea we wanna to create a full blown website, mobile edition using sencha touch, and optional JSON to make REST as service producer (consume by android) but not all the Action can become JSON any idea all? F - 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
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Hello all, I am trying to create my struts2 UI-Tag too. Did you change the org.apache.struts2.views.jsp.ui.CheckboxListTag to your rewritten the Tag-class and the correspond CheckboxList yet? Regards, Mead
Re: 2 View, and optional JSON
my idea to spilt the WEb API (REST) with JSON with our current html code and need to make it effective or my mind worst ;) F On Sun, Oct 10, 2010 at 4:23 AM, Dave Newton davelnew...@gmail.com wrote: And HTML, and could be extended to create anything else you wanted. On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: the REST automatically create JSON and XML F On Sun, Oct 10, 2010 at 3:24 AM, Dave Newton davelnew...@gmail.com wrote: The REST plugin already returns data based on the URL suffix--what's wrong with using that mechanism? On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: hi all we need all ur tips we wanna to create a REST Action but with optional JSON, and 2 view the idea we wanna to create a full blown website, mobile edition using sencha touch, and optional JSON to make REST as service producer (consume by android) but not all the Action can become JSON any idea all? F - 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
I mean in the modified struts-tags.tld: namecheckboxlist/name tag-classorg.apache.struts2.views.jsp.ui.CheckboxListTag/tag-class body-contentJSP/body-content It seems nothing changed about the tag-class
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
I ended up not having to create a new tag. I simply overrode the current template (template/simple/checkboxlist.tld) to do what I wanted. Essentially I just did what it says on this page entitled Creating And Applying Your Own Themes For Struts 2 Tags: http://struts.apache.org/2.2.1/docs/struts-2-themes.html On Sat, Oct 9, 2010 at 4:58 PM, Mead Lai laiqi...@gmail.com wrote: Hello all, I am trying to create my struts2 UI-Tag too. Did you change the org.apache.struts2.views.jsp.ui.CheckboxListTag to your rewritten the Tag-class and the correspond CheckboxList yet? Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
Hello Li, Thank you for your help, I think I shall ask this question in the dev-mail-list, Maybe I will get the answer. Regards, Mead
Effective implementation
Hiii I have a case study that need 5 json that will be consume by one web page, an ajax approach Is there another way that we can only create minimum action rather than 5 which I did here Is map the method with result in one action class is the best one? F /m/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to create a costume struts2 tag? any demo?
U can take a look of s2 jquery plugins And also the grid example This is the only tag plugins that modular /m/ -Original Message- From: Mead Lai laiqi...@gmail.com Date: Sun, 10 Oct 2010 06:06:15 To: Struts Users Mailing Listuser@struts.apache.org Reply-To: Struts Users Mailing List user@struts.apache.org Subject: Re: How to create a costume struts2 tag? any demo? Hello Li, Thank you for your help, I think I shall ask this question in the dev-mail-list, Maybe I will get the answer. Regards, Mead
Re: 2 View, and optional JSON
Why? Is the data returned from the service different from the data you'd return on the page? Even if it is, it's not going to be significantly different, and the pages returning data for html rendering is only going to have slightly more data. On Oct 9, 2010 6:00 PM, Frans Thamura fr...@meruvian.org wrote: my idea to spilt the WEb API (REST) with JSON with our current html code and need to make it effective or my mind worst ;) F On Sun, Oct 10, 2010 at 4:23 AM, Dave Newton davelnew...@gmail.com wrote: And HTML, and could be extended to create anything else you wanted. On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: the REST automatically create JSON and XML F On Sun, Oct 10, 2010 at 3:24 AM, Dave Newton davelnew...@gmail.com wrote: The REST plugin already returns data based on the URL suffix--what's wrong with using that mechanism? On Saturday, October 9, 2010, Frans Thamura fr...@meruvian.org wrote: hi all we need all ur tips we wanna to create a REST Action but with optional JSON, and 2 view the idea we wanna to create a full blown website, mobile edition using sencha touch, and optional JSON to make REST as service producer (consume by android) but not all the Action can become JSON any idea all? F - 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Hi Burton, I see, that would be the problem cause that ERROR. You have to download the struts2 source, and take a look at the both org.apache.struts2.views.jsp.ui.CheckboxListTag and org.apache.struts2.components,CheckboxList. I think you must add the attribute breakCount into CheckboxList.java, then it will work, maybe. I am not sure about that, I am also got the same problem, when creating myself Tag. Good Luck. Regards, Mead On Sun, Oct 10, 2010 at 6:04 AM, Burton Rhodes burtonrho...@gmail.comwrote: I ended up not having to create a new tag. I simply overrode the current template (template/simple/checkboxlist.tld) to do what I wanted. Essentially I just did what it says on this page entitled Creating And Applying Your Own Themes For Struts 2 Tags: http://struts.apache.org/2.2.1/docs/struts-2-themes.html On Sat, Oct 9, 2010 at 4:58 PM, Mead Lai laiqi...@gmail.com wrote: Hello all, I am trying to create my struts2 UI-Tag too. Did you change the org.apache.struts2.views.jsp.ui.CheckboxListTag to your rewritten the Tag-class and the correspond CheckboxList yet? Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Thanks for the email. I was afraid it might be a bit more involved. I will probably shy away from that sort of surgery. Once you start modifying the Struts source, it can make future Struts upgrades painful. On Sat, Oct 9, 2010 at 5:26 PM, Mead Lai laiqi...@gmail.com wrote: Hi Burton, I see, that would be the problem cause that ERROR. You have to download the struts2 source, and take a look at the both org.apache.struts2.views.jsp.ui.CheckboxListTag and org.apache.struts2.components,CheckboxList. I think you must add the attribute breakCount into CheckboxList.java, then it will work, maybe. I am not sure about that, I am also got the same problem, when creating myself Tag. Good Luck. Regards, Mead On Sun, Oct 10, 2010 at 6:04 AM, Burton Rhodes burtonrho...@gmail.comwrote: I ended up not having to create a new tag. I simply overrode the current template (template/simple/checkboxlist.tld) to do what I wanted. Essentially I just did what it says on this page entitled Creating And Applying Your Own Themes For Struts 2 Tags: http://struts.apache.org/2.2.1/docs/struts-2-themes.html On Sat, Oct 9, 2010 at 4:58 PM, Mead Lai laiqi...@gmail.com wrote: Hello all, I am trying to create my struts2 UI-Tag too. Did you change the org.apache.struts2.views.jsp.ui.CheckboxListTag to your rewritten the Tag-class and the correspond CheckboxList yet? Regards, Mead - 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
Re: Nasty exception in struts2 ognl
On 10/9/2010 2:48 AM, Ricardo Oliveira wrote: Also posted in stackoverflow: http://stackoverflow.com/questions/3895961/nasty-java-lang-numberformatexception-in-struts2-ognl Any help appreciated! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org It is not an OGNL problem. The String you are trying to convert is not convertible to an int in Java just like you could not convert the String abc to an int. You need to use a long. Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] How to add a custom parameter to an existing Struts UI Tag?
Hi Burton: The error message looks like the TLD file does not defined the new attribute correctly. So i think maybe the execute environment is not using the modified TLD file but the old one. Can you show us how you do apply your TLD file to the execute environment? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Simple theme and field errors
Working on first Struts2 project, and quickly found out that standard themes can produce some quirky output. (Hoping to write my own when I get some time). I decided to simply use the simple theme to give me the most control over HTML formatting. However, it doesn't display field errors from validation. So I tried adding this to jsp where I want the error message to pop up: s:property value=fieldErrors.fname/ ... where fname is the field that failed validation. This works, but the error message always gets rendered back wrapped in brackets: [You must enter a first name] Of course, one could write some nasty code to strip out the brackets, but there must be an easier way. Thanks for any help, David
Re: Simple theme and field errors
There can be more than one error; it's a collection. Dave On Sunday, October 10, 2010, Altenhof, David Aron dalte...@iupui.edu wrote: Working on first Struts2 project, and quickly found out that standard themes can produce some quirky output. (Hoping to write my own when I get some time). I decided to simply use the simple theme to give me the most control over HTML formatting. However, it doesn't display field errors from validation. So I tried adding this to jsp where I want the error message to pop up: s:property value=fieldErrors.fname/ ... where fname is the field that failed validation. This works, but the error message always gets rendered back wrapped in brackets: [You must enter a first name] Of course, one could write some nasty code to strip out the brackets, but there must be an easier way. Thanks for any help, David - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Optimize webserver performance
Hi friends, I have a few different applications running on a small VPS, tomcat 5.5.x, struts 1.2 , mysql. I need to know , what can i do to optimize the server files, like can i place the mysql-..jar file in the tomcat commons lib folder. ie should i place all the common files i have in all my applications in the commons folder of tomcat, so that the same file is not loaded individually for each project, Pl advice. -- Thanks and kind Regards, Abhishek jain