Re: Validation using validation.xml issue
Ashish Kulkarni wrote: Hi I have a defined following bean in struts-config.xml form-property name=color type=java.lang.String / form-property name=datereqList type=java.util.List / In my action class i set datereqList and pass it along to the jsp, the jsp displays it as drop down box, in my validtion.xml i am checking to make sure that color is not blank, So when validation finds that color is blank it send response to the jsp page, but now datereqList is not in request, since it is lost. What is the best way to solve it, should i put datereqList in session? It sounds like you have your action's 'input' property pointing directly at the JSP. Your best bet is to have two action mappings, one for displaying the form and one for processing it on submission. Then set the second mapping's 'input' to point to the first mapping. Now, whenever the form is displayed -- either initially, or following validation errors -- the form-display action will be called, giving you a place to load the list into the form. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation using validation.xml issue
Hi The error is thrown by validator frame work, and hence it never reaches action class where i can load those list again, I am not very sure how validtor framework works Ashish On 8/31/07, Laurie Harper [EMAIL PROTECTED] wrote: Ashish Kulkarni wrote: Hi I have a defined following bean in struts-config.xml form-property name=color type=java.lang.String / form-property name=datereqList type=java.util.List / In my action class i set datereqList and pass it along to the jsp, the jsp displays it as drop down box, in my validtion.xml i am checking to make sure that color is not blank, So when validation finds that color is blank it send response to the jsp page, but now datereqList is not in request, since it is lost. What is the best way to solve it, should i put datereqList in session? It sounds like you have your action's 'input' property pointing directly at the JSP. Your best bet is to have two action mappings, one for displaying the form and one for processing it on submission. Then set the second mapping's 'input' to point to the first mapping. Now, whenever the form is displayed -- either initially, or following validation errors -- the form-display action will be called, giving you a place to load the list into the form. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation chaining in struts2
Struts 2 uses a hierarchical approach to validation which could be used to support a multi-page workflow. (Struts 1 simulates a hierarchy by using the page property on the ActionForm.) The validation follows the Java class, not the action mapping. If class2 extends class1, then when class2 is validated, the validations for class1 also fire. If you like to collect all the methods for a workflow into a single class, then, in practice, class2 might be an empty class that only exists to appease the XWork Validation system. HTH, Ted http://www.husted.com/ted/blog/ On 8/29/07, Pavel Sapozhnikov [EMAIL PROTECTED] wrote: Hey guys. Could somebody provide some input on validation chaining in s2. Here's what I need to do. So there has to be a base validation which would validate variable x and variable y then every other class has its own validation for example Login class would validate if username and password exist but the prerequisite is that base validation should pass. How do I do that in struts2. Any input would be appreciated. Thanks. -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation chaining in struts2
Ted, Regarding field validations, can you provide any reason why the validwhen validator is not provided in Struts 2? . I think this is a step backwards from Struts 1 where we could easily manage conditional validation (validate fieldb only if fielda fieldc meet some condition) Also, the validators in Struts 1 returned true/false for success/failure, and we had the option of adding messages or not ; but in Struts 2 the only way to tell a validation failed is by the presence of errors on the field. Both of these limitations (if you will) make conditional validation (without error message for the condition itself) almost impossible. Hope i'm not missing anything here. Please let us know your thoughts Thanks, Joseph On 8/30/07, Ted Husted [EMAIL PROTECTED] wrote: Struts 2 uses a hierarchical approach to validation which could be used to support a multi-page workflow. (Struts 1 simulates a hierarchy by using the page property on the ActionForm.) The validation follows the Java class, not the action mapping. If class2 extends class1, then when class2 is validated, the validations for class1 also fire. If you like to collect all the methods for a workflow into a single class, then, in practice, class2 might be an empty class that only exists to appease the XWork Validation system. HTH, Ted http://www.husted.com/ted/blog/ On 8/29/07, Pavel Sapozhnikov [EMAIL PROTECTED] wrote: Hey guys. Could somebody provide some input on validation chaining in s2. Here's what I need to do. So there has to be a base validation which would validate variable x and variable y then every other class has its own validation for example Login class would validate if username and password exist but the prerequisite is that base validation should pass. How do I do that in struts2. Any input would be appreciated. Thanks. -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation chaining in struts2
On 8/30/07, j alex [EMAIL PROTECTED] wrote: Regarding field validations, can you provide any reason why the validwhen validator is not provided in Struts 2? . I think this is a step backwards from Struts 1 where we could easily manage conditional validation (validate fieldb only if fielda fieldc meet some condition) It's important to remember that Struts 2 is not a direct port of Struts 1. The codebases developed in parallel over a number of years. I expect it's simply that no one has written a validwhen validator for XWork yet. The Commons Validator didn't have one for a long time too. Also, the validators in Struts 1 returned true/false for success/failure, and we had the option of adding messages or not ; but in Struts 2 the only way to tell a validation failed is by the presence of errors on the field. Both of these limitations (if you will) make conditional validation (without error message for the condition itself) almost impossible. Hope i'm not missing anything here. Please let us know your thoughts I never used the Common Validator that way myself. People often make complex validations in the Action method and then let the framework handle the simple cases. Of course, there's much to be desired in either validation framework, which is why Jason has been trying to get a JSR going. * http://jcp.org/en/jsr/detail?id=303 Though, I'm not sure if much headway is being made. Personally, I'd like to see a fresh approach to validation that also included type conversion and text formatting as part of the workflow, and that did not throw away internally-created objects, just so that we can convert them a second time. I'd also like to see an API that we could implement in JavaScript, as well as Java and C#. (Or maybe a JavaScript API that we could use via Rhino or JScript.) Now see what happens when you ask for my thoughts! -Ted. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation chaining in struts2
Sounds very similar to the problem i had but no straightforward solution yet ; i've put this for enhancement on JIRA - https://issues.apache.org/struts/browse/WW-2113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41901 Can you please check if this is what you need as well? -Joseph On 8/29/07, Pavel Sapozhnikov [EMAIL PROTECTED] wrote: Hey guys. Could somebody provide some input on validation chaining in s2. Here's what I need to do. So there has to be a base validation which would validate variable x and variable y then every other class has its own validation for example Login class would validate if username and password exist but the prerequisite is that base validation should pass. How do I do that in struts2. Any input would be appreciated. Thanks. -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED]
Re: Validation chaining in struts2
Hey Joseph. I think thats something similar to what I am asking but I am not even quiet sure. I was also wondering what if I have a method in class and I have ClassName-methodName-validation.xml file which would validate those base things so then in struts.xml I can do type=redirect-actiontoThatMethod and when it redirects it will automatically do the validation from that xml. So would that serve my purpose? On 8/29/07, j alex [EMAIL PROTECTED] wrote: Sounds very similar to the problem i had but no straightforward solution yet ; i've put this for enhancement on JIRA - https://issues.apache.org/struts/browse/WW-2113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41901 Can you please check if this is what you need as well? -Joseph On 8/29/07, Pavel Sapozhnikov [EMAIL PROTECTED] wrote: Hey guys. Could somebody provide some input on validation chaining in s2. Here's what I need to do. So there has to be a base validation which would validate variable x and variable y then every other class has its own validation for example Login class would validate if username and password exist but the prerequisite is that base validation should pass. How do I do that in struts2. Any input would be appreciated. Thanks. -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED] -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED]
Re: Validation chaining in struts2
Hey Joseph sorry I think I need something exactly like this: https://issues.apache.org/struts/browse/STR-443 On 8/29/07, Pavel Sapozhnikov [EMAIL PROTECTED] wrote: Hey Joseph. I think thats something similar to what I am asking but I am not even quiet sure. I was also wondering what if I have a method in class and I have ClassName-methodName-validation.xml file which would validate those base things so then in struts.xml I can do type=redirect-actiontoThatMethod and when it redirects it will automatically do the validation from that xml. So would that serve my purpose? On 8/29/07, j alex [EMAIL PROTECTED] wrote: Sounds very similar to the problem i had but no straightforward solution yet ; i've put this for enhancement on JIRA - https://issues.apache.org/struts/browse/WW-2113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41901 Can you please check if this is what you need as well? -Joseph On 8/29/07, Pavel Sapozhnikov [EMAIL PROTECTED] wrote: Hey guys. Could somebody provide some input on validation chaining in s2. Here's what I need to do. So there has to be a base validation which would validate variable x and variable y then every other class has its own validation for example Login class would validate if username and password exist but the prerequisite is that base validation should pass. How do I do that in struts2. Any input would be appreciated. Thanks. -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED] -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED] -- Pavel Sapozhnikov xFact, Inc [EMAIL PROTECTED]
Re: validation issues
Sivaswamynatha K wrote: Hello friends, I am using struts 1.2.9. In my project, I have to navigate along the five jsp pages. For each page I have one next button which updates the data to the database. During that time I have to do only mask validation and not required validation. In the fifth page I have one save button. On clicking that I have to do required validation for all the previous pages and then update the database. How to do this? You need to have all the inputs available when the 5th page is submitted -- either by gathering them in a session scoped form as you work through the prior pages, or by including the inputs from prior pages as hidden fields in each subsequent page. Then you just write validation rules as normal for the final page, including the required rules. This workflow sounds a bit cumbersome, though; what if the user didn't enter a required field on page one? They don't find out they made a mistake until four pages later? Obviously I don't know your exact requirements, but that sounds kinda painful... ;-) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework... weird...
Balazs Michnay wrote: Dear Struts Users, I have a form with 13 form controls on it. I'd like to use the Struts Validation Framework to validate it, but it's acting weird. What I'd like to do is to have AT LEAST ONE of the controls filled, but the test of validWhen only allows simple boolean expressions. I used a simple approach of checking each control for their value being null but the test cannot containmore than one boolean operator. For instance, the following works just fine: var var-nametest/var-name var-value ((*this* != null) or (suly != null)) /var-value /var But if I insert another control test, I get an error message saying ValidWhen Error for field ' magassag' - line 1:37: expecting RPAREN, found 'or', so no more than two conditions are allowed in a test. Is that true? Is there any way to create complex tests? Or is there a way to validate the form for having at least one field filled? The grammar for validwhen expressions is rather limited; you can only have one operator per group. The solution is to add additional parentheses: var-value(((*this* != null) or (suly != null)) or ...)/var-value L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation dies because of request param array?
Do you have struts.devMode = true? I had the same problem and I was forced to change struts.devMode = false I believe this is a change from 2.0.6 ( and in some regards, a worse one at that ). I'm still investigating it, but please try turning devMode off and seeing if it helps. Scott Kingdon wrote: I am using Struts 2. I get this error whenever I turn on validation. The struts automatically returns the input page. 07:42:11,349 INFO [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'name' with value '[Ljava.lang.String;@188e507' There are several parameters that are being passed in to the action. It is only failing in this one. I have changed the name of the parameter. But the problem persists with that name. struts.xml action config includes this interceptor: interceptor-ref name=paramsPrepareParamsStack/ If I remove the validation xml the problem goes away. But then I have lost validation. If I remove 'name' from the validation in the xml the problem is still there. That is, even if there is no mention of the 'name' parameter in the validation xml, I still get the error. I have other Actions that are configured the exact same way and work just fine. I have tried rebuilding from scratch. No fix there. It looks like somehow there is are two 'name' parameters being sent in. So struts is handling it with an array. To ensure this is struts I have sent requests to the server by pasting the url in the browser with only one name paramater. I still get the error. I feel like I have done everything but the one thing that will work. g! Any ideas? -- View this message in context: http://www.nabble.com/Validation-dies-because-of-request-param-array--tf4018521.html#a11413408 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation dies because of request param array?
I should correct myself. My problem may not be related, since it was due to the CookieInterceptor's handling of setValue. Can you post your pojo and your query string? cilquirm wrote: Do you have struts.devMode = true? I had the same problem and I was forced to change struts.devMode = false I believe this is a change from 2.0.6 ( and in some regards, a worse one at that ). I'm still investigating it, but please try turning devMode off and seeing if it helps. Scott Kingdon wrote: I am using Struts 2. I get this error whenever I turn on validation. The struts automatically returns the input page. 07:42:11,349 INFO [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'name' with value '[Ljava.lang.String;@188e507' There are several parameters that are being passed in to the action. It is only failing in this one. I have changed the name of the parameter. But the problem persists with that name. struts.xml action config includes this interceptor: interceptor-ref name=paramsPrepareParamsStack/ If I remove the validation xml the problem goes away. But then I have lost validation. If I remove 'name' from the validation in the xml the problem is still there. That is, even if there is no mention of the 'name' parameter in the validation xml, I still get the error. I have other Actions that are configured the exact same way and work just fine. I have tried rebuilding from scratch. No fix there. It looks like somehow there is are two 'name' parameters being sent in. So struts is handling it with an array. To ensure this is struts I have sent requests to the server by pasting the url in the browser with only one name paramater. I still get the error. I feel like I have done everything but the one thing that will work. g! Any ideas? -- View this message in context: http://www.nabble.com/Validation-dies-because-of-request-param-array--tf4018521.html#a11413932 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation dies because of request param array?
By making that change the error has gone away. However it is now silently dying for some other reason. I need to track that down. If I have more problems I will post the code. On 7/3/07, cilquirm [EMAIL PROTECTED] wrote: I should correct myself. My problem may not be related, since it was due to the CookieInterceptor's handling of setValue. Can you post your pojo and your query string? cilquirm wrote: Do you have struts.devMode = true? I had the same problem and I was forced to change struts.devMode = false I believe this is a change from 2.0.6 ( and in some regards, a worse one at that ). I'm still investigating it, but please try turning devMode off and seeing if it helps. Scott Kingdon wrote: I am using Struts 2. I get this error whenever I turn on validation. The struts automatically returns the input page. 07:42:11,349 INFO [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'name' with value '[Ljava.lang.String;@188e507' There are several parameters that are being passed in to the action. It is only failing in this one. I have changed the name of the parameter. But the problem persists with that name. struts.xml action config includes this interceptor: interceptor-ref name=paramsPrepareParamsStack/ If I remove the validation xml the problem goes away. But then I have lost validation. If I remove 'name' from the validation in the xml the problem is still there. That is, even if there is no mention of the 'name' parameter in the validation xml, I still get the error. I have other Actions that are configured the exact same way and work just fine. I have tried rebuilding from scratch. No fix there. It looks like somehow there is are two 'name' parameters being sent in. So struts is handling it with an array. To ensure this is struts I have sent requests to the server by pasting the url in the browser with only one name paramater. I still get the error. I feel like I have done everything but the one thing that will work. g! Any ideas? -- View this message in context: http://www.nabble.com/Validation-dies-because-of-request-param-array--tf4018521.html#a11413932 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation dies because of request param array?
I am thinking that this did not solve the problem, but rather squelched the only message that gave me a clue as to what might be happening. So back to the original problem. Here is the struts config: action name=Profile class= com.ourcompany.struts.action.profile.Profile result name=input/WEB-INF/pages/profile/editProfile.jsp/result result name=error/WEB-INF/pages/error.jsp/result /action Here is the class: public class ProfileAddress extends Profile { private static final long serialVersionUID = 1L; private String street1; private String street2; private String city; private String state; private String zip; private String phone; private String securityQuestion; private String securityQuestionAnswer; private Integer addressIndex; public String doSave() throws Exception { log.info(save address!); return SUCCESS; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getSecurityQuestion() { return securityQuestion; } public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; } public String getSecurityQuestionAnswer() { return securityQuestionAnswer; } public void setSecurityQuestionAnswer(String securityQuestionAnswer) { this.securityQuestionAnswer = securityQuestionAnswer; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getStreet1() { return street1; } public void setStreet1(String street1) { this.street1 = street1; } public String getStreet2() { return street2; } public void setStreet2(String street2) { this.street2 = street2; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public Integer getAddressIndex() { return addressIndex; } public void setAddressIndex(Integer addressIndex) { this.addressIndex = addressIndex; } } As much as I like Struts 2, I am having a hard time debugging why some interceptors fail. There is no error message. Nothing. It just returns the input page. == On 7/3/07, Scott Kingdon [EMAIL PROTECTED] wrote: By making that change the error has gone away. However it is now silently dying for some other reason. I need to track that down. If I have more problems I will post the code. On 7/3/07, cilquirm [EMAIL PROTECTED] wrote: I should correct myself. My problem may not be related, since it was due to the CookieInterceptor's handling of setValue. Can you post your pojo and your query string? cilquirm wrote: Do you have struts.devMode = true? I had the same problem and I was forced to change struts.devMode = false I believe this is a change from 2.0.6 ( and in some regards, a worse one at that ). I'm still investigating it, but please try turning devMode off and seeing if it helps. Scott Kingdon wrote: I am using Struts 2. I get this error whenever I turn on validation. The struts automatically returns the input page. 07:42:11,349 INFO [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'name' with value '[Ljava.lang.String;@188e507' There are several parameters that are being passed in to the action. It is only failing in this one. I have changed the name of the parameter. But the problem persists with that name. struts.xml action config includes this interceptor: interceptor-ref name=paramsPrepareParamsStack/ If I remove the validation xml the problem goes away. But then I have lost validation. If I remove 'name' from the validation in the xml the problem is still there. That is, even if there is no mention of the 'name' parameter in the validation xml, I still get the error. I have other Actions that are configured the exact same way and work just fine. I have tried rebuilding from scratch. No fix there. It looks like somehow there is are two 'name' parameters being sent in. So struts is handling it with an array. To ensure this is struts I have sent requests to the server by pasting the url in the browser with only one name paramater. I still get the error. I feel like I have done everything but the one thing that will work. g! Any ideas? -- View this message in context: http://www.nabble.com/Validation-dies-because-of-request-param-array--tf4018521.html#a11413932 Sent from the Struts - User mailing list archive at
RE: Validation dies because of request param array?
Shouldn't your action class be set to com.ourcompany.struts.action.profile.ProfileAddress? Aside from that, can you share the editProfile.jsp file? - Patrick. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Kingdon Sent: Tuesday, July 03, 2007 3:15 PM To: Struts Users Mailing List Subject: Re: Validation dies because of request param array? I am thinking that this did not solve the problem, but rather squelched the only message that gave me a clue as to what might be happening. So back to the original problem. Here is the struts config: action name=Profile class= com.ourcompany.struts.action.profile.Profile result name=input/WEB-INF/pages/profile/editProfile.jsp/result result name=error/WEB-INF/pages/error.jsp/result /action Here is the class: public class ProfileAddress extends Profile { private static final long serialVersionUID = 1L; private String street1; private String street2; private String city; private String state; private String zip; private String phone; private String securityQuestion; private String securityQuestionAnswer; private Integer addressIndex; public String doSave() throws Exception { log.info(save address!); return SUCCESS; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getSecurityQuestion() { return securityQuestion; } public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; } public String getSecurityQuestionAnswer() { return securityQuestionAnswer; } public void setSecurityQuestionAnswer(String securityQuestionAnswer) { this.securityQuestionAnswer = securityQuestionAnswer; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getStreet1() { return street1; } public void setStreet1(String street1) { this.street1 = street1; } public String getStreet2() { return street2; } public void setStreet2(String street2) { this.street2 = street2; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public Integer getAddressIndex() { return addressIndex; } public void setAddressIndex(Integer addressIndex) { this.addressIndex = addressIndex; } } As much as I like Struts 2, I am having a hard time debugging why some interceptors fail. There is no error message. Nothing. It just returns the input page. == On 7/3/07, Scott Kingdon [EMAIL PROTECTED] wrote: By making that change the error has gone away. However it is now silently dying for some other reason. I need to track that down. If I have more problems I will post the code. On 7/3/07, cilquirm [EMAIL PROTECTED] wrote: I should correct myself. My problem may not be related, since it was due to the CookieInterceptor's handling of setValue. Can you post your pojo and your query string? cilquirm wrote: Do you have struts.devMode = true? I had the same problem and I was forced to change struts.devMode = false I believe this is a change from 2.0.6 ( and in some regards, a worse one at that ). I'm still investigating it, but please try turning devMode off and seeing if it helps. Scott Kingdon wrote: I am using Struts 2. I get this error whenever I turn on validation. The struts automatically returns the input page. 07:42:11,349 INFO [STDOUT] 07:42:11,349 ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]: Unexpected Exception catched: Error setting expression 'name' with value '[Ljava.lang.String;@188e507' There are several parameters that are being passed in to the action. It is only failing in this one. I have changed the name of the parameter. But the problem persists with that name. struts.xml action config includes this interceptor: interceptor-ref name=paramsPrepareParamsStack/ If I remove the validation xml the problem goes away. But then I have lost validation. If I remove 'name' from the validation in the xml the problem is still there. That is, even if there is no mention of the 'name' parameter in the validation xml, I still get the error. I have other Actions that are configured the exact same way and work just fine. I have tried rebuilding from scratch. No fix there. It looks like
Re: Validation dies because of request param array?
Ah. Yes. And it was. I have gone on and found a work around using dynamic methods, so it got changed. Dynamic methods is actually working. But the old version using ProfileAddress did not. Here is the form part of editProfile.jsp: s:iterator value=account.locations status=status div class=address div id=texts:property value=#status.index/ pspan class=uni-bolds:property value=name//span a href=javascript:showAddressForm('s:property value=#status.index/')edit/a/p ps:property value=street1//p ps:property value=street2//p ps:property value=city/, s:property value=state/ s:property value=zip //p ps:property value=phone//p /div div id=forms:property value=#status.index/ class=uni-hidden s:form action=SaveProfileAddress id=addressForm${status.index} cssClass=cssform theme=simple plabel for=nameName:/labels:textfield key=name//p plabel for=street1Street Line 1:/labels:textfield key=street1//p plabel for=street2Stree Line 2:/labels:textfield key=street2//p plabel for=street1City:/labels:textfield key=city//p plabel for=stateState:/labels:textfield key=state size=2//p plabel for=zipZip:/labels:textfield key=zip//p plabel for=phonePhone:/labels:textfield key=phone//p p input type=hidden name=addressIndex value=s:property value=#status.index/ / input type=button value=Save onclick=UserProfile.saveAddress(s:property value=#status.index/)/ input type=button value=Cancel onclick=hideAddressForm('s:property value=#status.index/')/ /p /s:form /div /div /s:iterator On 7/3/07, Crocker, Patrick [EMAIL PROTECTED] wrote: Shouldn't your action class be set to com.ourcompany.struts.action.profile.ProfileAddress? Aside from that, can you share the editProfile.jsp file? - Patrick. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Kingdon Sent: Tuesday, July 03, 2007 3:15 PM To: Struts Users Mailing List Subject: Re: Validation dies because of request param array? I am thinking that this did not solve the problem, but rather squelched the only message that gave me a clue as to what might be happening. So back to the original problem. Here is the struts config: action name=Profile class= com.ourcompany.struts.action.profile.Profile result name=input/WEB-INF/pages/profile/editProfile.jsp/result result name=error/WEB-INF/pages/error.jsp/result /action Here is the class: public class ProfileAddress extends Profile { private static final long serialVersionUID = 1L; private String street1; private String street2; private String city; private String state; private String zip; private String phone; private String securityQuestion; private String securityQuestionAnswer; private Integer addressIndex; public String doSave() throws Exception { log.info(save address!); return SUCCESS; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getSecurityQuestion() { return securityQuestion; } public void setSecurityQuestion(String securityQuestion) { this.securityQuestion = securityQuestion; } public String getSecurityQuestionAnswer() { return securityQuestionAnswer; } public void setSecurityQuestionAnswer(String securityQuestionAnswer) { this.securityQuestionAnswer = securityQuestionAnswer; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getStreet1() { return street1; } public void setStreet1(String street1) { this.street1 = street1; } public String getStreet2() { return street2; } public void setStreet2(String street2) { this.street2 = street2; } public String getZip
Re: Validation and XHTML
On 6/20/07, lextest [EMAIL PROTECTED] wrote: Hello, We have a client using Struts 1.2.9. They are experiencing a problem when trying to use client side validation on a struts page that is using html:xhtml. It's the exact problem described in this bug report: http://issues.apache.org/struts/browse/STR-2482 The above link leads me to believe this problem was fixed in 1.2.8. Any idea why we would still be experiencing the problem using 1.2.9? Saying your client is experiencing the same problem doesn't really tell us alot. If they are running Struts 1.2.9 then they should see different markup being rendered for the form (i.e. it should be rendered with an id attribute rather than name) - is that the case? If not it would suggest they are not running Struts 1.2.9. If they do see that then as well as the fixes to Struts - there were also related changes in Commons Validator - I believe in Validator 1.2.0 (but I would recommend the latest Validator 1.3.1 which is compatible with Struts 1.2.9) - so they also need to make sure they have upgraded to that version of validator. Niall Regards. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation and XHTML
Yes - They are seeing id instead of name in the generated form tag. You are correct about the commons jar. They had an old version of that. I just tested with 1.3.1 and it works fine. Thanks for your help and the speedy reply. Regards -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 20, 2007 9:13 AM To: Struts Users Mailing List Subject: Re: Validation and XHTML On 6/20/07, lextest [EMAIL PROTECTED] wrote: Hello, We have a client using Struts 1.2.9. They are experiencing a problem when trying to use client side validation on a struts page that is using html:xhtml. It's the exact problem described in this bug report: http://issues.apache.org/struts/browse/STR-2482 The above link leads me to believe this problem was fixed in 1.2.8. Any idea why we would still be experiencing the problem using 1.2.9? Saying your client is experiencing the same problem doesn't really tell us alot. If they are running Struts 1.2.9 then they should see different markup being rendered for the form (i.e. it should be rendered with an id attribute rather than name) - is that the case? If not it would suggest they are not running Struts 1.2.9. If they do see that then as well as the fixes to Struts - there were also related changes in Commons Validator - I believe in Validator 1.2.0 (but I would recommend the latest Validator 1.3.1 which is compatible with Struts 1.2.9) - so they also need to make sure they have upgraded to that version of validator. Niall Regards. - 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: Validation Random Failures
Actually no. I'm simply using Required validation on text boxes (simple string input). On 4/15/07, Adam Ruggles [EMAIL PROTECTED] wrote: I haven't tracked it down yet, but I think it is in the type converters. Are you using dates or decimal values on your forms? Zach Calvert wrote: Has anyone figured out why Validation randomly fails??? On 4/14/07, Adam Ruggles [EMAIL PROTECTED] wrote: I'm having a similar problem. I'm extending the ActionSupport object and I have no validation specified and I'm experiencing the same issue. I did enable validation and the results didn't change. The application was previously built on webwork2 where I didn't experience these issues at all. I don't know if it has been logged as a bug. Because it happens randomly I haven't been able to find out where it's dying. Zach Calvert wrote: I'm receiving random/spontaneous failures of validation on valid entries. I can use the browser back button, re-submit the same data, and sometimes get it accepted. I'm using simple Required strings: @Validations( requiredStrings = { @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = company, message = You must enter a value for company., shortCircuit = true, trim = true)} ) I'm curious if there is a bug logged that I haven't found, a patch, or a new jar I need to download. I'm using struts2-core-2.0.6.jar and freemarker-2.3.8.jar Anyone have any input? Thanks, Zach Calvert - 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: Validation Random Failures
I'm having a similar problem. I'm extending the ActionSupport object and I have no validation specified and I'm experiencing the same issue. I did enable validation and the results didn't change. The application was previously built on webwork2 where I didn't experience these issues at all. I don't know if it has been logged as a bug. Because it happens randomly I haven't been able to find out where it's dying. Zach Calvert wrote: I'm receiving random/spontaneous failures of validation on valid entries. I can use the browser back button, re-submit the same data, and sometimes get it accepted. I'm using simple Required strings: @Validations( requiredStrings = { @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = company, message = You must enter a value for company., shortCircuit = true, trim = true)} ) I'm curious if there is a bug logged that I haven't found, a patch, or a new jar I need to download. I'm using struts2-core-2.0.6.jar and freemarker-2.3.8.jar Anyone have any input? Thanks, Zach Calvert - 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: Validation Random Failures
Has anyone figured out why Validation randomly fails??? On 4/14/07, Adam Ruggles [EMAIL PROTECTED] wrote: I'm having a similar problem. I'm extending the ActionSupport object and I have no validation specified and I'm experiencing the same issue. I did enable validation and the results didn't change. The application was previously built on webwork2 where I didn't experience these issues at all. I don't know if it has been logged as a bug. Because it happens randomly I haven't been able to find out where it's dying. Zach Calvert wrote: I'm receiving random/spontaneous failures of validation on valid entries. I can use the browser back button, re-submit the same data, and sometimes get it accepted. I'm using simple Required strings: @Validations( requiredStrings = { @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = company, message = You must enter a value for company., shortCircuit = true, trim = true)} ) I'm curious if there is a bug logged that I haven't found, a patch, or a new jar I need to download. I'm using struts2-core-2.0.6.jar and freemarker-2.3.8.jar Anyone have any input? Thanks, Zach Calvert - 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: Validation Random Failures
I haven't tracked it down yet, but I think it is in the type converters. Are you using dates or decimal values on your forms? Zach Calvert wrote: Has anyone figured out why Validation randomly fails??? On 4/14/07, Adam Ruggles [EMAIL PROTECTED] wrote: I'm having a similar problem. I'm extending the ActionSupport object and I have no validation specified and I'm experiencing the same issue. I did enable validation and the results didn't change. The application was previously built on webwork2 where I didn't experience these issues at all. I don't know if it has been logged as a bug. Because it happens randomly I haven't been able to find out where it's dying. Zach Calvert wrote: I'm receiving random/spontaneous failures of validation on valid entries. I can use the browser back button, re-submit the same data, and sometimes get it accepted. I'm using simple Required strings: @Validations( requiredStrings = { @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = company, message = You must enter a value for company., shortCircuit = true, trim = true)} ) I'm curious if there is a bug logged that I haven't found, a patch, or a new jar I need to download. I'm using struts2-core-2.0.6.jar and freemarker-2.3.8.jar Anyone have any input? Thanks, Zach Calvert - 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: Validation Annotations
I have the same issue. atm I send everything to !input which is by default excluded from validation. But try looking at something like this in your struts.xml: interceptor-ref name=crudStack param name=validation.excludeMethodsedit,create/param /interceptor-ref I haven't tried it yet, not quite sure how it works. You can see here that by default, input, back and cancel are excluded from validation. (this comes from struts-default.xml): interceptor-ref name=validation param name=excludeMethodsinput,back,cancel/param /interceptor-ref André Faria-3 wrote: I have the following problem: The methods execute() and list() must not be validated by the save method rule... I have differentes validation rules for each method, but when I call the action, the interceptor tries to validate the input before call execute method. How can I resolve this? @Validation public class PersonAction { public void execute(); public void list(); @Validations(requiredFields = { @RequiredFieldValidator(fieldName = person.name, message = Fill the name field.) }) public void save(){} } André Faria escreveu: Is possible to use the validation annotations like @RequiredFieldValidator only for a method of the Action class? - 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] -- View this message in context: http://www.nabble.com/Validation-Annotations-tf2939610.html#a9900700 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation, ModelDriven and Field Errors
Hi dave here is all the data you ask I have a jsp where i register a customer, diferent kind of customer, personalcustomer, enterprisecustomer depending on the type of customer in the action variable customer the file i use to validate.. I have several validation files Personal-validation.xml, Enterprise-validation.xml Any suggestions ?? Regards, juan Fields in jsp s:textfield label=%{getText('customer.registration.bussines.addressNumber')} name=firstName/ s:textfield label=%{getText('customer.registration.bussines.addressApartment')} name=lastName/ --- Action class public class CustomerRegistration extends BaseAction implements ModelDriven { private static final long serialVersionUID = 1L; private static Logger logger = Logger.getLogger(CustomerRegistration.class); Customer customer = null; public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } --- Validation file one CustomerRegistration-customerRegistration-validation.xml validators field name=customer field-validator type=visitor message/message /field-validator /field /validators Validation file two Personal-validation.xml validators field name=firstName field-validator type=requiredstring message key=customer.registration.personal.validation.firstName/ /field-validator /field field name=lastName field-validator type=requiredstring message key=customer.registration.personal.validation.lastName/ /field-validator /field /validators -Mensaje original- De: Dave Newton [HYPERLINK mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Enviado el: miércoles, 28 de marzo de 2007 13:00 Para: Struts Users Mailing List Asunto: Re: Validation, ModelDriven and Field Errors --- Juan Espinosa [EMAIL PROTECTED] wrote: Then i change the action to an action that implements ModelDriven, when i do this changes the errors next to the controls doesnt appear any more. I must add in the jsp page the tag s:fielderror/ to get the errros. Anyone knows why the errors doesnt appear ?? How are you naming your form fields, both on the JSP and in the validation? Are you still using the modelClass.fieldName or just fieldName, and are they the same in both the JSP form fields and validation file? d. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. HYPERLINK http://farechase.yahoo.com/promo-generic-14795097 http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 27/03/2007 16:38 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 27/03/2007 16:38 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 27/03/2007 16:38 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.20/737 - Release Date: 28/03/2007 16:23
Re: Validation, ModelDriven and Field Errors
--- Juan Espinosa [EMAIL PROTECTED] wrote: Then i change the action to an action that implements ModelDriven, when i do this changes the errors next to the controls doesnt appear any more. I must add in the jsp page the tag s:fielderror/ to get the errros. Anyone knows why the errors doesnt appear ?? How are you naming your form fields, both on the JSP and in the validation? Are you still using the modelClass.fieldName or just fieldName, and are they the same in both the JSP form fields and validation file? d. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation, ModelDriven and Field Errors
Hi dave here is all the data you ask I have a jsp where i register a customer, diferent kind of customer, personalcustomer, enterprisecustomer depending on the type of customer in the action variable customer the file i use to validate.. I have several validation files Personal-validation.xml, Enterprise-validation.xml Any suggestions ?? Regards, juan Fields in jsp s:textfield label=%{getText('customer.registration.bussines.addressNumber')} name=firstName/ s:textfield label=%{getText('customer.registration.bussines.addressApartment')} name=lastName/ --- Action class public class CustomerRegistration extends BaseAction implements ModelDriven { private static final long serialVersionUID = 1L; private static Logger logger = Logger.getLogger(CustomerRegistration.class); Customer customer = null; public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } --- Validation file one CustomerRegistration-customerRegistration-validation.xml validators field name=customer field-validator type=visitor message/message /field-validator /field /validators Validation file two Personal-validation.xml validators field name=firstName field-validator type=requiredstring message key=customer.registration.personal.validation.firstName/ /field-validator /field field name=lastName field-validator type=requiredstring message key=customer.registration.personal.validation.lastName/ /field-validator /field /validators -Mensaje original- De: Dave Newton [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 28 de marzo de 2007 13:00 Para: Struts Users Mailing List Asunto: Re: Validation, ModelDriven and Field Errors --- Juan Espinosa [EMAIL PROTECTED] wrote: Then i change the action to an action that implements ModelDriven, when i do this changes the errors next to the controls doesnt appear any more. I must add in the jsp page the tag s:fielderror/ to get the errros. Anyone knows why the errors doesnt appear ?? How are you naming your form fields, both on the JSP and in the validation? Are you still using the modelClass.fieldName or just fieldName, and are they the same in both the JSP form fields and validation file? d. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 27/03/2007 16:38 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.20/736 - Release Date: 27/03/2007 16:38 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
Thanks guys, now it perfectly works. As a conclusion, most of the online articles on how to use the validation framework work just fine, but they all missed the validate=true attribute. Besides this, I had a wrong value of my action's input attribute. Thanks again, you are very helpful. Regards, Balazs - Original Message From: Dave Newton [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, March 13, 2007 6:21:52 PM Subject: Re: Validation Framework --- Christopher Schultz wrote: I didn't say that you need another URL that doesn't perform validation. Oh. I guess I don't know another way to show a form via an Action without running validation except by defining an Action. d. Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121
Re: Validation on java.util.List
Hi Dave, I came up with my own solution. Basically I wrote a method that I called manually (i.e. I didnt use expressionvalidator annotation).. in that method, i perform the check myself. If there was any error, I did addFieldError(customers[index], getText(some.text.from.properties.file )); then in the JSP, i have to put the fielderror in the right place. e.g.: c:forEach begin=0 end=10 var=i s:textfield key=customers[${i}].username / s:textfield key=customers[${i}].age / s:fielderrors s:paramcustomers[index]/s:param %--- cant remember the exact syntax.. its in their documentation --% /s:fielderrors /c:forEach I didnt use expressionvalidator annotation, since the attribute message is compulsory. I dont want to set message attribute, since I am creating the fielderror manually by hand (and I think the message will go to actionerrors instead of fielderrors). Anyway, I hope that helps you out. It is not the best solution.. so if you found a better way to do it, please let me know. On 3/14/07, Dave Newton [EMAIL PROTECTED] wrote: --- Alex Wibowo [EMAIL PROTECTED] wrote: I am using Struts 2.0. Has anyone ever done validation on individual item in java.util.List before? I'm drawing a blank on this one too after poking it with a stick for about an hour now... I have a similar requirement (but with fairly heavy inter-field dependencies) so if you come up with something, please follow up! d. No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, WiB ---
Re: Validation on java.util.List
--- Alex Wibowo [EMAIL PROTECTED] wrote: It is not the best solution.. so if you found a better way to do it, please let me know. I don't know if this is a better way or not and it does not use annotations (at least not yet), but... (1) Create a validation config file for the *object* (in my case, DummyUser-validation.xml; I'm just testing, and I'm a dummy :) - that's the object under validation, not the Action. (2) Annotate the Action's method as usual, but add a @VisitorFieldValidator on the list of collections, like so: @Validations ( // Other validators, then: visitorFields = { @VisitorFieldValidator( fieldName = users, message=, appendPrefix=true )}) This eliminates the need to manually insert the s:fielderror.../ element. So my Action has a ListDummyUser _users with appropriate getter/setter. The VisitorFieldValidator is validating on this object (the list) and by magic knows what validation file to use (I'm assuming via type; I currently have @Element specified but it's probably not required: @Element(value=DummyUser.class) @CreateIfNull(value=true) private ListDummyUser _users = new ArrayListDummyUser(); HTH, d. 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation on java.util.List
Just a quick followup regarding annotations: --- Dave Newton [EMAIL PROTECTED] wrote: I don't know if this is a better way or not and it does not use annotations (at least not yet), but... If you annotate the class contained in the collection the @VisitorFieldValidator still works. This won't work for me, because my class is being generated by HibernateTools (for now, anyway; I may switch to annotated POJOs) so I still need to use the XML validation config, but there you go. d. Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation on java.util.List
Hi Dave, Thanks for that.. I will have a look at the VisitorValidator tomorrow (its 1 AM here :P ) I am sort of in the same position as you (using Hibernate objects at the web layer)... I have given that a thought before (annotating the hibernate objects with validation annotation). But that will tie up the hibernate objects to Struts, wouldnt it? Might not be a problem if the user of the object is just the webapp.. Anyway...just to clarify what you have there..: 1. Annotate the object with struts validation annotation. In my example, something like: public class Customer{ @RequiredStringValidator(message = You must enter a value for username.) public String username; } 2. Annotate the Action class @Validation public class CustomerAction { public ListCustomer customer = new ArrayListCustomer(); @Validations ( visitorFields = { @VisitorFieldValidator(fieldName = customer , message=, appendPrefix=true) } ) public String execute(){ } } And hopefully if everything works right, the validation should work? Not sure if I can eliminate the s:fieldErrors/ ... since I'm using simple theme - my understanding is that with simple theme, I have to specifically write the actionErrors fieldErrors. Could be wrong though... (I'm new to Struts 2). Also... with your @Validations above.. if you specify message=, wouldnt that create an extra empty error message? I experienced that before. Thanks again, and I'll let you know how I go with this tomorrow. Cheers. WiB. On 3/14/07, Dave Newton [EMAIL PROTECTED] wrote: Just a quick followup regarding annotations: --- Dave Newton [EMAIL PROTECTED] wrote: I don't know if this is a better way or not and it does not use annotations (at least not yet), but... If you annotate the class contained in the collection the @VisitorFieldValidator still works. This won't work for me, because my class is being generated by HibernateTools (for now, anyway; I may switch to annotated POJOs) so I still need to use the XML validation config, but there you go. d. Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, WiB ---
Re: Validation on java.util.List
--- Alex Wibowo [EMAIL PROTECTED] wrote: But that will tie up the hibernate objects to Struts, wouldnt it? XWork, technically, but yes. The other issue (I think; haven't explored it yet) is that you'd lose the ability to validate differently based on the Action method (which I need). So I'm going to stick w/ the XML validation config, because the visitor thing lets me specify a validation context (like a method, I hope!) and currently my Hibernate objects are being created from the mapping XML files, so I can't do it via annotations anyway. And hopefully if everything works right, the validation should work? Yep. I'm not entirely sure I understand the appendPrefix attribute, since mine worked both with and without it :/ Not sure if I can eliminate the s:fieldErrors/ ... since I'm using simple theme - my understanding is that with simple theme, I have to specifically write the actionErrors fieldErrors. Could be wrong though... Nope, I believe you are correct. with your @Validations above.. if you specify message=, wouldnt that create an extra empty error message? I experienced that before. AFAICT a visitor's message is prepended to the validation message for the visited object; if you want just the msg defined in your POJO then I think you leave the visitor's message empty. d. Looking for earth-friendly autos? Browse Top Cars by Green Rating at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation on java.util.List
I don't know if this helps, but when I validate a list or array , i use OGNL's selection/projection facility : i.e. : customers.{ ? #this.age gt 0 and #this.username neq null }.size() eq customers.size creates a list of all customers whose age is greater than zero and who have a username and checks that it is the same as the incoming array ( i.e. everyone has a username and an age ) For the second part, in your Object's -conversion.xml file declare the type information of the element, like so : Element_customers = my.Customer more info here : http://struts.apache.org/2.x/docs/type-conversion.html Alex Wibowo wrote: Hi all... I am using Struts 2.0. Has anyone ever done validation on individual item in java.util.List before? Say, I have a property ListCustomer customers in my Action, and Customer is defined as: public class Customer{ private String username;// must not be empty private int age;// must be 0 } In the JSP I have the following: c:forEach begin=0 end=10 var=i s:textfield key=customers[${i}].username / s:textfield key=customers[${i}].age / /c:forEach How can I enforce using struts validation (preferrably through annotation) so that: - both username and age are compulsory - age must be an integer Secondly, since age is of type int.. when user enter characters (numbers) in the textfield, they get converted to 0 (somehow). How can I prevent this? Thanks in advance! -- Best regards, WiB --- -- View this message in context: http://www.nabble.com/Validation-on-java.util.List-tf3398904.html#a9478828 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
I'm still using struts 1.1 and your struts config/form is really different from what I used to do. But, in struts 1.1, we had to add validate=true in the struts-config on the action ... your struts-config doesn't have any. Maybe ... Mike Balazs Michnay a écrit : Dear Struts Users, I'm relatively new to Struts and am trying to get the Validation Framework working without success. I've read several tutorials and articles on using it, but it just doesn't want to work. I'm using NetBeans 5.5, so that I can use Struts 1.2.9. Having set everything, I get no error messages from the Sun Java Application Server 9, it just simply does not do any validation. It skips the validating my form and forwards me to the JSP page that should open only on successful validation. I don't attach the sources, because the zip file is too big, but I share it with you: http://www.inf.u-szeged.hu/~michnay/struts/SZTGKR.ZIP My form should only validate a textarea html control. Do I need to do any special settings in NetBeans or do I miss some settings? Since it's been about 4 days I'm trying to get it working I'd be grateful if someone would please take a look at my form and my validation settings. Thanks for your reply, Regards, michnay TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV. http://tv.yahoo.com/ -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
--- Balazs Michnay [EMAIL PROTECTED] wrote: I'm relatively new to Struts and am trying to get the Validation Framework working without success. You neither set validate='true' on your Action (in the struts-config action-mapping configuration element) nor call the form bean's 'validate' method (from, say, your Action). FWIW, it's usually sufficient to simply post the relevent portions of the config and source files rather than providing a ZIP file of your entire project. To answer your next question, you can either create an action-mapping with validate=false to forward to the form's JSP page or you can set validate=false and call validate manually from within your Action based on whether or not it's a GET or POST request (assuming you submit with a POST; personally I have this behavior in an Action base class and never use the automagic validation, but this has been discussed to death in the past :) d. Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
-- html:errors/ /html:form - Original Message From: Dave Newton [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, March 13, 2007 4:24:09 PM Subject: Re: Validation Framework --- Balazs Michnay [EMAIL PROTECTED] wrote: I'm relatively new to Struts and am trying to get the Validation Framework working without success. You neither set validate='true' on your Action (in the struts-config action-mapping configuration element) nor call the form bean's 'validate' method (from, say, your Action). FWIW, it's usually sufficient to simply post the relevent portions of the config and source files rather than providing a ZIP file of your entire project. To answer your next question, you can either create an action-mapping with validate=false to forward to the form's JSP page or you can set validate=false and call validate manually from within your Action based on whether or not it's a GET or POST request (assuming you submit with a POST; personally I have this behavior in an Action base class and never use the automagic validation, but this has been discussed to death in the past :) d. Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news
Re: Validation framework question
Hi. This is only a problem with javac and depending on wich java version you use. jdk5 should not have the problem. You may also try to use jikes for compiler. There may be or may be no code added for the validation. But this is not the problem ... Mike Chaudhary, Harsh a écrit : I am having an arguement with a co-worker here and here is how it goes. We have a JSP which has about 100 input fields. These fields have custom validators on them. When we try to run the JSP, it throws an exception something to the tune of Maximum try/catch size reached or something like that. He says that this is because of the validations and when we remove the validations, everything is fine. I say that the validation framework has absolutely nothing to do with the JSP's. It deals with the struts forms exclusively. So, the exception could not have been because of the validators. He says that when the JSP is compiled to a servlet, all the validation code is added to the compiled version of the JSP, something I do not agree with. Any inputs? Thanks, Harsh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation framework question
I know that the exception Maximum try/catch size reached has something to do with the compiler but what I would likt to know is that whether or not any validation code is added to the compiled JSP file itself. Harsh. -Original Message- From: Mike Baroukh [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:51 AM To: Struts Users Mailing List Subject: Re: Validation framework question Hi. This is only a problem with javac and depending on wich java version you use. jdk5 should not have the problem. You may also try to use jikes for compiler. There may be or may be no code added for the validation. But this is not the problem ... Mike Chaudhary, Harsh a écrit : I am having an arguement with a co-worker here and here is how it goes. We have a JSP which has about 100 input fields. These fields have custom validators on them. When we try to run the JSP, it throws an exception something to the tune of Maximum try/catch size reached or something like that. He says that this is because of the validations and when we remove the validations, everything is fine. I say that the validation framework has absolutely nothing to do with the JSP's. It deals with the struts forms exclusively. So, the exception could not have been because of the validators. He says that when the JSP is compiled to a servlet, all the validation code is added to the compiled version of the JSP, something I do not agree with. Any inputs? Thanks, Harsh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
then, you may try to look at the compiled jsp ? Chaudhary, Harsh a écrit : I know that the exception Maximum try/catch size reached has something to do with the compiler but what I would likt to know is that whether or not any validation code is added to the compiled JSP file itself. Harsh. -Original Message- From: Mike Baroukh [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:51 AM To: Struts Users Mailing List Subject: Re: Validation framework question Hi. This is only a problem with javac and depending on wich java version you use. jdk5 should not have the problem. You may also try to use jikes for compiler. There may be or may be no code added for the validation. But this is not the problem ... Mike Chaudhary, Harsh a écrit : I am having an arguement with a co-worker here and here is how it goes. We have a JSP which has about 100 input fields. These fields have custom validators on them. When we try to run the JSP, it throws an exception something to the tune of Maximum try/catch size reached or something like that. He says that this is because of the validations and when we remove the validations, everything is fine. I say that the validation framework has absolutely nothing to do with the JSP's. It deals with the struts forms exclusively. So, the exception could not have been because of the validators. He says that when the JSP is compiled to a servlet, all the validation code is added to the compiled version of the JSP, something I do not agree with. Any inputs? Thanks, Harsh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
--- Mike Baroukh [EMAIL PROTECTED] wrote: jdk5 should not have the problem. Did 1.5+ remove the 64K limitation? There may be or may be no code added for the validation. But this is not the problem ... Technically, no, but it's the gating issue in this case. Try breaking up the JSP into dynamic includes (which will be easier to manage anyway, because 100 fields on a form is *way* too many, and must make editing/modifying a nightmare). d. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation framework question
I tried to do that but I could not find where my IDE stores those files. I am using WSAD 5.1.1 with WebSphere. Any suggestions would be appreciated. Harsh. -Original Message- From: Mike Baroukh [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:56 AM To: Struts Users Mailing List Subject: Re: Validation framework question then, you may try to look at the compiled jsp ? Chaudhary, Harsh a écrit : I know that the exception Maximum try/catch size reached has something to do with the compiler but what I would likt to know is that whether or not any validation code is added to the compiled JSP file itself. Harsh. -Original Message- From: Mike Baroukh [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:51 AM To: Struts Users Mailing List Subject: Re: Validation framework question Hi. This is only a problem with javac and depending on wich java version you use. jdk5 should not have the problem. You may also try to use jikes for compiler. There may be or may be no code added for the validation. But this is not the problem ... Mike Chaudhary, Harsh a écrit : I am having an arguement with a co-worker here and here is how it goes. We have a JSP which has about 100 input fields. These fields have custom validators on them. When we try to run the JSP, it throws an exception something to the tune of Maximum try/catch size reached or something like that. He says that this is because of the validations and when we remove the validations, everything is fine. I say that the validation framework has absolutely nothing to do with the JSP's. It deals with the struts forms exclusively. So, the exception could not have been because of the validators. He says that when the JSP is compiled to a servlet, all the validation code is added to the compiled version of the JSP, something I do not agree with. Any inputs? Thanks, Harsh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
Did 1.5+ remove the 64K limitation? I'm not absolutly sure, but think. I read this once and it's been a long time since I didn't saw this exception ... Mike Dave Newton a écrit : --- Mike Baroukh [EMAIL PROTECTED] wrote: jdk5 should not have the problem. Did 1.5+ remove the 64K limitation? There may be or may be no code added for the validation. But this is not the problem ... Technically, no, but it's the gating issue in this case. Try breaking up the JSP into dynamic includes (which will be easier to manage anyway, because 100 fields on a form is *way* too many, and must make editing/modifying a nightmare). d. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Balazs, Balazs Michnay wrote: Thanks a lot for your help! It really does work! What I missed was the validate=true attribute of the action tag, however, this was not mentioned by any of the articles I read. If it's not mentioned, you should point that out to the authors. I'm sure they would want to know about any oversights. The other thing is that now, the validation error message DID show up, but it is displayed on destination-page that should only show up when the validation was successful.What I want to do is to show the same for until valid values are not entered and when all the necessary fields are filled with valid values, forward the user to the destination-page. If validation actually fails, it should be redirecting the user to the page mentioned in the input attribute of the action currently being executed. If validation has passes, but some other error has occurred, perhaps you are handling that situation incorrectly in your code. Again, I'm missing some settings in my config files. You told me to use the validate() method but now it's completely removed because all the articles told me to remove it. Right. Under most circumstances, you should set validate=true in your action definition, and /not/ call form.validate() in your own action. You /are/ free to call validation by hand, but it's generally more convenient to allow Struts to handle the validate/fail/redirect logic for you -- if only to simplify the code in your own actions. action input=/LP/JSP_L01_1.jsp name=BEAN_L01 path=/L01FormAction scope=request type=com.myapp.struts.ACT_L01 validate=true set-property property=cancellable value=true/ forward name=cancel path=/index.jsp/ forward name=success path=/LP/JSP_L01_1.jsp/ /action I see the problem: input and success are set to the same page. Is that what you meant to do? I hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF9tly9CaO5/Lv0PARAm5yAJ9etlGCzbBFWnEK/oJCjZEcWhDZhACgvRXT W5VsZyEawBx79bfMgy4+qag= =V3DS -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
--- Christopher Schultz wrote: Right. Under most circumstances, you should set validate=true in your action definition, and /not/ call form.validate() in your own action. You /are/ free to call validation by hand, but it's generally more convenient to allow Struts to handle the validate/fail/redirect logic for you -- if only to simplify the code in your own actions. Bah. That still doesn't make any sense to me; my base class handles all of the work and I don't have to define another action with a different URL just to display a form without running validation. d. We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. http://tv.yahoo.com/collections/265 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave, Dave Newton wrote: --- Mike Baroukh [EMAIL PROTECTED] wrote: jdk5 should not have the problem. Did 1.5+ remove the 64K limitation? The 64k is a limit for method bodies, not try/catch. It should still be very much in force: http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#88659 I must admit that I've never heard of this try/catch too big problem before. Since the code and exceptions attributes of a method in a Java .class file have the same limitations (64k), and the compiler checks the try/catch limits before the code limits, then they really are the same thing. In either case, those limits are still in force (i.e. you cann't exceed 64k of code, try/catch or not). This is one of those irritating issues that breaks down the facade that JSP operates behind. JSP authors shouldn't have to worry about the limitations of Java when authoring their pages, but they do :( There may be or may be no code added for the validation. But this is not the problem ... Technically, no, but it's the gating issue in this case. Try breaking up the JSP into dynamic includes (which will be easier to manage anyway, because 100 fields on a form is *way* too many, and must make editing/modifying a nightmare). This might not help, depending in which type of include you use. Static includes, for example, will just import the code from the included JSP, solving nothing. Simplifying the page is definitely a good idea, though. If you use a lot of taglibs (such as emitting 100 form fields using Struts tags), you'll get a lot of generated code, causing you to run out of space. The validation is not the problem, though. If you removed validation entirely, you'd still get this error. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF9twQ9CaO5/Lv0PARAgX3AJ9CJTPbkAF7nQ5EJQ5bTjiGUPmtAACggJ+H OvylAQkRLgU70hRGJUzcpXo= =rObM -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
for Websphere, in a subdirectory of AppServer/temp/ you should find _*java or, at least _*class if it doesn't keep generated files. There is a checkbox to check on the console to keep generated files but I never remember where ... (I hate WebSphere !). If you use the integrated instance of WebSphere in WSAD, I think there is a subfolder in eclipse/.plugins that is used for this ... try again to search for _*class google with websphere keepgenerated returns a lot of results (or WSAD keepgenerated ...) Mike Chaudhary, Harsh a écrit : I tried to do that but I could not find where my IDE stores those files. I am using WSAD 5.1.1 with WebSphere. Any suggestions would be appreciated. Harsh. -Original Message- From: Mike Baroukh [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:56 AM To: Struts Users Mailing List Subject: Re: Validation framework question then, you may try to look at the compiled jsp ? Chaudhary, Harsh a écrit : I know that the exception Maximum try/catch size reached has something to do with the compiler but what I would likt to know is that whether or not any validation code is added to the compiled JSP file itself. Harsh. -Original Message- From: Mike Baroukh [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 11:51 AM To: Struts Users Mailing List Subject: Re: Validation framework question Hi. This is only a problem with javac and depending on wich java version you use. jdk5 should not have the problem. You may also try to use jikes for compiler. There may be or may be no code added for the validation. But this is not the problem ... Mike Chaudhary, Harsh a écrit : I am having an arguement with a co-worker here and here is how it goes. We have a JSP which has about 100 input fields. These fields have custom validators on them. When we try to run the JSP, it throws an exception something to the tune of Maximum try/catch size reached or something like that. He says that this is because of the validations and when we remove the validations, everything is fine. I say that the validation framework has absolutely nothing to do with the JSP's. It deals with the struts forms exclusively. So, the exception could not have been because of the validators. He says that when the JSP is compiled to a servlet, all the validation code is added to the compiled version of the JSP, something I do not agree with. Any inputs? Thanks, Harsh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
--- Christopher Schultz wrote: I wrote: Try breaking up the JSP into dynamic includes This might not help, depending in which type of include you use. Static includes, for example, [...] ... d. Looking for earth-friendly autos? Browse Top Cars by Green Rating at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave, Dave Newton wrote: --- Christopher Schultz wrote: Right. Under most circumstances, you should set validate=true in your action definition, and /not/ call form.validate() in your own action. You /are/ free to call validation by hand, but it's generally more convenient to allow Struts to handle the validate/fail/redirect logic for you -- if only to simplify the code in your own actions. Bah. That still doesn't make any sense to me; my base class handles all of the work and I don't have to define another action with a different URL just to display a form without running validation. I didn't say that you need another URL that doesn't perform validation. I'm just suggesting that calling form.validate( ) by hand doesn't buy you much (unless you are doing something complex). Since the OT is just starting out, I'm guessing his validations are relatively simple. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF9t0V9CaO5/Lv0PARAnDKAJ97njyUOTxekxwoEJAi7+OY7qLcnwCgno4C GYNRNQMEWRpZk4RLss0W7S0= =IlSV -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation framework question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave, Dave Newton wrote: --- Christopher Schultz wrote: I wrote: Try breaking up the JSP into dynamic includes This might not help, depending in which type of include you use. Static includes, for example, [...] ... Heh. Missed dynamic. Sorry 'bout that. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF9t3M9CaO5/Lv0PARAsrHAKCoeSdUyv4cH4wjTH7nmX16NPjXogCdEQ76 fc9Lms259ldMHMRCUPSpeWk= =ZHid -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework
--- Christopher Schultz wrote: I didn't say that you need another URL that doesn't perform validation. Oh. I guess I don't know another way to show a form via an Action without running validation except by defining an Action. d. Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation on java.util.List
--- Alex Wibowo [EMAIL PROTECTED] wrote: I am using Struts 2.0. Has anyone ever done validation on individual item in java.util.List before? I'm drawing a blank on this one too after poking it with a stick for about an hour now... I have a similar requirement (but with fairly heavy inter-field dependencies) so if you come up with something, please follow up! d. No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validation help
can someone help me with this please. thanks. From: fea jabi [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: validation help Date: Thu, 08 Feb 2007 10:01:01 -0500 Have 2 radio buttons of ID and Name and an input field to enter criteria. When the ID is selected the criteria the user entered should be numeric. Should display the user with the appropriate message that only int value is allowed. When the Name is selected the criteria the user entered should be alphanumeric. Should display appropriate message that only alphanumeric values are allowed. Tried the below it works great for the second option. Not sure how can I join the two conditions. formset form name=search field property=criteria depends=mask msg name=mask key=error.alphanumeric/ arg0 name=mask key=lbl.criteria / var var-namemask/var-name var-value${alpha_numeric}/var-value /var /field /form /formset You help is appreciated. Thanks. _ Laugh, share and connect with Windows Live Messenger http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=hmtagline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Turn searches into helpful donations. Make your search count. http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donationFORM=WLMTAG - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validation help
It appears you are probably using the ValidatorForm or ValidatorActionForm in 1.x? Just a thought ... could you just implement the validate method in the Action form and handle it with logic? I did some looking, and see that you can validate two fields against each other, but I couldn't find anywhere to do if/else logic in the validation.xml file. Possibly the Struts cookbook may have an example, but I don't have that book here. Maybe someone else on the list may have that. On 2/9/07, fea jabi [EMAIL PROTECTED] wrote: can someone help me with this please. thanks. From: fea jabi [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: validation help Date: Thu, 08 Feb 2007 10:01:01 -0500 Have 2 radio buttons of ID and Name and an input field to enter criteria. When the ID is selected the criteria the user entered should be numeric. Should display the user with the appropriate message that only int value is allowed. When the Name is selected the criteria the user entered should be alphanumeric. Should display appropriate message that only alphanumeric values are allowed. Tried the below it works great for the second option. Not sure how can I join the two conditions. formset form name=search field property=criteria depends=mask msg name=mask key=error.alphanumeric/ arg0 name=mask key=lbl.criteria / var var-namemask/var-name var-value${alpha_numeric}/var-value /var /field /form /formset You help is appreciated. Thanks. _ Laugh, share and connect with Windows Live Messenger http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=hmtagline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Turn searches into helpful donations. Make your search count. http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donationFORM=WLMTAG - 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: validation help
I don't think you can do this without either a custom validator or as Jim suggests, implementing it in the validate method of your form. Niall On 2/9/07, Jim Reynolds [EMAIL PROTECTED] wrote: It appears you are probably using the ValidatorForm or ValidatorActionForm in 1.x? Just a thought ... could you just implement the validate method in the Action form and handle it with logic? I did some looking, and see that you can validate two fields against each other, but I couldn't find anywhere to do if/else logic in the validation.xml file. Possibly the Struts cookbook may have an example, but I don't have that book here. Maybe someone else on the list may have that. On 2/9/07, fea jabi [EMAIL PROTECTED] wrote: can someone help me with this please. thanks. From: fea jabi [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: validation help Date: Thu, 08 Feb 2007 10:01:01 -0500 Have 2 radio buttons of ID and Name and an input field to enter criteria. When the ID is selected the criteria the user entered should be numeric. Should display the user with the appropriate message that only int value is allowed. When the Name is selected the criteria the user entered should be alphanumeric. Should display appropriate message that only alphanumeric values are allowed. Tried the below it works great for the second option. Not sure how can I join the two conditions. formset form name=search field property=criteria depends=mask msg name=mask key=error.alphanumeric/ arg0 name=mask key=lbl.criteria / var var-namemask/var-name var-value${alpha_numeric}/var-value /var /field /form /formset You help is appreciated. Thanks. _ Laugh, share and connect with Windows Live Messenger http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-ussource=hmtagline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Turn searches into helpful donations. Make your search count. http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donationFORM=WLMTAG - 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: Validation Message including Image
--- Struts2 Fan [EMAIL PROTECTED] wrote: I wonder if we can put the validation message whereever we want for each input field? http://cwiki.apache.org/WW/form-tags.html Search for labelPosition. If you need more control http://cwiki.apache.org/WW/themes-and-templates.html. d. 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Annotations
I have the following problem: The methods execute() and list() must not be validated by the save method rule... I have differentes validation rules for each method, but when I call the action, the interceptor tries to validate the input before call execute method. How can I resolve this? @Validation public class PersonAction { public void execute(); public void list(); @Validations(requiredFields = { @RequiredFieldValidator(fieldName = person.name, message = Fill the name field.) }) public void save(){} } André Faria escreveu: Is possible to use the validation annotations like @RequiredFieldValidator only for a method of the Action class? - 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: Validation Annotations
According to http://struts.apache.org/2.x/docs/validation-annotation.html you can specify annotations at the method level. André Faria-3 wrote: Hi People!!! Is there a way to use Validation Annotations only for a method or always for the action... Example, if I have a action PersonAction with three methods: public class PersonAction { public void execute(){} public void list(){} public void save(){} } But I have to validate the user input only in method save what could I do? Have a nice weekend, Thank's for help, André Faria - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Validation-Annotations-tf2930726.html#a819 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Annotations
Yes, but thats didnt works... If you specify the annotations on the method save for example... The validation roles will be apllyied for the others methods too. I am running Struts 2.0.3 with xWork 2.0.0 (06/01/2007)... Thank's André Faria cilquirm escreveu: According to http://struts.apache.org/2.x/docs/validation-annotation.html you can specify annotations at the method level. André Faria-3 wrote: Hi People!!! Is there a way to use Validation Annotations only for a method or always for the action... Example, if I have a action PersonAction with three methods: public class PersonAction { public void execute(){} public void list(){} public void save(){} } But I have to validate the user input only in method save what could I do? Have a nice weekend, Thank's for help, André Faria - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Atenciosamente, */André Faria/* /BlueSoft Consultoria em Informática/ /Fone: [55 11] 5543-5406/ /Web: www.bluesoft.com.br/ // - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Annotations
I haven't used this, but looking at the last example in the documentation it looks like there are two types of field-level annotation: property accessor annotations and action method annotations. I would guess that validations specified through property accessor annotations would always fire, whereas action method annotations would fire according to which method was actually called. Which type did you try using? L. André Faria wrote: Yes, but thats didnt works... If you specify the annotations on the method save for example... The validation roles will be apllyied for the others methods too. I am running Struts 2.0.3 with xWork 2.0.0 (06/01/2007)... Thank's André Faria cilquirm escreveu: According to http://struts.apache.org/2.x/docs/validation-annotation.html you can specify annotations at the method level. André Faria-3 wrote: Hi People!!! Is there a way to use Validation Annotations only for a method or always for the action... Example, if I have a action PersonAction with three methods: public class PersonAction { public void execute(){} public void list(){} public void save(){} } But I have to validate the user input only in method save what could I do? Have a nice weekend, Thank's for help, André Faria - 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: Validation Annotations
I tried to validate only the method save, so I puted the annotations on the top of the save method signature, but when I called execute method the validation erros appered. André Faria Laurie Harper escreveu: I haven't used this, but looking at the last example in the documentation it looks like there are two types of field-level annotation: property accessor annotations and action method annotations. I would guess that validations specified through property accessor annotations would always fire, whereas action method annotations would fire according to which method was actually called. Which type did you try using? L. André Faria wrote: Yes, but thats didnt works... If you specify the annotations on the method save for example... The validation roles will be apllyied for the others methods too. I am running Struts 2.0.3 with xWork 2.0.0 (06/01/2007)... Thank's André Faria cilquirm escreveu: According to http://struts.apache.org/2.x/docs/validation-annotation.html you can specify annotations at the method level. André Faria-3 wrote: Hi People!!! Is there a way to use Validation Annotations only for a method or always for the action... Example, if I have a action PersonAction with three methods: public class PersonAction { public void execute(){} public void list(){} public void save(){} } But I have to validate the user input only in method save what could I do? Have a nice weekend, Thank's for help, André Faria - 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: Validation Framework and DispatchAction
On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? I would suggest turning off the automatic validation, and calling it manually when needed. Here's an article about it (though the motivation here is different): http://www.learntechnology.net/validate-manually.do -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation Framework and DispatchAction
Thanks Wendy, Switching validation off in struts-config and invoking manually in each method where required will work. This can be done as follows: // validate ActionMessages errors = form.validate(mapping,request); if ( errors != null !errors.isEmpty() ) { saveErrors(request, errors); return mapping.getInputForward(); } This should solve my problem as each submitaction that requires validation validates the same set of data. However this will not work if there are three methods create and update both need to validate but each validate against a different set of parameters and the third submitaction does not validate. Regards Andy -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: 28 December 2006 16:46 To: Struts Users Mailing List Subject: Re: Validation Framework and DispatchAction On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? I would suggest turning off the automatic validation, and calling it manually when needed. Here's an article about it (though the motivation here is different): http://www.learntechnology.net/validate-manually.do -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -MY Original Message- Hi all, This is probably a common question but have struggled to find an answer so apologies if I have missed the obvious. Below is an example of issue: I have a page that uses a single form to hold all the display data but can perform the following multiple submit actions: Create - create as a new object Update - update the original The page calls /process_object.do which is represented by a DispatchAction that has a method for each submit action. This is simple to implement and is all working fine. I now turn to the validation framework I want to specify a rule to validate the name to 3 characters only when the submitaction is create and this is my problem. So the basic validation.xml entry is: form name=/process_object field property=name depends=minlength arg0 key=name.heading/ arg1 key=${var:minlength} name=minlength resource=false/ var var-nameminlength/var-name var-value3/var-value /var /field /form This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? Regards, Andy Foster - 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: Validation Framework and DispatchAction
Use a page field in your form (set this in your action class before you call form.validate()) and set page=x in your validation.xml file. The example below shows using a HTML hidden field page, which is a different way to set this page variable. http://struts.apache.org/1.x/struts-extras/dispatchValidator.html HTH, -ed On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: Thanks Wendy, Switching validation off in struts-config and invoking manually in each method where required will work. This can be done as follows: // validate ActionMessages errors = form.validate(mapping,request); if ( errors != null !errors.isEmpty() ) { saveErrors(request, errors); return mapping.getInputForward(); } This should solve my problem as each submitaction that requires validation validates the same set of data. However this will not work if there are three methods create and update both need to validate but each validate against a different set of parameters and the third submitaction does not validate. Regards Andy -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: 28 December 2006 16:46 To: Struts Users Mailing List Subject: Re: Validation Framework and DispatchAction On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? I would suggest turning off the automatic validation, and calling it manually when needed. Here's an article about it (though the motivation here is different): http://www.learntechnology.net/validate-manually.do -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -MY Original Message- Hi all, This is probably a common question but have struggled to find an answer so apologies if I have missed the obvious. Below is an example of issue: I have a page that uses a single form to hold all the display data but can perform the following multiple submit actions: Create - create as a new object Update - update the original The page calls /process_object.do which is represented by a DispatchAction that has a method for each submit action. This is simple to implement and is all working fine. I now turn to the validation framework I want to specify a rule to validate the name to 3 characters only when the submitaction is create and this is my problem. So the basic validation.xml entry is: form name=/process_object field property=name depends=minlength arg0 key=name.heading/ arg1 key=${var:minlength} name=minlength resource=false/ var var-nameminlength/var-name var-value3/var-value /var /field /form This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? Regards, Andy Foster - 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: Validation Framework and DispatchAction
On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: This should solve my problem as each submitaction that requires validation validates the same set of data. However this will not work if there are three methods create and update both need to validate but each validate against a different set of parameters and the third submitaction does not validate. To validate against a different set of parameters for each dispatched method, consider how ValidatorForm and ValidatorActionForm work. ValidatorForm keys off of the form name, while ValidatorActionForm keys off the path. You appear to already be using ValidatorActionForm, because you have form name=/process_object instead of form name=formBeanName If you want to invent a new way to map requests to validation rule sets, I think all you need to do is subclass ValidatorForm and override getValidationKey(). Try having it return the value of the parameter you're using for method dispatching, then use that for the form name=... in validation.xml. Seems reasonable anyway... I haven't played with this in a while. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation rule writing
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thom, Thom Burnett wrote: I'm trying to validate two fields - area code and phone number (as nnn- no areacode in that input). [snip] constant-namephoneFormatMask/constant-name constant-value^[0-9]{3}-[0-9]{4}$/constant-value This regexp looks good. Have you checked the docs for the regexp engine used by the validator (is it Jakarta-ORO?) to make sure that the syntax you are using is correct? You may have to use [0-9][0-9][0-9] instead of [0-9]{3}, for instance. var var-namephoneMask/var-name var-value${phoneFormatMask}/var-value /var Have you tried putting the mask directly into the var-value element? This would help you verify that your mask is working, even if your configuration isn't 100% correct (i.e. the use of the 'constant' fields might not be working). Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFgtQE9CaO5/Lv0PARAu/yAKCMR7YwcuX+BBQ+/D7DX/e04dS+0QCeLlSz 9/TG4qqBX7xgXJW8YKPKX68= =L1kC -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation rule writing
What Chris said, plus this: field property=areaCode depends=required, areaCodeMask ... there's no validation rule named 'areaCodeMask' or 'phoneMask'; you want just 'mask' as the rule name. See the validator documentation for examples. Also, is validation working at all for you? For example, is it correctly detecting errors for the properties you have marked with just the 'required' rule? If not, start by figuring that out, then worry about getting your masks applied correctly. L. Thom Burnett wrote: I'm trying to validate two fields - area code and phone number (as nnn- no areacode in that input). Various samples and reading suggest that I should be able to create a mask and apply it as below but my result is that the area code can't be empty but it can contain letters, be longer than 3. It's ignoring my regular expression mask. Am I missing something simple in how to setup and use the validations.xml or am I going about this in the wrong way? ?xml version='1.0' encoding='windows-1252'? form-validation global constant constant-namephoneFormatMask/constant-name constant-value^[0-9]{3}-[0-9]{4}$/constant-value /constant constant constant-nameareaCodeFormatMask/constant-name constant-value^[0-9]{3}$/constant-value /constant /global formset !-- Start of validation rules for each bean -- form name=contactBean field property=firstName depends=required page=1 arg0 key=validation.error.firstname/ /field field property=lastName depends=required page=1 arg0 key=validation.error.last/ /field field property=email depends=required, email page=1 arg0 key=validation.error.email/ /field field property=areaCode depends=required, areaCodeMask page=1 arg0 key=validation.error.areaCode/ msg name=areaCodeMask key=validation.error.areaCode.format/ var var-nameareaCodeMask/var-name var-value${areaCodeFormatMask}/var-value /var /field field property=phoneNumber depends=required, phoneMask page=1 arg0 key=validation.error.phone/ var var-namephoneMask/var-name var-value${phoneFormatMask}/var-value /var /field /form /formset /form-validation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validation
i guess changing the theme of the form/field would do the trick. Also u can go for your own template that over-rides the default ones given for rendering the error messages on your form. u can try theme=html on the field n form tags... - Original Message - From: Chris Pratt [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, December 11, 2006 1:58 AM Subject: Re: validation I assume the different validators set the property argument of ActionErrors.add() differently. Apparently the field validator sets it to the field name (which allows it to be shown next to the field it's associated with), where as the visitor validator us probably setting it to GLOBAL_MESSAGE which gets shown at the top of the page. (*Chris*) On 12/5/06, Juan Espinosa [EMAIL PROTECTED] wrote: Hi i have a question about validators (struts2), i was using fileld validator, and when i have an error (filling some filed) the error appears on top of the input box, now i change to visitor validator and the erros all appear in the top of the page. Anyone knows why is happening this, only changing the type of validator changes the rendering of the erros ??? Thanks to all Regards, Juan -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.430 / Virus Database: 268.15.7/569 - Release Date: 05/12/2006 03:00 a.m. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: VALIDATION
The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - 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: VALIDATION
Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - 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: VALIDATION
Sorry, I assumed you were using S1, I don't know how for s2. On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - 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: VALIDATION
I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
In struts 2 if i have validation enabled an i call an action Customer!registerCustomer.action, te validation get executed, and if its fails what results uses, and if the validation passwhat it does...execute the action called maybe... -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 11:10 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION Sorry, I assumed you were using S1, I don't know how for s2. On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - 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: VALIDATION
From: Juan Espinosa [mailto:[EMAIL PROTECTED] Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? Struts2 is rather different, but you can still do your validation in your actions if you really want to (or do additional business-logic oriented validation). Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
I want to use the validation framework, but i cant it get work well Now i have the actions to register a user, i want that before registering get validated...but i cant... -Mensaje original- De: Dave Newton [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 11:49 a.m. Para: Struts Users Mailing List Asunto: RE: VALIDATION From: Juan Espinosa [mailto:[EMAIL PROTECTED] Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? Struts2 is rather different, but you can still do your validation in your actions if you really want to (or do additional business-logic oriented validation). Dave - 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: Validation XMl entity
MASTEK Making a valuable difference Mastek in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers. ~~ ---BeginMessage--- I want to know can I use the same set of validation by using Entity and referencing it from an external file. Like I have two fields in my application which is in most of the forms . Can I define the validation in an external file and reference it using xml entity.. -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:24 PM To: Struts Users Mailing List Subject: Re: Validation XMl entity -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Vishal, Vishal Seth wrote: Hi, Does struts validation support XML entity. What do you mean? Can explain this question in more detail? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFZwej9CaO5/Lv0PARAs+RAKC7PFSI6AC23BMdFQKSNWoe6OhYnACfchpJ NSN78a9Lbt7EXBSRwNff34I= =LxyL -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---End Message--- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation XMl entity
On 11/27/06, Vishal Seth [EMAIL PROTECTED] wrote: I want to know can I use the same set of validation by using Entity and referencing it from an external file. Like I have two fields in my application which is in most of the forms . Can I define the validation in an external file and reference it using xml entity.. Theres a test case that does this in the Commons Validator tests - see http://tinyurl.com/ttbpa: - EntityImportTest.java - EntityImportTest-config.xml - EntityImportTest-byteform.xml Niall -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:24 PM To: Struts Users Mailing List Subject: Re: Validation XMl entity Vishal, Vishal Seth wrote: Hi, Does struts validation support XML entity. What do you mean? Can explain this question in more detail? - -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation XMl entity
Hi, But does struts support when integrated with commons-validator? -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Monday, November 27, 2006 12:00 PM To: Struts Users Mailing List Subject: Re: Validation XMl entity On 11/27/06, Vishal Seth [EMAIL PROTECTED] wrote: I want to know can I use the same set of validation by using Entity and referencing it from an external file. Like I have two fields in my application which is in most of the forms . Can I define the validation in an external file and reference it using xml entity.. Theres a test case that does this in the Commons Validator tests - see http://tinyurl.com/ttbpa: - EntityImportTest.java - EntityImportTest-config.xml - EntityImportTest-byteform.xml Niall -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:24 PM To: Struts Users Mailing List Subject: Re: Validation XMl entity Vishal, Vishal Seth wrote: Hi, Does struts validation support XML entity. What do you mean? Can explain this question in more detail? - -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] MASTEK Making a valuable difference Mastek in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers. ~~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation XMl entity
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Vishal, Vishal Seth wrote: Hi, Does struts validation support XML entity. What do you mean? Can explain this question in more detail? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFZwej9CaO5/Lv0PARAs+RAKC7PFSI6AC23BMdFQKSNWoe6OhYnACfchpJ NSN78a9Lbt7EXBSRwNff34I= =LxyL -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation XMl entity
Struts validation is generally used only for validations of fields from HTTP submissions, check out http://struts.apache.org/1.x/faqs/validator.html If you need to validate an XML file, you may be able to use the Apache Digester classes (http://jakarta.apache.org/commons/digester/) or some of the J2SE java XML libraries. -ed On 11/24/06, Vishal Seth [EMAIL PROTECTED] wrote: Hi, Does struts validation support XML entity. Thanks Vishal MASTEK Making a valuable difference Mastek in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers. ~~ - 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: Validation + multiple Submit buttons
This works perfectly, a simple action to check which submit button is clicked forwards the three pages without validation to appropriate location. Actual Save button calls a commit action where validation is required. Thanks for the help Andrew -Oorspronkelijk bericht- Van: Christopher Schultz [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 15:37 Aan: Struts Users Mailing List Onderwerp: Re: Validation + multiple Submit buttons -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew, Andrew Martin wrote: That would be one solution, but in my case I have 4 submit buttons, two of which redirect the user to another action (keeping scope set to session) and then back to the original form. Hmm... that makes things more interesting. How about this: You create a new action called figureItOutAction or something like that, and POST your form to that action. This action has no form bean, no validation, no nuthin'. In that action, you look for the names of the buttons that you want to use, say: SAVE, BACK, CANCEL, and FOURTH_BUTTON (or whatever). Then, you dispatch based upon the button that was pressed: in struts-config.xml: forward name=save path=/save.do / forward name=back path=/back.do / . . . Remember to definitely NOT set redirect=true, since we need the reques to stay in tact. Your code for FigureItOutAction will look like this: if(null != request.getParameter(save)) return mapping.findForward(save); else if(null != request.getParameter(back)) return mapping.findForward(back); . . . Then, just point each of these dispatching actions to the ones that really do the work. Each of these may have validation, form beans, etc. For instance, your save action (or next... whatever) will have a form bean and validate=true in struts-config.xml. This trick allows you to submit your form to an action which decides what to do independently of validation. Forwarding on to another action that /does/ validate will then give you the magic of validation. I haven't tried this before, but it should work. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWdRw9CaO5/Lv0PARAra+AJ9zZ4ejuncDFJXlQHicNXykEh9EWACgqTBJ GTAT1awgUG4RugUt/9jQNmw= =jcpP -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation + multiple Submit buttons
That would be one solution, but in my case I have 4 submit buttons, two of which redirect the user to another action (keeping scope set to session) and then back to the original form. I do not want the validation to be carried out either of these two buttons but only on the SAVE submit button. (if that make sense!) -Oorspronkelijk bericht- Van: Christopher Schultz [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 14:48 Aan: Struts Users Mailing List Onderwerp: Re: Validation + multiple Submit buttons -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew, Andrew Martin wrote: I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. What you want to do is to set your back button to be a cancel button. This is done differently depending on which content-builder you are using (JSP, Velocity, or whatever), but basically you have to end up naming the button org.apache.struts.taglib.html.CANCEL, which indicates to struts that validation should be skipped. (Note that struts 1.2.7 (?) and higher require you to set a property for each action mapping that indicates that the action is cancellable). Note that, even though the validation is skipped, the form bean being used for validation is *still* filled with this non-validated data. If you are using a multi-page form bean, this is ideal: the user goes BACK, changes something on the previous page, and then when they come forward, again, you can redisplay the information they already entered into the form. Once they submit *that*, you perform the validation and move on. Of course, if you want BACK, NEXT, and CANCEL buttons on the page, then you can't really use this solution. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWckq9CaO5/Lv0PARAjU2AJsHj3tDfnajq4v6FlOm+IW3hXabkwCfUXXm HOv3KWS1mMon6Bbn32qnbCo= =iLZY -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation + multiple Submit buttons
That is actually not too far off what I have at the moment, except I currently use to saveAction for all the submit values I will give it a go. Thanks. -Oorspronkelijk bericht- Van: Christopher Schultz [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 15:37 Aan: Struts Users Mailing List Onderwerp: Re: Validation + multiple Submit buttons -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew, Andrew Martin wrote: That would be one solution, but in my case I have 4 submit buttons, two of which redirect the user to another action (keeping scope set to session) and then back to the original form. Hmm... that makes things more interesting. How about this: You create a new action called figureItOutAction or something like that, and POST your form to that action. This action has no form bean, no validation, no nuthin'. In that action, you look for the names of the buttons that you want to use, say: SAVE, BACK, CANCEL, and FOURTH_BUTTON (or whatever). Then, you dispatch based upon the button that was pressed: in struts-config.xml: forward name=save path=/save.do / forward name=back path=/back.do / . . . Remember to definitely NOT set redirect=true, since we need the reques to stay in tact. Your code for FigureItOutAction will look like this: if(null != request.getParameter(save)) return mapping.findForward(save); else if(null != request.getParameter(back)) return mapping.findForward(back); . . . Then, just point each of these dispatching actions to the ones that really do the work. Each of these may have validation, form beans, etc. For instance, your save action (or next... whatever) will have a form bean and validate=true in struts-config.xml. This trick allows you to submit your form to an action which decides what to do independently of validation. Forwarding on to another action that /does/ validate will then give you the magic of validation. I haven't tried this before, but it should work. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWdRw9CaO5/Lv0PARAra+AJ9zZ4ejuncDFJXlQHicNXykEh9EWACgqTBJ GTAT1awgUG4RugUt/9jQNmw= =jcpP -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation + multiple Submit buttons
A JS free application? You can assume today's browsers have javascript, the web would break otherwise. Sure there are some cross platform issues but to go JS free is a tall order and will limit you to a clunky UI. If JS free is your direction, you could wrap your back button in a html:form that posts to a different action to your save. Lance. -Original Message- From: Andrew Martin [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 13:36 To: Struts Users Mailing List Subject: Validation + multiple Submit buttons Hi, I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. As both buttons call the same action the validation is called on both, but I do not want validation to occur on certain submit actions (namely the Back button) Ideally I would like to configure this in the XML Struts-config.xml or validation.xml but I am not sure if this is actually possible (I fear the worst) If anyone has any tips, much appreciated. Andrew - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation + multiple Submit buttons
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew, Andrew Martin wrote: I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. What you want to do is to set your back button to be a cancel button. This is done differently depending on which content-builder you are using (JSP, Velocity, or whatever), but basically you have to end up naming the button org.apache.struts.taglib.html.CANCEL, which indicates to struts that validation should be skipped. (Note that struts 1.2.7 (?) and higher require you to set a property for each action mapping that indicates that the action is cancellable). Note that, even though the validation is skipped, the form bean being used for validation is *still* filled with this non-validated data. If you are using a multi-page form bean, this is ideal: the user goes BACK, changes something on the previous page, and then when they come forward, again, you can redisplay the information they already entered into the form. Once they submit *that*, you perform the validation and move on. Of course, if you want BACK, NEXT, and CANCEL buttons on the page, then you can't really use this solution. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWckq9CaO5/Lv0PARAjU2AJsHj3tDfnajq4v6FlOm+IW3hXabkwCfUXXm HOv3KWS1mMon6Bbn32qnbCo= =iLZY -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation + multiple Submit buttons
JS Free, clunky UI you don't have to tell us! But those are the restrictions we are working on. It basically means additional actions/forms/JSP's when we want to do anything of consequence. Usability is a big issue, but we can't do anyting about it. I don't think wrapping (nested) forms will actually work. certain form buttons are located in the middle of the 'main' form as they cater for a select option to another page. -Oorspronkelijk bericht- Van: Lance Semmens [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 14:54 Aan: 'Struts Users Mailing List' Onderwerp: RE: Validation + multiple Submit buttons A JS free application? You can assume today's browsers have javascript, the web would break otherwise. Sure there are some cross platform issues but to go JS free is a tall order and will limit you to a clunky UI. If JS free is your direction, you could wrap your back button in a html:form that posts to a different action to your save. Lance. -Original Message- From: Andrew Martin [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 13:36 To: Struts Users Mailing List Subject: Validation + multiple Submit buttons Hi, I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. As both buttons call the same action the validation is called on both, but I do not want validation to occur on certain submit actions (namely the Back button) Ideally I would like to configure this in the XML Struts-config.xml or validation.xml but I am not sure if this is actually possible (I fear the worst) If anyone has any tips, much appreciated. Andrew - 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: Validation + multiple Submit buttons
You could turn off automatic validation in struts-config.xml and call it manually in the action method when you need validation. If you are using a recent version of Struts you can use LookupDispatchAction that will call a given method based on which button was pressed. http://struts.apache.org/1.2.7/api/org/apache/struts/actions/LookupDispatchAction.html HTH, -ed On 11/14/06, Andrew Martin [EMAIL PROTECTED] wrote: JS Free, clunky UI you don't have to tell us! But those are the restrictions we are working on. It basically means additional actions/forms/JSP's when we want to do anything of consequence. Usability is a big issue, but we can't do anyting about it. I don't think wrapping (nested) forms will actually work. certain form buttons are located in the middle of the 'main' form as they cater for a select option to another page. -Oorspronkelijk bericht- Van: Lance Semmens [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 14:54 Aan: 'Struts Users Mailing List' Onderwerp: RE: Validation + multiple Submit buttons A JS free application? You can assume today's browsers have javascript, the web would break otherwise. Sure there are some cross platform issues but to go JS free is a tall order and will limit you to a clunky UI. If JS free is your direction, you could wrap your back button in a html:form that posts to a different action to your save. Lance. -Original Message- From: Andrew Martin [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 13:36 To: Struts Users Mailing List Subject: Validation + multiple Submit buttons Hi, I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. As both buttons call the same action the validation is called on both, but I do not want validation to occur on certain submit actions (namely the Back button) Ideally I would like to configure this in the XML Struts-config.xml or validation.xml but I am not sure if this is actually possible (I fear the worst) If anyone has any tips, much appreciated. Andrew - 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: Validation + multiple Submit buttons
Use a Cancel button http://struts.apache.org/1.x/struts-taglib/tlddoc/html/cancel.html from javadoc Renders an HTML input element of type submit. This tag is only valid when nested inside a form tag body. Pressing of this submit button causes the action servlet to bypass calling the associated form bean validate() method. The action is called normally. see also http://wiki.apache.org/struts/StrutsUpgradeNotes128to129 mas Andrew Martin wrote: Hi, I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. As both buttons call the same action the validation is called on both, but I do not want validation to occur on certain submit actions (namely the Back button) Ideally I would like to configure this in the XML Struts-config.xml or validation.xml but I am not sure if this is actually possible (I fear the worst) If anyone has any tips, much appreciated. Andrew -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation + multiple Submit buttons
Thats what I thought myself, although it would be nice to be able to configure this independently within the xml configuration. Maybe a stupid question but is it possible to call the specifc XML configuration from within the action? -Oorspronkelijk bericht- Van: Ed Griebel [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 15:20 Aan: Struts Users Mailing List Onderwerp: Re: Validation + multiple Submit buttons You could turn off automatic validation in struts-config.xml and call it manually in the action method when you need validation. If you are using a recent version of Struts you can use LookupDispatchAction that will call a given method based on which button was pressed. http://struts.apache.org/1.2.7/api/org/apache/struts/actions/LookupDispatchAction.html HTH, -ed On 11/14/06, Andrew Martin [EMAIL PROTECTED] wrote: JS Free, clunky UI you don't have to tell us! But those are the restrictions we are working on. It basically means additional actions/forms/JSP's when we want to do anything of consequence. Usability is a big issue, but we can't do anyting about it. I don't think wrapping (nested) forms will actually work. certain form buttons are located in the middle of the 'main' form as they cater for a select option to another page. -Oorspronkelijk bericht- Van: Lance Semmens [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 14:54 Aan: 'Struts Users Mailing List' Onderwerp: RE: Validation + multiple Submit buttons A JS free application? You can assume today's browsers have javascript, the web would break otherwise. Sure there are some cross platform issues but to go JS free is a tall order and will limit you to a clunky UI. If JS free is your direction, you could wrap your back button in a html:form that posts to a different action to your save. Lance. -Original Message- From: Andrew Martin [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 13:36 To: Struts Users Mailing List Subject: Validation + multiple Submit buttons Hi, I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. As both buttons call the same action the validation is called on both, but I do not want validation to occur on certain submit actions (namely the Back button) Ideally I would like to configure this in the XML Struts-config.xml or validation.xml but I am not sure if this is actually possible (I fear the worst) If anyone has any tips, much appreciated. Andrew - 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: Validation + multiple Submit buttons
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lance, Lance Semmens wrote: A JS free application? You can assume today's browsers have javascript, the web would break otherwise. Sure there are some cross platform issues but to go JS free is a tall order and will limit you to a clunky UI. I disagree. I think that JS is nice to use in order to improve the user experience, but relying on it to work is a recipe for disaster. Even if JS is available and enabled in the browser, sometimes things just don't work properly (new patch to the JS library or whatever) and your site stops cold. I recommend using JS as an improvement, not as a requirement. Just my perspective. If JS free is your direction, you could wrap your back button in a html:form that posts to a different action to your save. That's not going to work, as the form can't have two targets. If you wrap the button in another form, you'll have to use JS to copy the values from one form to another. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWdNU9CaO5/Lv0PARAjY1AKCCGsILCwM8mPxNOuJ21x8NjtWecgCfecxC 93wu48nVTO6ZaXUfx0tPzZM= =9WpP -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation + multiple Submit buttons
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew, Andrew Martin wrote: That would be one solution, but in my case I have 4 submit buttons, two of which redirect the user to another action (keeping scope set to session) and then back to the original form. Hmm... that makes things more interesting. How about this: You create a new action called figureItOutAction or something like that, and POST your form to that action. This action has no form bean, no validation, no nuthin'. In that action, you look for the names of the buttons that you want to use, say: SAVE, BACK, CANCEL, and FOURTH_BUTTON (or whatever). Then, you dispatch based upon the button that was pressed: in struts-config.xml: forward name=save path=/save.do / forward name=back path=/back.do / . . . Remember to definitely NOT set redirect=true, since we need the reques to stay in tact. Your code for FigureItOutAction will look like this: if(null != request.getParameter(save)) return mapping.findForward(save); else if(null != request.getParameter(back)) return mapping.findForward(back); . . . Then, just point each of these dispatching actions to the ones that really do the work. Each of these may have validation, form beans, etc. For instance, your save action (or next... whatever) will have a form bean and validate=true in struts-config.xml. This trick allows you to submit your form to an action which decides what to do independently of validation. Forwarding on to another action that /does/ validate will then give you the magic of validation. I haven't tried this before, but it should work. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWdRw9CaO5/Lv0PARAra+AJ9zZ4ejuncDFJXlQHicNXykEh9EWACgqTBJ GTAT1awgUG4RugUt/9jQNmw= =jcpP -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation + multiple Submit buttons
Andrew Martin wrote: Maybe a stupid question but is it possible to call the specifc XML configuration from within the action? Yup, just set up your validation as usual, then set validate=false on the action mapping and call the validation by hand: ActionMessages errors = form.validate(); That'll run the same validation machinery as Struts calls when validate is set to true. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation problem
Look at where you're directing the action to go to if an error occurs - i.e. what have you specified as you're input for the action in your struts-config.xml? It looks like the error occured after validation failed and when it tried to forward to whatever was specified in the input parameter. Niall P.S. Its always useful to post the version number of Struts you're using. On 11/9/06, Li [EMAIL PROTECTED] wrote: Hi all, I met very wired problem. A have a DynaValidatorForm which is assigned to an action. When I didnt put this form to validation.xml. It works fine. When I put this into validation.xml in order to validate Empty Entry Situation It throws exception: javax.servlet.ServletException: Action[/QICSampleStatusChecker] does not contain specified method (check logs) org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1023) org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345) org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:988) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I was wondering what was going on. I applied this in many places of my application, never meet such problem like this. Any idea? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation problem
Hi, Niall, Problem solved. That's cuz I was trying to forward to another customized action. I had made this action as ForwardAction provided by Struts. It works now. Thanks. Sorry I was a bit rush writing the previously email so that forgot to put the version number. Regards Li On 11/10/06, Niall Pemberton [EMAIL PROTECTED] wrote: Look at where you're directing the action to go to if an error occurs - i.e. what have you specified as you're input for the action in your struts-config.xml? It looks like the error occured after validation failed and when it tried to forward to whatever was specified in the input parameter. Niall P.S. Its always useful to post the version number of Struts you're using. On 11/9/06, Li [EMAIL PROTECTED] wrote: Hi all, I met very wired problem. A have a DynaValidatorForm which is assigned to an action. When I didnt put this form to validation.xml. It works fine. When I put this into validation.xml in order to validate Empty Entry Situation It throws exception: javax.servlet.ServletException: Action[/QICSampleStatusChecker] does not contain specified method (check logs) org.apache.struts.action.RequestProcessor.processException( RequestProcessor.java:535) org.apache.struts.action.RequestProcessor.processActionPerform( RequestProcessor.java:433) org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process( ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java :432) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.struts.action.RequestProcessor.doForward( RequestProcessor.java:1085) org.apache.struts.tiles.TilesRequestProcessor.doForward( TilesRequestProcessor.java:263) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward( RequestProcessor.java:1023) org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward (TilesRequestProcessor.java:345) org.apache.struts.action.RequestProcessor.processValidate( RequestProcessor.java:988) org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:207) org.apache.struts.action.ActionServlet.process( ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java :432) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I was wondering what was going on. I applied this in many places of my application, never meet such problem like this. Any idea? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- When we invent time, we invent death.
Re: Validation with actions
Ummm... If you don't call html:javascript/ there won't be any client side validation code inserted, so there won't be any client side validation performed, IIRC. (*Chris*) On 10/26/06, zeta [EMAIL PROTECTED] wrote: Ok, sorry. If I use DynaValidationActionForm instead of DynaValidationForm for creating my forms, what should I do in order to disable form validation in both sides: client (javascript) and server? I know how to bypass server validation (using validate=false in the action tag) but I haven't been able to do the same in client side. Thanks, Zeta.- Laurie Harper wrote: zeta wrote: I want to associate the validation with the action definition. In this way, I need to performed the client-side validation when an action is called and not taken into account the form associated to this action. Can you give me some example of how do this? I'm not sure what you mean by 'not taken into account the form associated to this action.' The way to get client-side validation is to include the html:javascript tag somewhere inside your html:form, and add an onsubmit handler to the form to call the generated Javascript code. See the html:javascript documentation [1] and the Validator Guide [2] for more info. L. [1] http://struts.apache.org/1.3.5/struts-taglib/tlddoc/html/javascript.html [2] http://struts.apache.org/1.3.5/faqs/validator.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Validation-with-actions-tf2507074.html#a7008710 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation with actions
zeta wrote: I want to associate the validation with the action definition. In this way, I need to performed the client-side validation when an action is called and not taken into account the form associated to this action. Can you give me some example of how do this? I'm not sure what you mean by 'not taken into account the form associated to this action.' The way to get client-side validation is to include the html:javascript tag somewhere inside your html:form, and add an onsubmit handler to the form to call the generated Javascript code. See the html:javascript documentation [1] and the Validator Guide [2] for more info. L. [1] http://struts.apache.org/1.3.5/struts-taglib/tlddoc/html/javascript.html [2] http://struts.apache.org/1.3.5/faqs/validator.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation _without_ looking up keys in resource bundles
Ah ha. Found it. Looks like the dev guys accounted for this. You can see how in org.apache.struts.validator.Resources. public static ActionMessage getActionMessage(Validator validator, HttpServletRequest request, ValidatorAction va, Field field) { Msg msg = field.getMessage(va.getName()); if ((msg != null) !msg.isResource()) { return new ActionMessage(msg.getKey(), false); } So if you've configured your validation.xml field entry to indicate that the message isn't a resource, Struts creates an ActionMessage which interprets it as a literal value, not as a key into a resource bundle. Certainly is nice to have the i18n option when you need it, but when you know you don't, it's quite a bit of clutter to support. Thanks! Stu
Re: Validation on String[]
hi, there is no such type : java.lang.String[], try to use List or ArrayList On 9/21/06, Sahil Gupta [EMAIL PROTECTED] wrote: Hi, I have used a dyna form in which I have a property which is a multi-select pick list defined as form-property name=location type=java.lang.String[] Now I want to put validation (required and/or mask) on this. Can anyone please guide me. I want it to show an error if the user clicks on submit button without selecting anything in the picklist. I have handled this validation in my Action but I want to do this through validation.xml Regards, Sahil Gupta -- When we invent time, we invent death.
RE: Validation on String[]
Hi, How can we use List or ArrayList in DynaValidator Forms? Regards, Sahil Gupta -Original Message- From: Li [mailto:[EMAIL PROTECTED] Sent: Thursday, September 21, 2006 3:57 PM To: Struts Users Mailing List Subject: Re: Validation on String[] hi, there is no such type : java.lang.String[], try to use List or ArrayList On 9/21/06, Sahil Gupta [EMAIL PROTECTED] wrote: Hi, I have used a dyna form in which I have a property which is a multi-select pick list defined as form-property name=location type=java.lang.String[] Now I want to put validation (required and/or mask) on this. Can anyone please guide me. I want it to show an error if the user clicks on submit button without selecting anything in the picklist. I have handled this validation in my Action but I want to do this through validation.xml Regards, Sahil Gupta -- When we invent time, we invent death. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation on String[]
have you tried java.util.ArrayList, or create an action form that extends ValidatorForm, which declare your List object there On 9/21/06, Sahil Gupta [EMAIL PROTECTED] wrote: Hi, How can we use List or ArrayList in DynaValidator Forms? Regards, Sahil Gupta -Original Message- From: Li [mailto:[EMAIL PROTECTED] Sent: Thursday, September 21, 2006 3:57 PM To: Struts Users Mailing List Subject: Re: Validation on String[] hi, there is no such type : java.lang.String[], try to use List or ArrayList On 9/21/06, Sahil Gupta [EMAIL PROTECTED] wrote: Hi, I have used a dyna form in which I have a property which is a multi-select pick list defined as form-property name=location type=java.lang.String[] Now I want to put validation (required and/or mask) on this. Can anyone please guide me. I want it to show an error if the user clicks on submit button without selecting anything in the picklist. I have handled this validation in my Action but I want to do this through validation.xml Regards, Sahil Gupta -- When we invent time, we invent death. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- When we invent time, we invent death.
RE: Validation on String[]
form-property name=locations type=java.util.ArrayList/ field property=locationName indexedListProperty=locations depends=required arg key=Location resource=false/ /field in your action class: ArrayList list = new ArrayList(); Location location = new Location(); location.setLocationName(A Location); list.add(location); dyForm.set(locations, list); I'm not sure how to validate a simple array of strings (eg java.lang.String[]) as the property attribute is required by the validator. From: Sahil Gupta [mailto:[EMAIL PROTECTED] Sent: Thu 21/09/2006 8:40 PM To: 'Struts Users Mailing List' Subject: RE: Validation on String[] Hi, How can we use List or ArrayList in DynaValidator Forms? Regards, Sahil Gupta -Original Message- From: Li [mailto:[EMAIL PROTECTED] Sent: Thursday, September 21, 2006 3:57 PM To: Struts Users Mailing List Subject: Re: Validation on String[] hi, there is no such type : java.lang.String[], try to use List or ArrayList On 9/21/06, Sahil Gupta [EMAIL PROTECTED] wrote: Hi, I have used a dyna form in which I have a property which is a multi-select pick list defined as form-property name=location type=java.lang.String[] Now I want to put validation (required and/or mask) on this. Can anyone please guide me. I want it to show an error if the user clicks on submit button without selecting anything in the picklist. I have handled this validation in my Action but I want to do this through validation.xml Regards, Sahil Gupta -- When we invent time, we invent death. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]