Re: Validation in Struts 1
That's not combining client- and server-side validation, that's combining declarative and programmatic validation, unless you're talking about the JavaScript validation method. Dave On Mon, Oct 25, 2010 at 1:52 PM, Anjib Mulepati anji...@hotmail.com wrote: Hi Can we combine client side validation and server side validation? i.e. using validation.xml as well as validation in validate() method as well. Does it make any sense? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Validation in Struts 1
ok so is this mean both is server side validation and client side validation is done with Javascript? Also between these two(.xml and execute() method) which one is better? Any pros and cons? Anjib On 10/25/2010 1:55 PM, Dave Newton wrote: That's not combining client- and server-side validation, that's combining declarative and programmatic validation, unless you're talking about the JavaScript validation method. Dave On Mon, Oct 25, 2010 at 1:52 PM, Anjib Mulepatianji...@hotmail.com wrote: Hi Can we combine client side validation and server side validation? i.e. using validation.xml as well as validation in validate() method as well. Does it make any sense? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Validation in Struts 1
On Mon, Oct 25, 2010 at 2:01 PM, Anjib Mulepati anji...@hotmail.com wrote: ok so is this mean both is server side validation and client side validation is done with Javascript? ??? No. Client-side validation is done with JavaScript, because that's what runs inside browsers. Server-side validation is done in Java, whether or not it's driven by XML. Also between these two(.xml and execute() method) which one is better? Any pros and cons? execute() method? Do you mean the validate() method? Neither is better--they're different things. XML/declarative validation is more useful for simple validations: length, masks, etc. The validate() method is more useful for business-logic-oriented validation, like if a business has a flag set then we only allow US addresses or something along those lines. The two are combinable; use XML for easy stuff, validate() for hard stuff. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Validation in Struts 1
On Mon, 2010-10-25 at 14:01 -0400, Anjib Mulepati wrote: ok so is this mean both is server side validation and client side validation is done with Javascript? Also between these two(.xml and execute() method) which one is better? Any pros and cons? Anjib On 10/25/2010 1:55 PM, Dave Newton wrote: That's not combining client- and server-side validation, that's combining declarative and programmatic validation, unless you're talking about the JavaScript validation method. Dave On Mon, Oct 25, 2010 at 1:52 PM, Anjib Mulepatianji...@hotmail.com wrote: Hi Can we combine client side validation and server side validation? i.e. using validation.xml as well as validation in validate() method as well. Does it make any sense? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org Client side validation via javascripts prevents client to server communication if some error can be deal with at client side, ie, input eroor, which reduces server burden. However, server side validation is also needed because clients can walk around client side intentionally. Please correct me if I said something wrong. Qiang -- Qiang Li HuBei Polytechnic Institute No. 17 YuQuan Road XiaoGan HuBei 432100 China E-mail: liqi...@hbvtc.edu.cn - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Validation of Struts XML files
Looks like a simple versioning error to me; you're doctype declaration: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd; But you said: But, the struts-config_1_3.dtd is not in the struts.jar file (we're using Struts 1.2.9) I wouldn't expect 1.2.9 to contain a 1.3 DTD... Either upgrade to Struts 1.3.9 or use the DTD corresponding to the release you are on: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; L. Adam Gordon wrote: Last night, our company had a maintenance window whereby Internet access was shut off from our office to the outside world. During that time I was doing development and attempted to start up our web app in a development environment. I've not seen this error in almost 2 years but it's apparently back: [org.apache.struts.action.ActionServlet] [handleConfigException] Parsing error processing resource path /WEB-INF/struts-optout.xml java.net.UnknownHostException: jakarta.apache.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.Socket.connect(Socket.java:520) at java.net.Socket.connect(Socket.java:470) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) ...*snip*... I remember this well. The problem is that struts-optout.xml has the DOCTYPE of: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd; But, the struts-config_1_3.dtd is not in the struts.jar file (we're using Struts 1.2.9) so, apparently in order to validate that the XML file is well-formed at webapp start up time, Tomcat feels the need to go out and retrieve this DTD - only it can't because Internet access was down. The problem is greatly exacerbated by the fact that Tomcat stops processing the loading of struts modules when this one fails essentially rendering the web app useless. I seem to recall playing with turning validation of XML files off, but that not being a sufficient solution so I tried adding the DTD into the struts JAR file in the same location as the other DTDs: org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but that didn't work. We need to be able to find a solution to where we can host the DTDs locally and do not have to rely on a 3rd party server being up in order to deploy our web application. I seem to recall this being an issue with the W3C (especally w.r.t. [X]HTML validation in that it results in a ton of unnecessary network calls to retrieve DTDs for validation rather than web servers hosting the DTDs locally. I'm sure I'm not the only one to have seen this so any help to resolve this would be greatly appreciated. Thanks. -- adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation of Struts XML files
Does it work if you use the DTD it says to use? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://struts.apache.org/dtds/struts-config_1_3.dtd; Dave --- Adam Gordon [EMAIL PROTECTED] wrote: Last night, our company had a maintenance window whereby Internet access was shut off from our office to the outside world. During that time I was doing development and attempted to start up our web app in a development environment. I've not seen this error in almost 2 years but it's apparently back: [org.apache.struts.action.ActionServlet] [handleConfigException] Parsing error processing resource path /WEB-INF/struts-optout.xml java.net.UnknownHostException: jakarta.apache.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.Socket.connect(Socket.java:520) at java.net.Socket.connect(Socket.java:470) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) ...*snip*... I remember this well. The problem is that struts-optout.xml has the DOCTYPE of: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd; But, the struts-config_1_3.dtd is not in the struts.jar file (we're using Struts 1.2.9) so, apparently in order to validate that the XML file is well-formed at webapp start up time, Tomcat feels the need to go out and retrieve this DTD - only it can't because Internet access was down. The problem is greatly exacerbated by the fact that Tomcat stops processing the loading of struts modules when this one fails essentially rendering the web app useless. I seem to recall playing with turning validation of XML files off, but that not being a sufficient solution so I tried adding the DTD into the struts JAR file in the same location as the other DTDs: org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but that didn't work. We need to be able to find a solution to where we can host the DTDs locally and do not have to rely on a 3rd party server being up in order to deploy our web application. I seem to recall this being an issue with the W3C (especally w.r.t. [X]HTML validation in that it results in a ton of unnecessary network calls to retrieve DTDs for validation rather than web servers hosting the DTDs locally. I'm sure I'm not the only one to have seen this so any help to resolve this would be greatly appreciated. Thanks. -- adam - 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 of Struts XML files
Well, the DTD files are identical, only the URLs are different so I don't expect the outcome to be any different And it turns out it's not. Changing the URL does not prevent Tomcat from going out and trying to retrieve the DTD even though I've added it to the JAR file. Any other ideas? --adam Dave Newton wrote: Does it work if you use the DTD it says to use? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://struts.apache.org/dtds/struts-config_1_3.dtd; Dave --- Adam Gordon [EMAIL PROTECTED] wrote: Last night, our company had a maintenance window whereby Internet access was shut off from our office to the outside world. During that time I was doing development and attempted to start up our web app in a development environment. I've not seen this error in almost 2 years but it's apparently back: [org.apache.struts.action.ActionServlet] [handleConfigException] Parsing error processing resource path /WEB-INF/struts-optout.xml java.net.UnknownHostException: jakarta.apache.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.Socket.connect(Socket.java:520) at java.net.Socket.connect(Socket.java:470) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) ...*snip*... I remember this well. The problem is that struts-optout.xml has the DOCTYPE of: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd; But, the struts-config_1_3.dtd is not in the struts.jar file (we're using Struts 1.2.9) so, apparently in order to validate that the XML file is well-formed at webapp start up time, Tomcat feels the need to go out and retrieve this DTD - only it can't because Internet access was down. The problem is greatly exacerbated by the fact that Tomcat stops processing the loading of struts modules when this one fails essentially rendering the web app useless. I seem to recall playing with turning validation of XML files off, but that not being a sufficient solution so I tried adding the DTD into the struts JAR file in the same location as the other DTDs: org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but that didn't work. We need to be able to find a solution to where we can host the DTDs locally and do not have to rely on a 3rd party server being up in order to deploy our web application. I seem to recall this being an issue with the W3C (especally w.r.t. [X]HTML validation in that it results in a ton of unnecessary network calls to retrieve DTDs for validation rather than web servers hosting the DTDs locally. I'm sure I'm not the only one to have seen this so any help to resolve this would be greatly appreciated. Thanks. -- adam - 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 in Struts DisptachAction
Sharma, If insert, update and read modes, are represented by 3 different submits that trigger the actions, make them 3 different action mappings, then put validate=false in the read action mapping, and true in the rest. action path=/readAction name=yourForm validate=false scope=session input=viewDefinition type=com.gme.urAction parameter=read forward name=definitionPage path=formatDefinition/forward /action action path=/insertAction name=yourForm validate=true scope=session input=viewDefinition type=com.gme.urAction parameter=insert forward name=definitionPage path=formatDefinition/forward /action action path=/updateAction name=yourForm validate=true scope=session input=viewDefinition type=com.gme.urAction parameter=update forward name=definitionPage path=formatDefinition/forward /action -Original Message- From: Vaneet Sharma [mailto:[EMAIL PROTECTED] Sent: Thursday, August 24, 2006 2:09 PM To: struts-user@jakarta.apache.org Subject: Validation in Struts DisptachAction Hii I am using Struts DispatchAction and i am facing a peculiar problem while validating . Now i want to validate ,my action form only in insert or update mode. For read mode i want to prevent validation. To achive this is am writing validation=false in the action mapping , and i am manually calling validation in insert and update methods of my action class. DynaActionForm frm=(DynaActionForm)form; ActionErrors errors=frm.validate(mapping,request); if ( errors != null !errors.isEmpty() ) { saveErrors(request, errors); return (mapping.findForward(validationfailure)); } But when i am doing validation in this way. It is always trying to validate the action , even in read mode also. Can anybody tell me why is this happening. Thanx in advance Disclaimer : This message and any attachments (hereinafter referred to as the Said Information) are intended solely for the addressee. The Said Information is confidential and may be privileged and is also prohibited from disclosure. Access, use, copying, distribution or e-use of the Said Information by anyone except the addressee is unauthorized. If you are not the intended addressee, please destroy all copies of the Said Information in your possession and also delete the same from your computer. Any views expressed in the Said Information are those of the individual sender except where the sender, with due authority of CRISIL Ltd./CRISIL MarketWire Ltd./Global Data Services of India Ltd. specifically states them to be the views of CRISIL Ltd./CRISIL MarketWire Ltd./Global Data Services of India Ltd. Nothing contained in the Said Information is capable or intended to create any legally binding obligations on the sender CRISIL Ltd./CRISIL MarketWire Ltd./Global Data Services of India L td. who accept no responsibility, whatsoever, for loss or damage from the use of the Said Information including damage from viruses. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation in Struts DisptachAction
Hi Vaneet I'm no expert on this to be sure; but I ran into a similiar issue. What I did was provided the check for the Read only mode in the forms validate method; if read only mode the validate method returned null; otherwise it invoked the super.validate method which performs the normal validation checks on the form. Hope this helps. Reg From: Vaneet Sharma [mailto:[EMAIL PROTECTED] Sent: Thu 24/08/2006 8:08 AM To: struts-user@jakarta.apache.org Subject: Validation in Struts DisptachAction Hii I am using Struts DispatchAction and i am facing a peculiar problem while validating . Now i want to validate ,my action form only in insert or update mode. For read mode i want to prevent validation. To achive this is am writing validation=false in the action mapping , and i am manually calling validation in insert and update methods of my action class. DynaActionForm frm=(DynaActionForm)form; ActionErrors errors=frm.validate(mapping,request); if ( errors != null !errors.isEmpty() ) { saveErrors(request, errors); return (mapping.findForward(validationfailure)); } But when i am doing validation in this way. It is always trying to validate the action , even in read mode also. Can anybody tell me why is this happening. Thanx in advance Disclaimer : This message and any attachments (hereinafter referred to as the Said Information) are intended solely for the addressee. The Said Information is confidential and may be privileged and is also prohibited from disclosure. Access, use, copying, distribution or e-use of the Said Information by anyone except the addressee is unauthorized. If you are not the intended addressee, please destroy all copies of the Said Information in your possession and also delete the same from your computer. Any views expressed in the Said Information are those of the individual sender except where the sender, with due authority of CRISIL Ltd./CRISIL MarketWire Ltd./Global Data Services of India Ltd. specifically states them to be the views of CRISIL Ltd./CRISIL MarketWire Ltd./Global Data Services of India Ltd. Nothing contained in the Said Information is capable or intended to create any legally binding obligations on the sender CRISIL Ltd./CRISIL MarketWire Ltd./Global Data Services of India L td. who accept no responsibility, whatsoever, for loss or damage from the use of the Said Information including damage from viruses. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation in Struts for Required fields
One more: you need something like this in your ApplicationResources: errors.required={0} is required. In article [EMAIL PROTECTED], Caroline Jen [EMAIL PROTECTED] wrote: To add to the list: 5. the validator-rules.xml and validation.xml must be in the AppName/WEB-INF directory. 6. Make sure that there is a proper version of the commons-validator.jar file. 7. there is font color=?red?html:errors//font in the .jsp to turn on the validation and to show warning messages in red 8. validation plug-in in the struts-config.xml; -Caroline --- Erik Weber [EMAIL PROTECTED] wrote: Somehow we lost the list on a couple of posts. OK, so, these are the things I assume you have checked so far: 1) you have an html:select tag with property = reportType, and the default option's value is 2) your ActionForm extends one of the proper types (such as ValidatorForm) and has the proper getters and setters for the reportType field 3) in struts-config.xml, you have configured the action (the same one that your form will submit to) with validate = true, and you have named the proper ActionForm to associate with the action (one of your form-bean declarations) 4) the field name in validation.xml matches the field name of your select (reportType), and the form name in validation.xml matches the same form name that you are associating with the action in struts-config.xml (the name of the form configured in the action matches one of your form-bean declarations) What else am I leaving out? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation in Struts for Required fields
In your JSP, where are your selects? Are you using html:select tags to produce them? Erik Priya Jotwani wrote: Hi , I have a JSP Page where I have two dropdowns displaying default values. Before submitting that page, the user should select something from these two dropdowns and if he doesn't selects, there should be an error message displayed on the top saying This field is required. This is what I am doing but it doesn't gives me an error message and am able to proceed to the next page. Any idea as to what could be possibly wrong/missing ? In my validator.xml , I have form name=ClientReportingForm !-- Struts validation -- field property=reportType depends=required arg0 key=prompt.reportType/ /field field property=productLine depends=required arg0 key=prompt.productLine/ /field /form In my ApplicationResources.properties I have prompt.reportType value= Report Type/ prompt.productLinevalue= Product Line/ And in my JSP Page I have logic:messagesPresent message=error bean:message key=errors.header / ul font color=redb html:messages id=error libean:write name=error filter=false //li /html:messages /b /font /ul bean:message key=errors.footer / /logic:messagesPresent Thanks, Priya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation in Struts for Required fields
Somehow we lost the list on a couple of posts. OK, so, these are the things I assume you have checked so far: 1) you have an html:select tag with property = reportType, and the default option's value is 2) your ActionForm extends one of the proper types (such as ValidatorForm) and has the proper getters and setters for the reportType field 3) in struts-config.xml, you have configured the action (the same one that your form will submit to) with validate = true, and you have named the proper ActionForm to associate with the action (one of your form-bean declarations) 4) the field name in validation.xml matches the field name of your select (reportType), and the form name in validation.xml matches the same form name that you are associating with the action in struts-config.xml (the name of the form configured in the action matches one of your form-bean declarations) What else am I leaving out? Erik Priya Jotwani wrote: Yes I have set the validate= true in and the field names are same too :( -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 11:32 PM To: Priya Jotwani Subject: Re: Validation in Struts for Required fields Does the property attribute to html:select have the same value you have specified as the field name in validation.xml (reportType, productLine)? Do you have the validate attribute set to true in struts-config.xml for the relevant action configuration? Erik Priya Jotwani wrote: Hi Erik, I am using html:select tag like below in my JSP html:option value=Select a Product Line/html:option Thanks, Priya -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 11:04 PM To: Struts Users Mailing List Subject: Re: Validation in Struts for Required fields In your JSP, where are your selects? Are you using html:select tags to produce them? Erik Priya Jotwani wrote: Hi , I have a JSP Page where I have two dropdowns displaying default values. Before submitting that page, the user should select something from these two dropdowns and if he doesn't selects, there should be an error message displayed on the top saying This field is required. This is what I am doing but it doesn't gives me an error message and am able to proceed to the next page. Any idea as to what could be possibly wrong/missing ? In my validator.xml , I have form name=ClientReportingForm !-- Struts validation -- field property=reportType depends=required arg0 key=prompt.reportType/ /field field property=productLine depends=required arg0 key=prompt.productLine/ /field /form In my ApplicationResources.properties I have prompt.reportType value= Report Type/ prompt.productLinevalue= Product Line/ And in my JSP Page I have logic:messagesPresent message=error bean:message key=errors.header / ul font color=redb html:messages id=error libean:write name=error filter=false //li /html:messages /b /font /ul bean:message key=errors.footer / /logic:messagesPresent Thanks, Priya - 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 in Struts for Required fields
To add to the list: 5. the validator-rules.xml and validation.xml must be in the AppName/WEB-INF directory. 6. Make sure that there is a proper version of the commons-validator.jar file. 7. there is font color=redhtml:errors//font in the .jsp to turn on the validation and to show warning messages in red 8. validation plug-in in the struts-config.xml; -Caroline --- Erik Weber [EMAIL PROTECTED] wrote: Somehow we lost the list on a couple of posts. OK, so, these are the things I assume you have checked so far: 1) you have an html:select tag with property = reportType, and the default option's value is 2) your ActionForm extends one of the proper types (such as ValidatorForm) and has the proper getters and setters for the reportType field 3) in struts-config.xml, you have configured the action (the same one that your form will submit to) with validate = true, and you have named the proper ActionForm to associate with the action (one of your form-bean declarations) 4) the field name in validation.xml matches the field name of your select (reportType), and the form name in validation.xml matches the same form name that you are associating with the action in struts-config.xml (the name of the form configured in the action matches one of your form-bean declarations) What else am I leaving out? Erik Priya Jotwani wrote: Yes I have set the validate= true in and the field names are same too :( -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 11:32 PM To: Priya Jotwani Subject: Re: Validation in Struts for Required fields Does the property attribute to html:select have the same value you have specified as the field name in validation.xml (reportType, productLine)? Do you have the validate attribute set to true in struts-config.xml for the relevant action configuration? Erik Priya Jotwani wrote: Hi Erik, I am using html:select tag like below in my JSP html:option value=Select a Product Line/html:option Thanks, Priya -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 11:04 PM To: Struts Users Mailing List Subject: Re: Validation in Struts for Required fields In your JSP, where are your selects? Are you using html:select tags to produce them? Erik Priya Jotwani wrote: Hi , I have a JSP Page where I have two dropdowns displaying default values. Before submitting that page, the user should select something from these two dropdowns and if he doesn't selects, there should be an error message displayed on the top saying This field is required. This is what I am doing but it doesn't gives me an error message and am able to proceed to the next page. Any idea as to what could be possibly wrong/missing ? In my validator.xml , I have form name=ClientReportingForm !-- Struts validation -- field property=reportType depends=required arg0 key=prompt.reportType/ /field field property=productLine depends=required arg0 key=prompt.productLine/ /field /form In my ApplicationResources.properties I have prompt.reportType value= Report Type/ prompt.productLinevalue= Product Line/ And in my JSP Page I have logic:messagesPresent message=error bean:message key=errors.header / ul === message truncated === ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation in Struts
Priya, Use the required validator rule and be sure to use the html:javascript tag in your JSP to have the client-side Javascript embedded in the page given out to the user. See the first validator, required, at the below URL: http://struts.apache.org/userGuide/dev_validator.html#builtin Regards, David -Original Message- From: Priya Jotwani [mailto:[EMAIL PROTECTED] Sent: Saturday, September 18, 2004 12:12 PM To: Struts Users Mailing List Subject: Validation in Struts Hi, I have a page where a user should select something from the dropdown before clicking on Submit. If he doesn't selects anything, an errorMessage should get displayed on the same page saying ' Please select an option ' How can I do such validations in Struts. Thanks in Advance, Priya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation in struts
Greg, Thanks for your response. Is this validator framework supported for struts 1.1 since I use struts 1.1 for my application. Thanks, Divya. -Original Message- From: Greg Ludington [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 10:11 AM To: Struts Users Mailing List Subject: Re: Validation in struts It is said that the validation(client side validations like say a particular textbox field can contain numbers only etc) should not be explicitly written in client-side validation javascripts in a struts framework. How can such things be accomplished using struts without writing specific client-side validation javascripts functions on the jsp page? Any help is greatly appreciated. You will want to read up on the Validator framework. When you use the Validator, you configure rules about your form in an XML file. Struts will use those rules to perform server-side validation, but, for many basic types of validation, Struts can also (optionally) emit the proper javascript for client-side validation. You can still write your own javascript, if you need to or want to, but for many validation tasks -- including the can contains numbers only scenario you mentioned -- Struts will do it for you. You can find a HOWTO guide on the Validator on the Struts site here: http://struts.apache.org/userGuide/dev_validator.html Also, I believe the Struts distribution ships with a validator example. -Greg - 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 in struts
hi Divya, For doing clinet side validation you will have to configure validation framework and write ur own custom validation in that xml file or use the basic validation provided by that framework. In the jsp page you will have to put one struts javascipt tag. This tag will actually get all the custom java script for that page and thus client side validation java script will b put in jsp file. sachin xoriant, mumbai -Original Message- From: Divya B Sridhar [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 9:51 AM To: [EMAIL PROTECTED] Subject: Validation in struts Hi All, It is said that the validation(client side validations like say a particular textbox field can contain numbers only etc) should not be explicitly written in client-side validation javascripts in a struts framework. How can such things be accomplished using struts without writing specific client-side validation javascripts functions on the jsp page? Any help is greatly appreciated. Thanks, Divya.
RE: Validation in struts
Hi Jitendar, Thanks for your help. I am using the validator framework now and I see that when I click the submit button, it does the validation and comes back with the error message on top of the page but does not pop-up a messagebox. I would want to prompt for a message box if, say a particular mandatory field is missed. - Now, I am using html:javascript also after the title tag. - edited validation.xml to have the field names. - included the validator plugin in my struts-config.xml - included errors.required in my application properties file. - included onsubmit function in my html:form to point to validatemyform(this) Is there something else that I am missing ? Thanks, Divya. -Original Message- From: Jitender K Chukkavenkata [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 9:51 AM To: Struts Users Mailing List Subject: Re: Validation in struts U can use struts validations framework as well go thru struts validation framework.. Jitender Kumar C.V. IBM Global Services India (Pvt.) Ltd., Embassy Golf Links Business Park, Block C, Bangalore - 560 071. Phone : + 91 (80) 51056320 Mobile: + 91 9886219429 Location : EGC-3*-058. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation in struts
Hi Divya, I think you need to extend your form class with org.apache.struts.validator.action.ValidatorForm or ValidatorActionFrom instead of org.apache.struts.action.ActionForm. have u done it? Regards, Jitender.
RE: Validation in struts
Hi Jitender, I guess it is import org.apache.struts.validator.ValidatorForm I have extended this as well. What should be done to show an error message box instead of showing it on top of the page ? I am sure I am missing something :) Thanks, Divya. -Original Message- From: Jitender K Chukkavenkata [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 6:40 PM To: Struts Users Mailing List Subject: RE: Validation in struts Hi Divya, I think you need to extend your form class with org.apache.struts.validator.action.ValidatorForm or ValidatorActionFrom instead of org.apache.struts.action.ActionForm. have u done it? Regards, Jitender. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation in struts
Divya, if your problem is just to display an error message box instead of the message. use the javascript tag inside validator-rules.xml for your validation and map it with appropriate message key that you want to display. :) Jitender Kumar C.V.
Re: Validation in struts
It is said that the validation(client side validations like say a particular textbox field can contain numbers only etc) should not be explicitly written in client-side validation javascripts in a struts framework. How can such things be accomplished using struts without writing specific client-side validation javascripts functions on the jsp page? Any help is greatly appreciated. You will want to read up on the Validator framework. When you use the Validator, you configure rules about your form in an XML file. Struts will use those rules to perform server-side validation, but, for many basic types of validation, Struts can also (optionally) emit the proper javascript for client-side validation. You can still write your own javascript, if you need to or want to, but for many validation tasks -- including the can contains numbers only scenario you mentioned -- Struts will do it for you. You can find a HOWTO guide on the Validator on the Struts site here: http://struts.apache.org/userGuide/dev_validator.html Also, I believe the Struts distribution ships with a validator example. -Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validation error (struts 1.2.3)
-Original Message- From: Betty Koon [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 2:37 PM To: [EMAIL PROTECTED] Subject: validation error (struts 1.2.3) Anyone has idea on this error? I upgraded to 1.2.3 just now from 1.2.1 -Betty * 14:34:56,503 ERROR [Validator] reflection: null java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:4 54) at org.apache.commons.validator.Validator.validateField(Validator.java:544) at org.apache.commons.validator.Validator.validate(Validator.java:582) at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152) at com.adobe.edc.server.presentation.fw.EDCActionForm.validate(EDCActionForm.ja va:96) at com.adobe.edc.server.presentation.policy.PolicySearchAction.search_onClick(P olicySearchAction.java:491) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.cc.framework.adapter.struts.ActionUtil.handleFormAction(Unknown Source) at com.cc.framework.adapter.struts.FWAction.handleFormAction(Unknown Source) at com.cc.framework.adapter.struts.ActionUtil.execute(Unknown Source) at com.cc.framework.adapter.struts.FWAction.execute(Unknown Source) at com.cc.framework.adapter.struts.FWAction.execute(Unknown Source) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces sor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:157) at com.adobe.edc.server.presentation.util.SetCharacterEncodingFilter.doFilter(S etCharacterEncodingFilter.java:142) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:157) at com.adobe.edc.server.presentation.auth.RequestUrlFilter.doFilter(RequestUrlF ilter.java:88) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:157) at com.adobe.edc.server.presentation.auth.AuthenticationFilter.doFilter(Authent icationFilter.java:118) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext Valve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:104) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci ationValve.java:72) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:102) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR ealm.java:275) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:102) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:462) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:102) at