Re: validator question
Le Mardi 2 Août 2005 20:14, Dewitte Rémi a écrit : Hi ! In a wizard, I have some required checks with struts-validator assigned to pages (with page=). There is sometimes a jump in the wizard so that a property is null. When validating the page after the jump, the server-side validation failed as if validator checked all previous pages. For example, page1 - property q1 page2 - property q2 page3 - property q3 If i jump from page1 to page3, submitting page3 will failed telling q2 is required (because null). Can you confirm that the validator ckecks all properties for pages = current page ? Answer to myself : yes From validator src : /** * Gets the page. This in conjunction with the page property of * a codeFieldcode can control the processing of fields. If the field's * page is less than or equal to this page value, it will be processed. */ public int getPage() { return page; } Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
validator question
Hi ! In a wizard, I have some required checks with struts-validator assigned to pages (with page=). There is sometimes a jump in the wizard so that a property is null. When validating the page after the jump, the server-side validation failed as if validator checked all previous pages. For example, page1 - property q1 page2 - property q2 page3 - property q3 If i jump from page1 to page3, submitting page3 will failed telling q2 is required (because null). Can you confirm that the validator ckecks all properties for pages = current page ? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles problem
Or simply : global-forwards forward name=goMain path=base.definition/ /global-forwards Rémi Le Dimanche 24 Juillet 2005 05:59, Laurie Harper a écrit : Your global forward needs to point to an action, not directly to a tiles definition. Change your struts-config.xml as follows: ... global-forwards forward contextRelative=true name=goMain path=/Main/ /global-forwards action-mappings action path=/Main type=org.apache.struts.actions.ForwardAction parameter=base.definition/ action-mappings ... That should do the trick, roughly. L. Werner Punz wrote: Hi I am trying to get tiles up and running and so far I am trying to do a simple tiled forward the problem is, I can call the forwarded page directly and it displays but as soon as I call the tiles definition name I get errors here are my config files: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; struts-config data-sources/ form-beans/ global-exceptions/ global-forwards forward contextRelative=true name=goMain path=base.definition/ /global-forwards action-mappings/ controller bufferSize=4096 className=org.apache.struts.tiles.TilesRequestProcessor/ message-resources parameter=com.sonydadc.claudio.resources.ApplicationResource/ plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml/ set-property property=moduleAware value=true/ set-property property=definitions-parser-validate value=true/ /plug-in /struts-config for the struts-config ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd; tiles-definitions definition name=base.definition path=/helloworld.jsp/ /tiles-definitions for the tiles definition and as soon as I global forward goMain I get following error Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.jav a:370) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.lang.NullPointerException org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.jav a:446) org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.jav a:329) org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL(RedirectTa g.java:296) org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:270) org.apache.jsp.index_jsp._jspx_meth_logic_redirect_0(org.apache.jsp.index _jsp:85) org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:59) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.jav a:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs. I am sort of stumped on what is going on here Does anyone know the cause? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: saving a DynaForm
I think i'll take your second option. I could make something work with serializable as said Martin (and confirmed by you), but if we decide a day to change the way to make data persistent, many frameworks exist for POJOs (eg. hibernate). And Benautils provides : BeanUtilsBean.populate(bean,map) BeanUtilsBean.copyProperties(bean,bean) So even i must maintain an other class, this is propably the best way. Thanks Martin and Laurie. Le Lundi 18 Juillet 2005 19:07, Laurie Harper a écrit : Dewitte Rémi wrote: Hello ! I uses LazyDynaForm to gather user results. Now I'd like to save those results. All persisence framework are for POJO, do you know a common solution ? May I create a POJO to make the transition/link ? It all depends on your requirements and what persistence technologies you want to use. As Martin said, your LazyDynaForms are Serializable so you can write them to an object stream as with any other Serializable class. Many persistence frameworks, including (most?) ORM tools can persist Serializable instances directly. Your other option is to define a concrete POJO which you can map to persistent storage using your chosen solution and copy data from your LazyDyanForm into your POJO prior to persisting. BeanUtils can make it pretty trivial (sometimes as little as a single line of code) to manage the copying of data between form beans and POJOs. If that doesn't help, you might want to post a more detailed description of what you want to do. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: saving a DynaForm
I wrote this method to achieve : it can perfectible i think. public static void copyProperties(Object pojo, DynaBean bean) throws IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException { DynaProperty[] dynaProperties = bean.getDynaClass().getDynaProperties(); for (DynaProperty d : dynaProperties) { Object value = bean.get(d.getName()); Class type = d.getType(); Class c; if (d.isIndexed()) c = type.getComponentType(); else c = type; // c'est un dynaBean if (DynaBean.class.isAssignableFrom(c)) { String pojoName = c.getName().replaceFirst(Lazy, dao.Pojo); if (d.getType().isArray()) { Object[] objs = (Object[]) Array.newInstance(Class.forName(pojoName),Array.getLength(value)); for(int i =0 ; iobjs.length;i++){ objs[i] = Class.forName(pojoName).newInstance(); copyProperties(objs[i], (DynaBean) Array.get(value,i)); } BeanUtils.copyProperty(pojo, d.getName(), objs); } else { Object in = Class.forName(pojoName).newInstance(); copyProperties(in, (DynaBean) value); BeanUtils.copyProperty(pojo, d.getName(), in); } // copie simple } else { BeanUtils.copyProperty(pojo, d.getName(), value); } } } Rémi Le Mardi 19 Juillet 2005 14:52, Martin Gainty a écrit : Bonjour Remi Am glad that satisfies your requirement.. Bon Chance, Martin- - Original Message - From: Dewitte Rémi [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 19, 2005 5:32 AM Subject: Re: saving a DynaForm I think i'll take your second option. I could make something work with serializable as said Martin (and confirmed by you), but if we decide a day to change the way to make data persistent, many frameworks exist for POJOs (eg. hibernate). And Benautils provides : BeanUtilsBean.populate(bean,map) BeanUtilsBean.copyProperties(bean,bean) So even i must maintain an other class, this is propably the best way. Thanks Martin and Laurie. Le Lundi 18 Juillet 2005 19:07, Laurie Harper a écrit : Dewitte Rémi wrote: Hello ! I uses LazyDynaForm to gather user results. Now I'd like to save those results. All persisence framework are for POJO, do you know a common solution ? May I create a POJO to make the transition/link ? It all depends on your requirements and what persistence technologies you want to use. As Martin said, your LazyDynaForms are Serializable so you can write them to an object stream as with any other Serializable class. Many persistence frameworks, including (most?) ORM tools can persist Serializable instances directly. Your other option is to define a concrete POJO which you can map to persistent storage using your chosen solution and copy data from your LazyDyanForm into your POJO prior to persisting. BeanUtils can make it pretty trivial (sometimes as little as a single line of code) to manage the copying of data between form beans and POJOs. If that doesn't help, you might want to post a more detailed description of what you want to do. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
saving a DynaForm
Hello ! I uses LazyDynaForm to gather user results. Now I'd like to save those results. All persisence framework are for POJO, do you know a common solution ? May I create a POJO to make the transition/link ? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles
Hi ! I make a definition in which i put a list of tiles to include but I can't achieve to do this eg : in my tiles-defs.xml : definition name=page1-def extends=baseDef put name=page value=1/ putList name=listQuestions add value=/Q/firstName.jsp/ add value=/Q/lastName.jsp/ /putList /definition And in my template, i don't know how to iterate in listQuestions in order to include /Q/firstName.jsp and /Q/lastName.jsp. A start : tiles:importAttribute/ c:out value=${listQuestions}/ c:forEach items=${listQuestions} var=question What to do to include question ! /c:forEach Maybe it's not possible... Thanks. Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles
I answer myself. I achieved doing this : tiles:useAttribute id=listQuestions name=listQuestions classname=java.util.List / % java.util.Iterator i=listQuestions.iterator(); while( i.hasNext() ) { String question= (String)i.next(); % tiles:insert name=%=question% flush=true / br % } % Is there any way to do this with tags ? I would like my presentation pages don't have java code like this. Rémi Le Lundi 11 Juillet 2005 13:20, Dewitte Rémi a écrit : Hi ! I make a definition in which i put a list of tiles to include but I can't achieve to do this eg : in my tiles-defs.xml : definition name=page1-def extends=baseDef put name=page value=1/ putList name=listQuestions add value=/Q/firstName.jsp/ add value=/Q/lastName.jsp/ /putList /definition And in my template, i don't know how to iterate in listQuestions in order to include /Q/firstName.jsp and /Q/lastName.jsp. A start : tiles:importAttribute/ c:out value=${listQuestions}/ c:forEach items=${listQuestions} var=question What to do to include question ! /c:forEach Maybe it's not possible... Thanks. Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles
Which does not work : Can't insert page '/Q/firstName.jsp' : Illegal to flush within a custom tag Hum ... Seems to be a bit complicated ! Thanks. Le Lundi 11 Juillet 2005 11:37, Leon Rosenberg a écrit : logic:iterate name=listQuestions id=question toScope=page type=java.lang.String tiles:insert name=%=question% flush=true / /logic:iterate Unfortunately you can't get rid of the %=question%, but it would be the only java code in the page. Regards leon -Ursprüngliche Nachricht- Von: Dewitte Rémi [mailto:[EMAIL PROTECTED] Gesendet: Montag, 11. Juli 2005 13:33 An: Struts Users Mailing List Betreff: Re: Tiles I answer myself. I achieved doing this : tiles:useAttribute id=listQuestions name=listQuestions classname=java.util.List / % java.util.Iterator i=listQuestions.iterator(); while( i.hasNext() ) { String question= (String)i.next(); % tiles:insert name=%=question% flush=true / br % } % Is there any way to do this with tags ? I would like my presentation pages don't have java code like this. Rémi Le Lundi 11 Juillet 2005 13:20, Dewitte Rémi a écrit : Hi ! I make a definition in which i put a list of tiles to include but I can't achieve to do this eg : in my tiles-defs.xml : definition name=page1-def extends=baseDef put name=page value=1/ putList name=listQuestions add value=/Q/firstName.jsp/ add value=/Q/lastName.jsp/ /putList /definition And in my template, i don't know how to iterate in listQuestions in order to include /Q/firstName.jsp and /Q/lastName.jsp. A start : tiles:importAttribute/ c:out value=${listQuestions}/ c:forEach items=${listQuestions} var=question What to do to include question ! /c:forEach Maybe it's not possible... Thanks. Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles
Going on... tiles:useAttribute id=listQuestions name=listQuestions classname=java.util.List / c:forEach items=${listQuestions} var=question c:out value=${question}/ tiles:insert name=%=question% flush=false / /c:forEach Gives me : question cannot be resolved Seems to me it's a basic jsp knowledge... That i don't have. Rémi Le Lundi 11 Juillet 2005 12:13, Leon Rosenberg a écrit : use flush=false Flush=true works only in a top page, if you already included another page (or tile) yor aren't allowed to flush. At least in tomcat. Regards Leon -Ursprüngliche Nachricht- Von: Dewitte Rémi [mailto:[EMAIL PROTECTED] Gesendet: Montag, 11. Juli 2005 13:59 An: Struts Users Mailing List Betreff: Re: Tiles Which does not work : Can't insert page '/Q/firstName.jsp' : Illegal to flush within a custom tag Hum ... Seems to be a bit complicated ! Thanks. Le Lundi 11 Juillet 2005 11:37, Leon Rosenberg a écrit : logic:iterate name=listQuestions id=question toScope=page type=java.lang.String tiles:insert name=%=question% flush=true / /logic:iterate Unfortunately you can't get rid of the %=question%, but it would be the only java code in the page. Regards leon -Ursprüngliche Nachricht- Von: Dewitte Rémi [mailto:[EMAIL PROTECTED] Gesendet: Montag, 11. Juli 2005 13:33 An: Struts Users Mailing List Betreff: Re: Tiles I answer myself. I achieved doing this : tiles:useAttribute id=listQuestions name=listQuestions classname=java.util.List / % java.util.Iterator i=listQuestions.iterator(); while( i.hasNext() ) { String question= (String)i.next(); % tiles:insert name=%=question% flush=true / br % } % Is there any way to do this with tags ? I would like my presentation pages don't have java code like this. Rémi Le Lundi 11 Juillet 2005 13:20, Dewitte Rémi a écrit : Hi ! I make a definition in which i put a list of tiles to include but I can't achieve to do this eg : in my tiles-defs.xml : definition name=page1-def extends=baseDef put name=page value=1/ putList name=listQuestions add value=/Q/firstName.jsp/ add value=/Q/lastName.jsp/ /putList /definition And in my template, i don't know how to iterate in listQuestions in order to include /Q/firstName.jsp and /Q/lastName.jsp. A start : tiles:importAttribute/ c:out value=${listQuestions}/ c:forEach items=${listQuestions} var=question What to do to include question ! /c:forEach Maybe it's not possible... Thanks. Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: howto with validator
Ok thanks, i'll try to achieve with the validator-rule.xml. But if i can't you suggest me to extends the plugin validator to include more specific rules, didn't you ? Rémi Le Mardi 5 Juillet 2005 07:45, Nitesh Naveen a écrit : You could do this with validator and indexed properties. When using indexed properties, JavaScript validations doesn't work. However the server side validations does. This should suffice what you need... In case you have some validations that involve business logic, you could add more validations, customize the validator-rule.xml add your own validation there point it to a custom validator method in the validator you have coded. HTH, Nitesh _ Disclaimer: Information contained and transmitted by this e-mail is confidential, proprietary, and legally privileged data of Cordiant Technologies that is intended for use only by the addressee. If you are not the intended recipient, you are notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator. Any views expressed by an individual do not necessarily reflect the view of Cordiant Technologies. The recipient should scan this email and any attachments for viruses as Cordiant Technologies is not liable for the presence of viruses in this email. Cordiant Technologies does not accept liability for any errors or omissions as the internet communications cannot be guaranteed to be timely, secure, error or virus-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete. To know more about Cordiant Technologies, please visit http://www.cordiant.com _ -Original Message- From: Dewitte Rémi [mailto:[EMAIL PROTECTED] Sent: Monday, July 04, 2005 9:21 PM To: Struts Users Mailing List Subject: howto with validator Hello everybody ! I have some howto questions related to validator. I'd like to do some checks on my form : 1) in a multibox question, i'd like to check at least 2 are checked and at most 4. 2) I have a mapped property, I'd like to check every mymap(key) is answered. 3) I have a form property of type java.lang.String[], which is an array of names(html:text property=names[0]/). I'd like to check all the names with usual validator features. Is it possible with the validator or may I make it in my actionForm ? Thanks Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: howto with validator
Thanks for the tip ! Rémi Le Mardi 5 Juillet 2005 11:15, Nitesh Naveen a écrit : Well... You need not extend the validator plugin. You could write your custom validator class and write a method in that... For eg. You could specify this in your validator-rule.xml... validator name=whatever classname=com.myvalidation.FieldChecks method=validateWhatever All you need to have now is a class FieldChecks in the given package and a method as specified. Now you have the validation. You could use this validation - 'whatever' - in your validation.xml HTH, Nitesh _ Disclaimer: Information contained and transmitted by this e-mail is confidential, proprietary, and legally privileged data of Cordiant Technologies that is intended for use only by the addressee. If you are not the intended recipient, you are notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator. Any views expressed by an individual do not necessarily reflect the view of Cordiant Technologies. The recipient should scan this email and any attachments for viruses as Cordiant Technologies is not liable for the presence of viruses in this email. Cordiant Technologies does not accept liability for any errors or omissions as the internet communications cannot be guaranteed to be timely, secure, error or virus-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete. To know more about Cordiant Technologies, please visit http://www.cordiant.com _ -Original Message- From: Dewitte Rémi [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 05, 2005 4:36 PM To: Struts Users Mailing List Subject: Re: howto with validator Ok thanks, i'll try to achieve with the validator-rule.xml. But if i can't you suggest me to extends the plugin validator to include more specific rules, didn't you ? Rémi Le Mardi 5 Juillet 2005 07:45, Nitesh Naveen a écrit : You could do this with validator and indexed properties. When using indexed properties, JavaScript validations doesn't work. However the server side validations does. This should suffice what you need... In case you have some validations that involve business logic, you could add more validations, customize the validator-rule.xml add your own validation there point it to a custom validator method in the validator you have coded. HTH, Nitesh _ Disclaimer: Information contained and transmitted by this e-mail is confidential, proprietary, and legally privileged data of Cordiant Technologies that is intended for use only by the addressee. If you are not the intended recipient, you are notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator. Any views expressed by an individual do not necessarily reflect the view of Cordiant Technologies. The recipient should scan this email and any attachments for viruses as Cordiant Technologies is not liable for the presence of viruses in this email. Cordiant Technologies does not accept liability for any errors or omissions as the internet communications cannot be guaranteed to be timely, secure, error or virus-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete. To know more about Cordiant Technologies, please visit http://www.cordiant.com _ -Original Message- From: Dewitte Rémi [mailto:[EMAIL PROTECTED] Sent: Monday, July 04, 2005 9:21 PM To: Struts Users Mailing List Subject: howto with validator Hello everybody ! I have some howto questions related to validator. I'd like to do some checks on my form : 1) in a multibox question, i'd like to check at least 2 are checked and at most 4. 2) I have a mapped property, I'd like to check every mymap(key) is answered. 3) I have a form property of type java.lang.String[], which is an array of names(html:text property=names[0]/). I'd like to check all the names with usual validator features. Is it possible with the validator or may I make it in my actionForm ? Thanks Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
swith to struts-el
I'd like to switch all my callic struts tags to struts-el in order to not mix all tags. How do you switch logic.equal to c:if ? For example : logic:equal name=myForm property=sex value=F Thanks again... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: swith to struts-el
Hum, I tried : Unable to find a value for sex in object of class org.apache.struts.validator.LazyValidatorForm using operator . (null) Indeed, it's a DynaBean. Have an idea ? Le Lundi 4 Juillet 2005 16:43, Ivan Rodriguez a écrit : c:if test=${myForm.sex eq 'F'} Dewitte Rémi escribió: I'd like to switch all my callic struts tags to struts-el in order to not mix all tags. How do you switch logic.equal to c:if ? For example : logic:equal name=myForm property=sex value=F Thanks again... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: swith to struts-el
That's it ! Thanks ! Le Lundi 4 Juillet 2005 17:03, Wendy Smoak a écrit : From: Dewitte Rémi [EMAIL PROTECTED] Hum, I tried : Unable to find a value for sex in object of class org.apache.struts.validator.LazyValidatorForm using operator . (null) Indeed, it's a DynaBean. http://struts.apache.org/userGuide/building_controller.html#dyna_action_for m_classes Try: c:if test=${myForm.map.sex eq 'F'} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: swith to struts-el
I have no error but it doesn't work. Thanks for your answer anyway. Le Lundi 4 Juillet 2005 17:30, Ivan Rodriguez a écrit : So if it doesnt work for you, try c:if test=${sex eq 'F'} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
deal with nested properties
Hi all ! I have another problem to submit : Here is my bean form-bean name=questionnaireForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.Integer initial=1/ form-property name=firstName type=java.lang.String initial=Nom / form-property name=lastName type=java.lang.String / form-property name=child type=java.lang.String initial=N/ form-property name=numChild type=java.lang.Integer initial=0/ /form-bean where Personne is a class of two attributes {name,age} with their getters and setters. In my jsp, I try do do this : bean:define id=numChild name=questionnaireForm property=numChild type=java.lang.Integer/ c:forEach begin=1 end='%=numChild.intValue()%' var=ind bean:define name=ind id=ind2 type=java.lang.Integer/ tr tdbean:write name=ind//td tdhtml:text property='%=children[+(ind2.intValue()-1)+].name%' size=30 maxlength=30//td tdhtml:text property='%=children[+(ind2.intValue()-1)+].age%' size=30 maxlength=30//td /tr /c:forEach And i get this error : No getter method for property children[0].name of bean org.apache.struts.taglib.html.BEAN Following the Struts FAQ for Indexed properties, it seems it should work... Please tell me what I missed. Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: deal with nested properties
Yes sorry, i have also : form-property name=children type=net.gide.webapp.Personne[]/ But it doesn't work ! Rémi Le Vendredi 1 Juillet 2005 13:29, Nitesh Naveen a écrit : You should probably have... form-bean name=questionnaireForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.Integer initial=1/ form-property name=firstName type=java.lang.String initial=Nom / form-property name=lastName type=java.lang.String / form-property name=child type=java.lang.String initial=N/ form-property name=numChild type=java.lang.Integer initial=0/ form-property name= children type=package.Personne[] / /form-bean HTH Nitesh -Original Message- From: Dewitte Rémi [mailto:[EMAIL PROTECTED] Sent: Friday, July 01, 2005 5:54 PM To: Struts Users Mailing List Subject: deal with nested properties Hi all ! I have another problem to submit : Here is my bean form-bean name=questionnaireForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.Integer initial=1/ form-property name=firstName type=java.lang.String initial=Nom / form-property name=lastName type=java.lang.String / form-property name=child type=java.lang.String initial=N/ form-property name=numChild type=java.lang.Integer initial=0/ /form-bean where Personne is a class of two attributes {name,age} with their getters and setters. In my jsp, I try do do this : bean:define id=numChild name=questionnaireForm property=numChild type=java.lang.Integer/ c:forEach begin=1 end='%=numChild.intValue()%' var=ind bean:define name=ind id=ind2 type=java.lang.Integer/ tr tdbean:write name=ind//td tdhtml:text property='%=children[+(ind2.intValue()-1)+].name%' size=30 maxlength=30//td tdhtml:text property='%=children[+(ind2.intValue()-1)+].age%' size=30 maxlength=30//td /tr /c:forEach And i get this error : No getter method for property children[0].name of bean org.apache.struts.taglib.html.BEAN Following the Struts FAQ for Indexed properties, it seems it should work... Please tell me what I missed. Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: deal with nested properties
Thanks a lot. More precisely, i must do this to get it work ! tdbean:write name=ind//td because c:out value=${ind}/ gives me $ind} tdhtml-el:text property=children[${ind}].nom//td tdhtml-el:text property=children[${ind}].age//td Le Vendredi 1 Juillet 2005 14:01, Wendy Smoak a écrit : From: Dewitte Rémi [EMAIL PROTECTED] In my jsp, I try do do this : bean:define id=numChild name=questionnaireForm property=numChild type=java.lang.Integer/ c:forEach begin=1 end='%=numChild.intValue()%' var=ind bean:define name=ind id=ind2 type=java.lang.Integer/ bean:write name=ind/ html:text property='%=children[+(ind2.intValue()-1)+].name%' size=30 maxlength=30/ html:text property='%=children[+(ind2.intValue()-1)+].age%' size=30 maxlength=30/ /c:forEach I took out the table tags and reformatted a bit. Where are the form tags? html:text only works inside a html:form. Assuming you just left them out... I don't think this will be exactly right, but maybe it will give you an idea. (I don't actually use indexed properties in my projects, but I *think* this is how it's supposed to work... ) c:forEach begin=0 end=${questionnaireForm.numChild} var=ind c:out value=${ind}/ name: html-el:text property=${children[ind].name}/ age: html-el:text property=${children[ind].age}/ br/ /c:forEach (I note that you added form-property name=children type=net.gide.webapp.Personne[]/ to the form in a later message, which I was going to mention is necessary.) Consider switching to Struts-EL and JSTL so that you're not mixing the 'classic' tags which have JSTL equivalents. (For example, use c:set instead of bean:define if you need it.) Look in the 'contrib' directory for Struts-EL. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: deal with nested properties
Oups, sorry now it works fine ! I use the jstl.jar and standard.jar from the struts.tar.gz But now it's oki. Merci ! Rémi Le Vendredi 1 Juillet 2005 16:00, Martin Gainty a écrit : Rémi- Which version JSTL are you implementing with? Bon Chance, Martin- - Original Message - From: Dewitte Rémi [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, July 01, 2005 11:36 AM Subject: Re: deal with nested properties Thanks a lot. More precisely, i must do this to get it work ! tdbean:write name=ind//td because c:out value=${ind}/ gives me $ind} tdhtml-el:text property=children[${ind}].nom//td tdhtml-el:text property=children[${ind}].age//td Le Vendredi 1 Juillet 2005 14:01, Wendy Smoak a écrit : From: Dewitte Rémi [EMAIL PROTECTED] In my jsp, I try do do this : bean:define id=numChild name=questionnaireForm property=numChild type=java.lang.Integer/ c:forEach begin=1 end='%=numChild.intValue()%' var=ind bean:define name=ind id=ind2 type=java.lang.Integer/ bean:write name=ind/ html:text property='%=children[+(ind2.intValue()-1)+].name%' size=30 maxlength=30/ html:text property='%=children[+(ind2.intValue()-1)+].age%' size=30 maxlength=30/ /c:forEach I took out the table tags and reformatted a bit. Where are the form tags? html:text only works inside a html:form. Assuming you just left them out... I don't think this will be exactly right, but maybe it will give you an idea. (I don't actually use indexed properties in my projects, but I *think* this is how it's supposed to work... ) c:forEach begin=0 end=${questionnaireForm.numChild} var=ind c:out value=${ind}/ name: html-el:text property=${children[ind].name}/ age: html-el:text property=${children[ind].age}/ br/ /c:forEach (I note that you added form-property name=children type=net.gide.webapp.Personne[]/ to the form in a later message, which I was going to mention is necessary.) Consider switching to Struts-EL and JSTL so that you're not mixing the 'classic' tags which have JSTL equivalents. (For example, use c:set instead of bean:define if you need it.) Look in the 'contrib' directory for Struts-EL. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: use a plugin property
It works perfectly, thank you. Rémi Le Mercredi 29 Juin 2005 11:33, Marsh-Bourdon, Christopher a écrit : Create a private property with a Getter and Setter in your plugin, and the wonders, nay mysteries, of Struts will ensure that it gets populated for your use. Christopher Marsh-Bourdon www.marsh-bourdon.com -Original Message- From: Dewitte Rémi [mailto:[EMAIL PROTECTED] Sent: 29 June 2005 12:27 To: user@struts.apache.org Subject: use a plugin property Hello ! I'd like to use the pathname property of my plugin configuration in my page. How can I do this with bean:define ? plug-in className=net.gide.webapp.results.memory.MemoryResultsDatabasePlugIn set-property property=pathname value=/WEB-INF/results-database/ /plug-in Thanks Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- --- - The information contained herein is confidential and is intended solely for the addressee. Access by any other party is unauthorised without the express written permission of the sender. If you are not the intended recipient, please contact the sender either via the company switchboard on +44 (0)20 7623 8000, or via e-mail return. If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. 3166 --- - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iterate on a value
Hello ! In my form , i ask the number of children. On the next page, i'd like to display as many textboxes as children to get their name. logic:iterate provides iteration on array or collection, how can i iterate on the number of children ? Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
use a plugin property
Hello ! I'd like to use the pathname property of my plugin configuration in my page. How can I do this with bean:define ? plug-in className=net.gide.webapp.results.memory.MemoryResultsDatabasePlugIn set-property property=pathname value=/WEB-INF/results-database/ /plug-in Thanks Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: iterate on properties of a DynaActionForm
Indeed, I need help. I wrote it : logic:iterate name=questionnaireForm property=map id=item bean:write name=item property=key / - bean:write name=itemproperty=value/ /br/ /logic:iterate Which gives me an error telling there is no getter for property map while in the struts javadoc for org.apache.struts.action.DynaActionForm : java.util.Map getMap() Returns the Map containing the property values. Thanks for your help, what you gave me works just fine. Rémi Le Lundi 27 Juin 2005 22:23, Wendy Smoak a écrit : From: Dewitte Rémi [EMAIL PROTECTED] I'm quite new in struts and i'd like to print all properties of my form with their corresponding value. I don't manage to do this with iterate. Could you please suggest me a solution ? my bean name is QuestionnaireForm defined in struts-config: form-bean name=QuestionnaireForm type=org.apache.struts.validator.DynaValidatorForm Do you just want to see what's in the form, for debugging purposes? If so, you don't have to iterate, just do: %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:out value=${QuestionnaireForm} / (or bean:write name=QuestionnaireForm / ) This just calls the 'toString' method on the form. In this case, DynaValidatorForm prints out its internal Map. If you do need to iterate over the form contents, ask the form for its Map, then print out the key and value of each MapEntry: c:forEach items=${contactForm.map} var=item c:out value=${item.key} / - c:out value=${item.value} /br/ /c:forEach If you need help translating to logic:iterate, let us know. (Also, you might want to make your form name start with a lower-case letter. Otherwise it looks like a class name instead of an instance.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iterate on properties of a DynaActionForm
Hi ! I'm quite new in struts and i'd like to print all properties of my form with their corresponding value. I don't manage to do this with iterate. Could you please suggest me a solution ? my bean name is QuestionnaireForm defined in struts-config: form-bean name=QuestionnaireForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.Integer initial=1 / form-property name=firstName type=java.lang.String initial=Nom / form-property name=lastName type=java.lang.String / form-property name=zipPostal type=java.lang.String initial=44000 / form-property name=phone type=java.lang.String / form-property name=email type=java.lang.String / /form-bean Thanks ! Rémi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]