RE: Struts Validator: form value1 form value2
I'm trying the following validation, and it is giving me a syntax error: line 1:87: expecting RPAREN, found 'and'. Am I going about this wrong? field property=field1 depends=float,validwhen var var-nametest/var-name var-value ![CDATA[ ( (field2 == null) or ((field2 != null) and (*this* == null)) or ((field2 != null) and (*this* != null) and (*this* = field2)) ) ]] /var-value /var /field field property=field2 depends=float,validwhen var var-nametest/var-name var-value ![CDATA[ ( (field1 == null) or ((field1 != null) and (*this* == null)) or ((field1 != null) and (*this* != null) and (*this* = field1)) ) ]] /var-value /var /field _ Jeremy Nix Senior Application Developer Southwest Financial Services, Ltd. (513) 621-6699 x1158 -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 4:01 AM To: Struts Users Mailing List Subject: Re: Struts Validator: form value1 form value2 Yeah validwhen can do it. anyway these antlr expressions are not very intuitive. If You have a problem let me kow i will try to help 2006/6/22, The Jasper [EMAIL PROTECTED]: hi, the validwhen validator can do what you want. mvg, Jasper On 6/22/06, Truong Xuan Tinh [EMAIL PROTECTED] wrote: Hi there, You can write a custom validator in Struts to do that, it's rather easy, both client-side and server-side. Open the jar of commons-validator to see some script for existed validation rule should help. Regards. Tinh Jeremy Nix wrote: How can I use the Struts Validator to enforce the above rule? Neither of the fields are required, but if both are given, they must adhere to the given rule. Thanks for any help, _ Jeremy Nix Senior Application Developer Southwest Financial Services, Ltd. (513) 621-6699 x1158 - 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: Struts Validator: form value1 form value2
Extra parenthesis solved my problem. Thanks for the help. Below is the validation that I added to field 1. I left it out of field2 since I did not want to see redundant error messages. ( ( (field2 == null) or ((field2 != null) and (*this* == null)) ) or ( ((field2 != null) and (*this* != null)) and (*this* = field2) ) ) _ Jeremy Nix Senior Application Developer Southwest Financial Services, Ltd. (513) 621-6699 x1158 -Original Message- From: The Jasper [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 10:50 AM To: Struts Users Mailing List Subject: Re: Struts Validator: form value1 form value2 The struts validator guide says you can only join 2 values with and or or. I'm guessing that means you either have to put in a lot more parentheses or that you can't use and or or more than once. I would first try parenthesizing everything. mvg, Jasper On 6/22/06, Jeremy Nix [EMAIL PROTECTED] wrote: I'm trying the following validation, and it is giving me a syntax error: line 1:87: expecting RPAREN, found 'and'. Am I going about this wrong? field property=field1 depends=float,validwhen var var-nametest/var-name var-value ![CDATA[ ( (field2 == null) or ((field2 != null) and (*this* == null)) or ((field2 != null) and (*this* != null) and (*this* = field2)) ) ]] /var-value /var /field field property=field2 depends=float,validwhen var var-nametest/var-name var-value ![CDATA[ ( (field1 == null) or ((field1 != null) and (*this* == null)) or ((field1 != null) and (*this* != null) and (*this* = field1)) ) ]] /var-value /var /field _ Jeremy Nix Senior Application Developer Southwest Financial Services, Ltd. (513) 621-6699 x1158 -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 4:01 AM To: Struts Users Mailing List Subject: Re: Struts Validator: form value1 form value2 Yeah validwhen can do it. anyway these antlr expressions are not very intuitive. If You have a problem let me kow i will try to help 2006/6/22, The Jasper [EMAIL PROTECTED]: hi, the validwhen validator can do what you want. mvg, Jasper On 6/22/06, Truong Xuan Tinh [EMAIL PROTECTED] wrote: Hi there, You can write a custom validator in Struts to do that, it's rather easy, both client-side and server-side. Open the jar of commons-validator to see some script for existed validation rule should help. Regards. Tinh Jeremy Nix wrote: How can I use the Struts Validator to enforce the above rule? Neither of the fields are required, but if both are given, they must adhere to the given rule. Thanks for any help, _ Jeremy Nix Senior Application Developer Southwest Financial Services, Ltd. (513) 621-6699 x1158 - 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]
Struts Validator: form value1 form value2
How can I use the Struts Validator to enforce the above rule? Neither of the fields are required, but if both are given, they must adhere to the given rule. Thanks for any help, _ Jeremy Nix Senior Application Developer Southwest Financial Services, Ltd. (513) 621-6699 x1158
Passing ActionForm along on the request
Is it possible to call an Action which pre-populates a form, forwards on to a JSP page which displays the form values for the user to change, and then submit back to an Action that will contain the form value? We're running into a scenario where we prepopulate the Form in 1 action and set it onto the Request. The jsp displays some of the values so that they may be modified, and then submits back to a second action where the Form is to be populated. When the form is submitted to the 2nd Action, the ActionForm is reinitialized, and ends up throwing an exception in the BeanUtils.populate method because an object on the form is null. We've found that the scenario works fine when using Sessions, but runs into issues when using the request. Here's a sample struts config: action path=/actions/MyAction type=actions.MyAction name=myActionForm scope=request validate=false forward name=continue path=/actions/MyAction.jsp/ /action action path=/actions/MyActionSubmit type=actions.MyActionSubmit name=myActionForm scope=request input=/actions/MyAction.jsp validate=true forward name=continue path=/actions/MyNextAction/ /action We already have 1 solution (using sessions), but given the fact that we're going to be working in a load-balanced environment with multiple Tomcat instances, we are trying to use the session sparingly. Another solution that I just thought of would be to replicate all the values of the Form as hidden values on the JSP page so that they would be repopulated on the submit. This would be slightly annoying, but is a viable solution. My question is, is there another solution that works as clean as sessions but uses the request? _ Jeremy Nix Senior Application Developer Southwest Financial Services, LTD. (513) 621-6699 x1158 www.sfsltd.com