Re: Scope Interceptor and Struts2 Validation query...
The exception is being thrown from the JSP and has nothing to do with the Java code you've shown, as far as I can tell. The error message states the problem pretty clearly. Dave On Jul 6, 2011 9:44 AM, "log2akshat" wrote: > Thanks for your reply. > > Got no success with that link > > Actually the main problem is that I am using different themes as well as > modified theme as the form is having more than 2 columns, so there is a > rendering issue if I am using the Struts validation therefore I removed the > Struts Validation and using my Javascript. > > But can you please look into my 2nd query... > > Thanks > -- > Akshat > > -- > View this message in context: http://struts.1045723.n5.nabble.com/Scope-Interceptor-and-Struts2-Validation-query-tp4554566p4556964.html > Sent from the Struts - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >
Re: Scope Interceptor and Struts2 Validation query...
Thanks for your reply. Got no success with that link Actually the main problem is that I am using different themes as well as modified theme as the form is having more than 2 columns, so there is a rendering issue if I am using the Struts validation therefore I removed the Struts Validation and using my Javascript. But can you please look into my 2nd query... Thanks -- Akshat -- View this message in context: http://struts.1045723.n5.nabble.com/Scope-Interceptor-and-Struts2-Validation-query-tp4554566p4556964.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Scope Interceptor and Struts2 Validation query...
On Tue, Jul 5, 2011 at 4:10 PM, log2akshat wrote: > i have implemented the Struts2 validation framework, it is working fine. But > I want these error-messages in a small popup screen with a ok button, when > this popup is closed the focus should go to the field that has an error. > > Or is there any way by which we can use additional javascript onsubmit other > than by the dynamically generating default javascript. > Have a look at this and see if it helps - http://struts.apache.org/2.2.3/docs/ajax-validation.html -Wes -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Scope Interceptor and Struts2 Validation query...
i have implemented the Struts2 validation framework, it is working fine. But I want these error-messages in a small popup screen with a ok button, when this popup is closed the focus should go to the field that has an error. Or is there any way by which we can use additional javascript onsubmit other than by the dynamically generating default javascript. = 2nd Query: I have a form in which there is a list of cities which is fetching from the database using... but when I am trying to use : if(appform.getEduInstitute().equals("")) { addActionError("ERROR in Field No. 10: Please state the marks you have obtained at the following levels."); return ERROR; } the logs are showing the error in fetching the list of the cities Jul, 2011 11:03:22 AM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception tag 'select', field 'list', name 'appform.CCity': The requested list key '%{city}' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] at org.apache.struts2.components.Component.fieldError(Component.java:230) at org.apache.struts2.components.Component.findValue(Component.java:351) at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80) at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105) at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856) at org.apache.struts2.components.UIBean.end(UIBean.java:510) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) at org.apache.jsp.pages.application.OLAppForm_jsp._jspx_meth_s_005fselect_005f1(OLAppForm_jsp.java:1223) at org.apache.jsp.pages.application.OLAppForm_jsp._jspx_meth_s_005fform_005f0(OLAppForm_jsp.java:541) at org.apache.jsp.pages.application.OLAppForm_jsp._jspService(OLAppForm_jsp.java:223) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968) at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:653) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:647) at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103) at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96) at org.apache.tiles.renderer.impl.UntypedAttributeRenderer.write(UntypedAttributeRenderer.java:61) at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:659) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:337) at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:234) at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:211) at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220) at org.apache.jsp.Tiles.CandidateBaseLayout_jsp._jspx_meth_tiles_005finsertAttribute_005f3(CandidateBaseLayout_jsp.java:251) at org.apache.jsp.Tiles.CandidateBaseLayout_jsp._jspService(CandidateBaseLayout_jsp.java:109) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at
RE: Struts2 Validation w/ModelDriven
That should work fine until someonw switches you to the PrepareParamsPrepare stack and prepere() gets called twice anyway. ;) (*Chris*) On May 19, 2011 12:55 PM, "CRANFORD, CHRIS" wrote: > Eric - > > The framework will call getModel() multiple times before your validate() > and execute() methods are invoked; and so by adding the create/lookup > logic to getModel(); you would then have to wrap that block of code > around a null check so that subsequent calls to getModel() would just > return the model reference and not worry about creating or looking up > the model object. (see below) > > public MyModelObject getModel() { > if(model == null) { > if(id == null) > model = service.create(itemNumber,vendorNumber,quantity); > else > model = service.lookupById(id); > } > return model; > } > > To me this is a performance issue because a null check is being > performed for each getModel() invocation. And since my model should > only be instantiated once; it's appropriate to put this in a method that > is invoked only once per action request; which is the prepare() method. > > Personally I prefer to keep my design simple and clear and thus if any > retrieval of data is done inside my actions it is either in the > prepare() method or in the actual execute() or entry point method call > being invoked in the action. Any get() methods are there simply to > return the instance of a property member that has been initialized in > either prepare() or the execute() or entry point method calls > themselves. > > -Chris > > -Original Message- > From: Eric Lentz [mailto:eric.le...@sherwin.com] > Sent: Thursday, May 19, 2011 1:22 PM > To: Struts Users Mailing List > Subject: RE: Struts2 Validation w/ModelDriven > > I'm curious. If you are using ModelDriven, then why do you load your > model > in prepare()? Why not in getModel? I don't think behavior will be any > different though since that interceptor is on the same side of the stack > > as prepare. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >
Re: Struts2 Validation w/ModelDriven
On Thu, May 19, 2011 at 3:55 PM, CRANFORD, CHRIS wrote: > The framework will call getModel() multiple times before your validate() > and execute() methods are invoked; and so by adding the create/lookup > logic to getModel(); you would then have to wrap that block of code > around a null check so that subsequent calls to getModel() would just > return the model reference and not worry about creating or looking up > the model object. (see below) Oh, guess you said all that already. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation w/ModelDriven
On Thu, May 19, 2011 at 2:22 PM, Eric Lentz wrote: > I'm curious. If you are using ModelDriven, then why do you load your model > in prepare()? Why not in getModel? That'd mean you'd need the "did I already load the model?" code in getModel(), wouldn't it? Seems cleaner to use prepare, since that's what it's for. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Struts2 Validation w/ModelDriven
Eric - The framework will call getModel() multiple times before your validate() and execute() methods are invoked; and so by adding the create/lookup logic to getModel(); you would then have to wrap that block of code around a null check so that subsequent calls to getModel() would just return the model reference and not worry about creating or looking up the model object. (see below) public MyModelObject getModel() { if(model == null) { if(id == null) model = service.create(itemNumber,vendorNumber,quantity); else model = service.lookupById(id); } return model; } To me this is a performance issue because a null check is being performed for each getModel() invocation. And since my model should only be instantiated once; it's appropriate to put this in a method that is invoked only once per action request; which is the prepare() method. Personally I prefer to keep my design simple and clear and thus if any retrieval of data is done inside my actions it is either in the prepare() method or in the actual execute() or entry point method call being invoked in the action. Any get() methods are there simply to return the instance of a property member that has been initialized in either prepare() or the execute() or entry point method calls themselves. -Chris -Original Message- From: Eric Lentz [mailto:eric.le...@sherwin.com] Sent: Thursday, May 19, 2011 1:22 PM To: Struts Users Mailing List Subject: RE: Struts2 Validation w/ModelDriven I'm curious. If you are using ModelDriven, then why do you load your model in prepare()? Why not in getModel? I don't think behavior will be any different though since that interceptor is on the same side of the stack as prepare. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Struts2 Validation w/ModelDriven
> Not that I am aware. The paramsPrepareParamsStack to my knowledge > handles validation at the very end; so by the time validation has > happened; the model has already been prepared by the prepare() method. Right, I see you said that earlier, sorry. So, why do you want to show what they entered, especially if it is so wrong? It seems satisfactory to represent the previously correct response. Still, if you need this, you could probably make use of ParameterAware and store that information somewhere where it can be accessed by your error display mechanism? I haven't used it before though, so just a thought. It might be applicable? I'm curious. If you are using ModelDriven, then why do you load your model in prepare()? Why not in getModel? I don't think behavior will be any different though since that interceptor is on the same side of the stack as prepare. - Eric From: "CRANFORD, CHRIS" To: "Struts Users Mailing List" Date: 05/19/2011 01:16 PM Subject: RE: Struts2 Validation w/ModelDriven Not that I am aware. The paramsPrepareParamsStack to my knowledge handles validation at the very end; so by the time validation has happened; the model has already been prepared by the prepare() method. -Original Message- From: Eric Lentz [mailto:eric.le...@sherwin.com] Sent: Thursday, May 19, 2011 11:58 AM To: Struts Users Mailing List Subject: Re: Struts2 Validation w/ModelDriven > So when this error condition is met and the user redirected back to the INPUT form; the > field where they had entered "xyz" is now the original default > initialized value. Can't you check the action error and not refresh the model when there is an error? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation w/ModelDriven
Generally speaking, I don't advocate for client-side data validation (javascript) since in most cases it's intended to be used instead of server side validation, which is a Bad Thing. In this case, however, perhaps some basic client-side validation would be appropriate, just to prevent the user from submitting data that is impossible to store in your model. Then you can let server validation check the appropriateness of the data according to business rules, etc. - Aaron On Thu, May 19, 2011 at 1:16 PM, CRANFORD, CHRIS wrote: > Not that I am aware. The paramsPrepareParamsStack to my knowledge > handles validation at the very end; so by the time validation has > happened; the model has already been prepared by the prepare() method. > > -Original Message- > From: Eric Lentz [mailto:eric.le...@sherwin.com] > Sent: Thursday, May 19, 2011 11:58 AM > To: Struts Users Mailing List > Subject: Re: Struts2 Validation w/ModelDriven > >> So when this error condition is met and the user redirected back to > the > INPUT form; the >> field where they had entered "xyz" is now the original default >> initialized value. > > Can't you check the action error and not refresh the model when there is > > an error? > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Aaron Brown : aa...@thebrownproject.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Struts2 Validation w/ModelDriven
Not that I am aware. The paramsPrepareParamsStack to my knowledge handles validation at the very end; so by the time validation has happened; the model has already been prepared by the prepare() method. -Original Message- From: Eric Lentz [mailto:eric.le...@sherwin.com] Sent: Thursday, May 19, 2011 11:58 AM To: Struts Users Mailing List Subject: Re: Struts2 Validation w/ModelDriven > So when this error condition is met and the user redirected back to the INPUT form; the > field where they had entered "xyz" is now the original default > initialized value. Can't you check the action error and not refresh the model when there is an error? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation w/ModelDriven
> So when this error condition is met and the user redirected back to the INPUT form; the > field where they had entered "xyz" is now the original default > initialized value. Can't you check the action error and not refresh the model when there is an error?
Struts2 Validation w/ModelDriven
When I implement the ModelDriven interface in my Struts2 actions; I follow your typical prepare() method as follows: public void prepare() throws Exception { if(id != null) { model = service.create(/* some parameters */); } else { model = service.lookupById(id); } } When a user first displays lets say the data-entry form; the create() method will query the system for data based on the arguments passed to the create() action call; pre-populate the model accordingly and then display the data entry form for the user. When the user hits the 'save' button to call the save() method; again the prepare() method is invoked, the model is re-initialized; the interceptor stack populates the model with the parameters from the form. If a field is defined as a Long and a user happened to enter "xyz" as the value in the form; then the default stack will add a field error for that field to the error maps because xyz cannot be converted to a Long; however, because validation happens after prepare(); the value in this field has be reset back to its initial value. So when this error condition is met and the user redirected back to the INPUT form; the field where they had entered "xyz" is now the original default initialized value. I am assuming there is no clean way to prevent this because ultimately you cannot store "xyz" in a field meant to hold a Long value for when the form is redrawn unless all fields are treated as Strings in the action and then copied/mapped to the domain object after validation fires. How are others coping with this? Do you just allow the field to either default back to null or restore its state back to the original initialized value when a user enters data into a field that triggers a conversion problem? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation on List of String data
> String[] names; >// OR > >ArrayList names; >} >i want to validate RequiredStringValidator validator on these names. I don't think the standard validations deal with arrays. Probably your best bet is to override validate() and validate on your own. See: http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/Validateable.html http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html (which implements those interfaces)
Struts2 validation on List of String data
How do i use any validation of struts on List of string inputs(instead of single String)? For an instance My action having name field as MyAction extends ... { String[] names; // OR ArrayList names; } i want to validate RequiredStringValidator validator on these names. -- View this message in context: http://struts.1045723.n5.nabble.com/Struts2-validation-on-List-of-String-data-tp4363039p4363039.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation
Thanks for the answer. I'm trying this, but it is not working properly eeei I have two numeric textfields any idea?? jake-65 wrote: > > You can use the fieldexpression validator. See > http://struts.apache.org/2.1.8.1/docs/fieldexpression-validator.html for > details. > > On Tue, Jul 13, 2010 at 05:39:52AM -0700, kisja wrote: >> >> I have two textfield and I would like to validate that at least one of >> both >> have data. >> How I can do? >> >> (I apologize for my bad English) >> >> Thanks >> -- >> View this message in context: >> http://old.nabble.com/Struts2-validation-tp29149892p29149892.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> 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 > > > -- View this message in context: http://old.nabble.com/Struts2-validation-tp29149892p29159311.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation
You can use the fieldexpression validator. See http://struts.apache.org/2.1.8.1/docs/fieldexpression-validator.html for details. On Tue, Jul 13, 2010 at 05:39:52AM -0700, kisja wrote: > > I have two textfield and I would like to validate that at least one of both > have data. > How I can do? > > (I apologize for my bad English) > > Thanks > -- > View this message in context: > http://old.nabble.com/Struts2-validation-tp29149892p29149892.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > 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
Struts2 validation
I have two textfield and I would like to validate that at least one of both have data. How I can do? (I apologize for my bad English) Thanks -- View this message in context: http://old.nabble.com/Struts2-validation-tp29149892p29149892.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
nested struts2 validation
Hi, I would like to do nested struts2 validation. I have two questions. 1) How do I specify the validation for the following field. Can some point me to some documenation for the expression validation. searchResults.{#this.resource.name.length() > 0}.{? #this == false }.size() <= 0 2) Can specify a particular method for an action class. e.g. SearchAction-search!update-validation.xml where search -- is the action alias and update -- is the method to execute in SearchAction Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
nested struts2 validation
Hi, I would like to do nested struts2 validation. I have two questions. 1) How do I specify the validation for the following field. Can some point me to some documenation for the expression validation. searchResults.{#this.resource.name.length() > 0}.{? #this == false }.size() <= 0 2) Can specify a particular method for an action class. e.g. SearchAction-search!update-validation.xml where search -- is the action alias and update -- is the method to execute in SearchAction Steve
Re: Struts2 validation problem
newton.dave wrote: > > zud wrote: >> 1) Is old errors is not getting cleared that means when the filed value >> is >> empty when i submit the form it shows required that is ok and agian when >> i >> submit with empty values again now it shows messages like >> filed is required >> filed is required > > Are you using Spring as your object factory? If so, make sure the > actions are declared as being prototype scope. > > Dave > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > thanks for the reply i am not using springs i am using struts 2.x can you please help me out -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137191.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
zud wrote: > > > > newton.dave wrote: >> >> zud wrote: >>> 1) Is old errors is not getting cleared that means when the filed value >>> is >>> empty when i submit the form it shows required that is ok and agian >>> when i >>> submit with empty values again now it shows messages like >>> filed is required >>> filed is required >> >> Are you using Spring as your object factory? If so, make sure the >> actions are declared as being prototype scope. >> >> Dave >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137167.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
zud wrote: > > > > newton.dave wrote: >> >> zud wrote: >>> 1) Is old errors is not getting cleared that means when the filed value >>> is >>> empty when i submit the form it shows required that is ok and agian >>> when i >>> submit with empty values again now it shows messages like >>> filed is required >>> filed is required >> >> Are you using Spring as your object factory? If so, make sure the >> actions are declared as being prototype scope. >> >> Dave >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137165.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
newton.dave wrote: > > zud wrote: >> 1) Is old errors is not getting cleared that means when the filed value >> is >> empty when i submit the form it shows required that is ok and agian when >> i >> submit with empty values again now it shows messages like >> filed is required >> filed is required > > Are you using Spring as your object factory? If so, make sure the > actions are declared as being prototype scope. > > Dave > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137164.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
zud wrote: 1) Is old errors is not getting cleared that means when the filed value is empty when i submit the form it shows required that is ok and agian when i submit with empty values again now it shows messages like filed is required filed is required Are you using Spring as your object factory? If so, make sure the actions are declared as being prototype scope. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 validation problem
hi iam new to struts 2 i had made a simple application in which i added validtion to registration form i used validtion.xml the validtion is showing un desired way there are two problem 1) Is old errors is not getting cleared that means when the filed value is empty when i submit the form it shows required that is ok and agian when i submit with empty values again now it shows messages like filed is required filed is required 2) Is only few fields get validated at once example only first two fields validation and the next time when i give these two values and left the remaining fields empty then its gets validated but the error message is displayed 5 times how to make validations work properly i am not using any theme for my form any help will be appreciated greatly and thanks in advance -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28042625.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation with Spring convention plugin
following error. >>> >> >>> >> org.springframework.beans.factory.BeanCreationException: Error >>> creating >>> >> bean >>> >> with name 'scopedTarget.pmaction': Scope 'request' is not active for >>> the >>> >> current thread; consider defining a scoped proxy for this bean if you >>> >> intend >>> >> to refer to it from a singleton; nested exception is >>> >> java.lang.IllegalStateException: No thread-bound request found: Are >>> you >>> >> referring to request attributes outside of an actual web request, or >>> >> processing a request outside of the originally receiving thread? If >>> you >>> >> are >>> >> actually operating within a web request and still receive this >>> message, >>> >> your >>> >> code is probably running outside of >>> DispatcherServlet/DispatcherPortlet: >>> >> In >>> >> this case, use RequestContextListener or RequestContextFilter to >>> expose >>> >> the >>> >> current request. >>> >> >>> >> >>> >> So if you have list box in jsp page and need to do validation on that >>> jsp >>> >> page. ANd you configured all your action classes in Spring appContext >>> >> file. >>> >> You wont succeed. >>> >> >>> >> Is that correct. Or is there any solution. >>> >> >>> >> Thanks and Regards >>> >> RS >>> >> -- >>> >> View this message in context: >>> >> >>> http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html >>> >> Sent from the Struts - User mailing list archive at Nabble.com. >>> >> >>> >> >>> >> - >>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> >> For additional commands, e-mail: user-h...@struts.apache.org >>> >> >>> >> >>> > >>> > >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.html >>> Sent from the Struts - User mailing list archive at Nabble.com. >>> >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27326468.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation with Spring convention plugin
Flow in my project works like this. When user request one web page, action method searchPm will execute. This calls populatePm method in service call. Then it will call some dao methods. I have JavaBean as a property in action class. This java bean get populated in service(dao) and return from the service class to action class. The same JavaBean got the List property which is populated in service class. The above is my flow. But I have another doubt. I think I didn't understand struts properly. If validation fails, does it calls the action method or just execute method. I think it shouldn't call any of those, because while editing the form assume you have changed some form values. And submit the form but validation fails and you will see the same form with error messages and changed values as well not the old values. Is that right. Correct me if i am wrong. Thanks and Regards rs. Brian Thompson-5 wrote: > > I'm guessing that you have something like > > this.myList = populateList(); > > inside your execute() method. When validation fails, it just sends you > back > to the jsp without redoing execute(), so of course the list will be null. > > -Brian > > > > On Tue, Jan 26, 2010 at 10:26 AM, nani2ratna wrote: > >> >> Hi Brian, >> I have seen that interface. >> If I got more than one action method in one action class. >> Then when ever you execute/call method(action) in that action class, >> this prepare method will be called and this setting of list will be >> executed. >> >> But My main question why the list setting to null value. >> Isn't it a big, can't we fix it. >> >> And in my company i fought with everybody to bring struts2 into project. >> And now i don't have any answer to this, untill any guys help me. >> >> Thanks >> RS >> >> >> >> Brian Thompson-5 wrote: >> > >> > You might look into using the Preparable interface [1]. It's useful >> for >> > these types of situations; just add the code to generate the list into >> a >> > prepare() method on your action class instead of in execute(). >> > >> > Hope this helps, >> > >> > -Brian >> > >> > [1] - >> > >> http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html >> > >> > >> > >> > On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna >> wrote: >> > >> >> >> >> Hi, >> >> >> >> I am using struts2, spring with spring convention plugin. >> >> SO all my action classes has been specified in >> application-Context.xml. >> >> One of my action class got Bean as a property. So I can dealt with the >> >> bean >> >> properties in JSP. >> >> >> >> The problem, when I am working with my validation i am getting Error >> >> messages repeated problem. >> >> Solution for this one is change scope to prototype. >> >> >> >> Now I got another problem, I got a list box in jsp page. If validation >> >> fails >> >> I am getting the following error. >> >> could not be resolved as a collection/array/map/enumeration/iterator >> type >> >> >> >> This is happening because, list in Javabean becoming null when >> validation >> >> fails. >> >> >> >> Then i changed scope="request". And i have added cglib.jar. >> >> Now i am getting following error. >> >> >> >> org.springframework.beans.factory.BeanCreationException: Error >> creating >> >> bean >> >> with name 'scopedTarget.pmaction': Scope 'request' is not active for >> the >> >> current thread; consider defining a scoped proxy for this bean if you >> >> intend >> >> to refer to it from a singleton; nested exception is >> >> java.lang.IllegalStateException: No thread-bound request found: Are >> you >> >> referring to request attributes outside of an actual web request, or >> >> processing a request outside of the originally receiving thread? If >> you >> >> are >> >> actually operating within a web request and still receive this >> message, >> >> your >> >> code is probably running outside of >> DispatcherServlet/DispatcherPortlet: >> >> In >> >> this case, use RequestContextListener or RequestContextFilter to >> expose >> >> the >> >> current request. >>
Re: Struts2 Validation with Spring convention plugin
I'm guessing that you have something like this.myList = populateList(); inside your execute() method. When validation fails, it just sends you back to the jsp without redoing execute(), so of course the list will be null. -Brian On Tue, Jan 26, 2010 at 10:26 AM, nani2ratna wrote: > > Hi Brian, > I have seen that interface. > If I got more than one action method in one action class. > Then when ever you execute/call method(action) in that action class, > this prepare method will be called and this setting of list will be > executed. > > But My main question why the list setting to null value. > Isn't it a big, can't we fix it. > > And in my company i fought with everybody to bring struts2 into project. > And now i don't have any answer to this, untill any guys help me. > > Thanks > RS > > > > Brian Thompson-5 wrote: > > > > You might look into using the Preparable interface [1]. It's useful for > > these types of situations; just add the code to generate the list into a > > prepare() method on your action class instead of in execute(). > > > > Hope this helps, > > > > -Brian > > > > [1] - > > > http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html > > > > > > > > On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna > wrote: > > > >> > >> Hi, > >> > >> I am using struts2, spring with spring convention plugin. > >> SO all my action classes has been specified in application-Context.xml. > >> One of my action class got Bean as a property. So I can dealt with the > >> bean > >> properties in JSP. > >> > >> The problem, when I am working with my validation i am getting Error > >> messages repeated problem. > >> Solution for this one is change scope to prototype. > >> > >> Now I got another problem, I got a list box in jsp page. If validation > >> fails > >> I am getting the following error. > >> could not be resolved as a collection/array/map/enumeration/iterator > type > >> > >> This is happening because, list in Javabean becoming null when > validation > >> fails. > >> > >> Then i changed scope="request". And i have added cglib.jar. > >> Now i am getting following error. > >> > >> org.springframework.beans.factory.BeanCreationException: Error creating > >> bean > >> with name 'scopedTarget.pmaction': Scope 'request' is not active for the > >> current thread; consider defining a scoped proxy for this bean if you > >> intend > >> to refer to it from a singleton; nested exception is > >> java.lang.IllegalStateException: No thread-bound request found: Are you > >> referring to request attributes outside of an actual web request, or > >> processing a request outside of the originally receiving thread? If you > >> are > >> actually operating within a web request and still receive this message, > >> your > >> code is probably running outside of DispatcherServlet/DispatcherPortlet: > >> In > >> this case, use RequestContextListener or RequestContextFilter to expose > >> the > >> current request. > >> > >> > >> So if you have list box in jsp page and need to do validation on that > jsp > >> page. ANd you configured all your action classes in Spring appContext > >> file. > >> You wont succeed. > >> > >> Is that correct. Or is there any solution. > >> > >> Thanks and Regards > >> RS > >> -- > >> View this message in context: > >> > http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html > >> Sent from the Struts - User mailing list archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> For additional commands, e-mail: user-h...@struts.apache.org > >> > >> > > > > > > -- > View this message in context: > http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: Struts2 Validation with Spring convention plugin
Hi Brian, I have seen that interface. If I got more than one action method in one action class. Then when ever you execute/call method(action) in that action class, this prepare method will be called and this setting of list will be executed. But My main question why the list setting to null value. Isn't it a big, can't we fix it. And in my company i fought with everybody to bring struts2 into project. And now i don't have any answer to this, untill any guys help me. Thanks RS Brian Thompson-5 wrote: > > You might look into using the Preparable interface [1]. It's useful for > these types of situations; just add the code to generate the list into a > prepare() method on your action class instead of in execute(). > > Hope this helps, > > -Brian > > [1] - > http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html > > > > On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna wrote: > >> >> Hi, >> >> I am using struts2, spring with spring convention plugin. >> SO all my action classes has been specified in application-Context.xml. >> One of my action class got Bean as a property. So I can dealt with the >> bean >> properties in JSP. >> >> The problem, when I am working with my validation i am getting Error >> messages repeated problem. >> Solution for this one is change scope to prototype. >> >> Now I got another problem, I got a list box in jsp page. If validation >> fails >> I am getting the following error. >> could not be resolved as a collection/array/map/enumeration/iterator type >> >> This is happening because, list in Javabean becoming null when validation >> fails. >> >> Then i changed scope="request". And i have added cglib.jar. >> Now i am getting following error. >> >> org.springframework.beans.factory.BeanCreationException: Error creating >> bean >> with name 'scopedTarget.pmaction': Scope 'request' is not active for the >> current thread; consider defining a scoped proxy for this bean if you >> intend >> to refer to it from a singleton; nested exception is >> java.lang.IllegalStateException: No thread-bound request found: Are you >> referring to request attributes outside of an actual web request, or >> processing a request outside of the originally receiving thread? If you >> are >> actually operating within a web request and still receive this message, >> your >> code is probably running outside of DispatcherServlet/DispatcherPortlet: >> In >> this case, use RequestContextListener or RequestContextFilter to expose >> the >> current request. >> >> >> So if you have list box in jsp page and need to do validation on that jsp >> page. ANd you configured all your action classes in Spring appContext >> file. >> You wont succeed. >> >> Is that correct. Or is there any solution. >> >> Thanks and Regards >> RS >> -- >> View this message in context: >> http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > -- View this message in context: http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation with Spring convention plugin
You might look into using the Preparable interface [1]. It's useful for these types of situations; just add the code to generate the list into a prepare() method on your action class instead of in execute(). Hope this helps, -Brian [1] - http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna wrote: > > Hi, > > I am using struts2, spring with spring convention plugin. > SO all my action classes has been specified in application-Context.xml. > One of my action class got Bean as a property. So I can dealt with the bean > properties in JSP. > > The problem, when I am working with my validation i am getting Error > messages repeated problem. > Solution for this one is change scope to prototype. > > Now I got another problem, I got a list box in jsp page. If validation > fails > I am getting the following error. > could not be resolved as a collection/array/map/enumeration/iterator type > > This is happening because, list in Javabean becoming null when validation > fails. > > Then i changed scope="request". And i have added cglib.jar. > Now i am getting following error. > > org.springframework.beans.factory.BeanCreationException: Error creating > bean > with name 'scopedTarget.pmaction': Scope 'request' is not active for the > current thread; consider defining a scoped proxy for this bean if you > intend > to refer to it from a singleton; nested exception is > java.lang.IllegalStateException: No thread-bound request found: Are you > referring to request attributes outside of an actual web request, or > processing a request outside of the originally receiving thread? If you are > actually operating within a web request and still receive this message, > your > code is probably running outside of DispatcherServlet/DispatcherPortlet: In > this case, use RequestContextListener or RequestContextFilter to expose the > current request. > > > So if you have list box in jsp page and need to do validation on that jsp > page. ANd you configured all your action classes in Spring appContext file. > You wont succeed. > > Is that correct. Or is there any solution. > > Thanks and Regards > RS > -- > View this message in context: > http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Struts2 Validation with Spring convention plugin
Hi, I am using struts2, spring with spring convention plugin. SO all my action classes has been specified in application-Context.xml. One of my action class got Bean as a property. So I can dealt with the bean properties in JSP. The problem, when I am working with my validation i am getting Error messages repeated problem. Solution for this one is change scope to prototype. Now I got another problem, I got a list box in jsp page. If validation fails I am getting the following error. could not be resolved as a collection/array/map/enumeration/iterator type This is happening because, list in Javabean becoming null when validation fails. Then i changed scope="request". And i have added cglib.jar. Now i am getting following error. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.pmaction': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. So if you have list box in jsp page and need to do validation on that jsp page. ANd you configured all your action classes in Spring appContext file. You wont succeed. Is that correct. Or is there any solution. Thanks and Regards RS -- View this message in context: http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation for only one method in action
you can use @SkipValidation -- View this message in context: http://old.nabble.com/struts2-validation-for-only-one-method-in-action-tp9082687p26572573.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Trouble with struts2 validation
vikrant S wrote: Initially I did not check for null textfield and I was able to validate the username and password directly from database.but When I applied validate method in my action class It began to validate for null fields but not for stored username and password. I am pasting my code.. Are you sure the validate() method you've written is doing what you think it is? If there are no field errors after the validate() method, the execute() action will run--that's just how it works. ResultSet results =sql.executeQuery("select * from my_table where usr = "+" '"+userid+"'"+" and pass = "+"'"+pwd+"'"); SQL injection: be wary here. if (results != null) Is this the appropriate check, or should you be checking for a length? Have you turned up the logging levels to get a handle on what's going on behind the scenes? Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Trouble with struts2 validation
What does your JSP look like? Also, I'm not sure I understand your question. What error message are you getting? -Brian On Thu, Nov 12, 2009 at 6:16 AM, vikrant S wrote: > > Hi all, > In my login application I want to validate whether the textfield for > Usename > and password is not null and also if some user enters some username say > "admin" and password as "admin" it should get logged in. For this I am > using > postgresql database and I have already stored username and password as > both > as "admin. Now the problem is my Login page is able to check whether the > textfield for Usename is Null or not but not able to validate with database > stored username and pasword. > Initially I did not check for null textfield and I was able to validate the > username and password directly from database.but When I applied validate > method in my action class It began to validate for null fields but not for > stored username and password. I am pasting my code.. > > > My Action class :- > package struts2demo.login.action; > import com.opensymphony.xwork2.ActionSupport; > import java.sql.*; > import java.text.*; > import java.io.*; > > > public class Login extends ActionSupport { >private String userid; >private String pwd; >Connection db; >Statement sql; >DatabaseMetaData dbmd; > >public Login() { > >} > > public void validate() { >if (getUserid().length() == 0) { >addFieldError("userid", "User Name is required"); > >} >if (getPwd().length() == 0) { >addFieldError("pwd","password isrequired"); >} >} > >public String execute() throws ClassNotFoundException,SQLException >{ > String database = "LOGIN"; > String username ="vikrant"; > String password ="vikrant"; > System.out.println("inside action class"); > > Class.forName("org.postgresql.Driver"); > db = > DriverManager.getConnection("jdbc:postgresql:"+database,username,password > ); > dbmd =db.getMetaData(); > System.out.println("Connection to "+dbmd.getDatabaseProductName()+" > " > +dbmd.getDatabaseProductVersion()+" successful \n"); > System.out.println("Connected to the database"); > sql=db.createStatement(); > > System.out.println("Now executing the command : " +"select * from > my_table"); > System.out.println("select * from my_table where usr = "+" > '"+userid+"'"+" > and pass = "+"'"+pwd+"'"); > ResultSet results =sql.executeQuery("select * from my_table where > usr = > "+" '"+userid+"'"+" and pass = "+"'"+pwd+"'"); > > if (results != null) > { >return SUCCESS; > } > else > return ERROR; > > } > > >public String getUserid() { >return userid; >} >public void setUserid(String userid) { >this.userid = userid; >} >public String getPwd() { >return pwd; >} >public void setPwd(String pwd) { > this.pwd = pwd; >} > > } > > And my struts.xml is as follows:- > > > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" >"http://struts.apache.org/dtds/struts-2.0.dtd";> > > > >success.jsp >/login.jsp >error.jsp > > > > > I am not able to understand that why the validation failed for database > when I applied validation for textfield.? > Could you please help me out of this..? > -- > View this message in context: > http://old.nabble.com/Trouble-with-struts2-validation-tp26316586p26316586.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Trouble with struts2 validation
Hi all, In my login application I want to validate whether the textfield for Usename and password is not null and also if some user enters some username say "admin" and password as "admin" it should get logged in. For this I am using postgresql database and I have already stored username and password as both as "admin. Now the problem is my Login page is able to check whether the textfield for Usename is Null or not but not able to validate with database stored username and pasword. Initially I did not check for null textfield and I was able to validate the username and password directly from database.but When I applied validate method in my action class It began to validate for null fields but not for stored username and password. I am pasting my code.. My Action class :- package struts2demo.login.action; import com.opensymphony.xwork2.ActionSupport; import java.sql.*; import java.text.*; import java.io.*; public class Login extends ActionSupport { private String userid; private String pwd; Connection db; Statement sql; DatabaseMetaData dbmd; public Login() { } public void validate() { if (getUserid().length() == 0) { addFieldError("userid", "User Name is required"); } if (getPwd().length() == 0) { addFieldError("pwd","password isrequired"); } } public String execute() throws ClassNotFoundException,SQLException { String database = "LOGIN"; String username ="vikrant"; String password ="vikrant"; System.out.println("inside action class"); Class.forName("org.postgresql.Driver"); db = DriverManager.getConnection("jdbc:postgresql:"+database,username,password ); dbmd =db.getMetaData(); System.out.println("Connection to "+dbmd.getDatabaseProductName()+" " +dbmd.getDatabaseProductVersion()+" successful \n"); System.out.println("Connected to the database"); sql=db.createStatement(); System.out.println("Now executing the command : " +"select * from my_table"); System.out.println("select * from my_table where usr = "+" '"+userid+"'"+" and pass = "+"'"+pwd+"'"); ResultSet results =sql.executeQuery("select * from my_table where usr = "+" '"+userid+"'"+" and pass = "+"'"+pwd+"'"); if (results != null) { return SUCCESS; } else return ERROR; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } } And my struts.xml is as follows:- http://struts.apache.org/dtds/struts-2.0.dtd";> success.jsp /login.jsp error.jsp I am not able to understand that why the validation failed for database when I applied validation for textfield.? Could you please help me out of this..? -- View this message in context: http://old.nabble.com/Trouble-with-struts2-validation-tp26316586p26316586.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Trouble with struts2 validation
-- View this message in context: http://old.nabble.com/Trouble-with-struts2-validation-tp26316069p26316069.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation Problem - validation errors not being cleared when corrected!
Hehe, I've just resolved my own issue! The problem was my spring configuration. I needed to specify scope="prototype" on each of my Struts 2 Action declarations. Singleton actions were being created and thus previous field errors were being carried over between requests. I'm surprised this isn't a more common gotcha that should be highlighted in the documentation. Rgds Murray 2009/10/23 Murray Furtado > Hi, > I'm using Struts 2.0.14 and validation annotations. I have a > UpdateUserAction class which implements ModelDriven and declares the > execute() method with the following : > > @Validations( visitorFields = { @VisitorFieldValidator(message="", > fieldName="model")} ) > > My model is a User class which has a number of @RequiredStringValidators, > etc. > > When I test the functionality I login to my app as a user with all it's > fields populated (ie a valid user). I then update a dropdown box in the > Update User jsp to the 'Select' value, to invalidate this property (declared > with a @RequiredStringValidator). Sure enough, when I submit the form, I > get a field error telling me this is a required field. So far so good. > > However when I then correct that field and resubmit, I still get the error! > I've added debug code to the prepare() method of the UpdateUserAction and > it shows that the previous field error is still present when I submit the > corrected form. This is strange because my understanding is that field > errors should get cleared between requests, and the validation framework > shouldn't fire until after the prepare() method has fired. So why am I > seeing validation errors in the prepare method? And why aren't they > clearing? > > What's even more frustrating is that I've downloaded the source code for > the xworks 2.0.7 package, and attached as source in Eclipse Galileo, but > then I can't set breakpoints in any of the xwork codebase to step through, > as each time I try and open an xwork java file, it takes me to the .class > file instead. > > Can anyone shed light on my problems as I can't see what I'm doing wrong? > > Thanks in advance, > > Murray > > >
Struts2 Validation Problem - validation errors not being cleared when corrected!
Hi, I'm using Struts 2.0.14 and validation annotations. I have a UpdateUserAction class which implements ModelDriven and declares the execute() method with the following : @Validations( visitorFields = { @VisitorFieldValidator(message="", fieldName="model")} ) My model is a User class which has a number of @RequiredStringValidators, etc. When I test the functionality I login to my app as a user with all it's fields populated (ie a valid user). I then update a dropdown box in the Update User jsp to the 'Select' value, to invalidate this property (declared with a @RequiredStringValidator). Sure enough, when I submit the form, I get a field error telling me this is a required field. So far so good. However when I then correct that field and resubmit, I still get the error! I've added debug code to the prepare() method of the UpdateUserAction and it shows that the previous field error is still present when I submit the corrected form. This is strange because my understanding is that field errors should get cleared between requests, and the validation framework shouldn't fire until after the prepare() method has fired. So why am I seeing validation errors in the prepare method? And why aren't they clearing? What's even more frustrating is that I've downloaded the source code for the xworks 2.0.7 package, and attached as source in Eclipse Galileo, but then I can't set breakpoints in any of the xwork codebase to step through, as each time I try and open an xwork java file, it takes me to the .class file instead. Can anyone shed light on my problems as I can't see what I'm doing wrong? Thanks in advance, Murray
help getting struts2 validation to work using java 1.6
Hi Any workaround on validation of struts2 to work using java1.6 ? Seems to work using java 1.5.. version : struts2-core-2.0.11.2 Getting Error 500 in page java.lang.ExceptionInInitializerError at com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(ValidatorFileParser.java:192) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorConfigs(ValidatorFileParser.java:72) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:361) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildClassValidatorConfigs(AnnotationActionValidatorManager.java:252) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:340) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:138) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:113) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:100) at com.opensymphony.xwork2.validator.ValidationInterceptor.doBeforeInvocation(ValidationInterceptor.java:142) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:148) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:186) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:268) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74) at
Re: Struts2 - validation
This question gets asked about once a week on this list ;) http://struts.apache.org/2.1.6/docs/how-do-we-repopulate-controls-when-validation-fails.html On Wed, Jun 24, 2009 at 9:07 AM, Kishan G. Chellap Paandy < kishanchellapaand...@spanservices.com> wrote: > Hi Folks, > > I'm populating a list in my action class, which will be used in the JSP for > populating a tag. > > Now, I'm submitting the form, where I'm doing validation (server side > validation) thru validation.xml. And this throws some action/field errors > and the same JSP page is rendered again with the errors. But, the list to > populate tag is empty/lost. How I can retain it? > > Storing in session is not an option for me. And if redirect/redirectAction > the action/field errors are lost. > > Please advice. > > Thank you. > Regards, > Kishan.G > > Team Leader. > www.spansystems.com > > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Struts2 - validation
Hi Folks, I'm populating a list in my action class, which will be used in the JSP for populating a tag. Now, I'm submitting the form, where I'm doing validation (server side validation) thru validation.xml. And this throws some action/field errors and the same JSP page is rendered again with the errors. But, the list to populate tag is empty/lost. How I can retain it? Storing in session is not an option for me. And if redirect/redirectAction the action/field errors are lost. Please advice. Thank you. Regards, Kishan.G Team Leader. www.spansystems.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 Validation Annotations - Message with params
Hi all! I have my validation: @RequiredStringValidator(key="erro.required") And in my package.properties: erro.required={0} is required How can i use this param ??? I tried: @RequiredStringValidator(message="%{getText('erro.required', new String[] {'Login'})}") But it's not working. Thanks! -- View this message in context: http://www.nabble.com/Struts2-Validation-Annotations---Message-with-params-tp24167311p24167311.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation not working with theme simple
Bhaarat Sharma wrote: thanks dave! worked fine. I was trying too many things so got confused. I have one further question regarding validation. Is it possible to validate a text field only when certain strings are selected from the multiple drop down box. Basically I want to make the text feild required only when some strings are selected from the multiple drop down box, which is in the same form as the text field. Can this be done via struts2 validation or do I have to write a custom validator for this? I'd expect it could be handled with an expression validator; whether or not this is the cleanest solution is arguable. Once validation gets more complicated than a single expression or two doing it in Java may end up being easier to understand and maintain. There's no reason declarative and programmatic validation can't be combined. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation not working with theme simple
thanks dave! worked fine. I was trying too many things so got confused. I have one further question regarding validation. Is it possible to validate a text field only when certain strings are selected from the multiple drop down box. Basically I want to make the text feild required only when some strings are selected from the multiple drop down box, which is in the same form as the text field. Can this be done via struts2 validation or do I have to write a custom validator for this? Thanks! On 4/19/09, Dave Newton wrote: > Bhaarat Sharma wrote: >> by the way. I can do without having errors right beside the textfield. >> I can have them grouped up top > > Are you saying the tag doesn't render field errors in > the "simple" theme? The template file sure makes it look like it does. > > Dave > > > - > 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: Struts2 Validation not working with theme simple
Bhaarat Sharma wrote: by the way. I can do without having errors right beside the textfield. I can have them grouped up top Are you saying the tag doesn't render field errors in the "simple" theme? The template file sure makes it look like it does. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation not working with theme simple
Bhaarat Sharma wrote: At this time I cant afford to change the theme of the site. Because that breaks the html on a lot of pages and would require a lot of effort to correct those pages. Changing to show field error messages by hand would most likely entail significantly more work. show field error messages by hand (if you want the messages near the fields), how can i do this? do you mean, by using field validators like on this link? http://struts.apache.org/2.x/docs/using-field-validators.htmls How are you doing validation now? In any case, I meant showing field error messages by hand by checking the field errors map for specific field names, in the HTML/JSP, instead of having it done by the theme. Seriously--consider modifying the simple theme (creating your own theme based on the simple theme) and adding the error message bits of one of the themes that includes them. Otherwise you'll be adding either a chunk of JSP to check for field errors, using a custom tag to encapsulate it somehow, or something fairly similar. How is it that the project got so far along that changing the theme is too much work and nobody noticed that validation messages weren't being displayed? Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation not working with theme simple
by the way. I can do without having errors right beside the textfield. I can have them grouped up top On 4/19/09, Bhaarat Sharma wrote: > Stop using the "simple" theme. > > The "simple" theme tags don't display error messages--they're simple. > You'll either need to switch themes, show field error messages by hand > (if you want the messages near the fields), or modify/extend/create a > theme to emit the HTML you want. > > At this time I cant afford to change the theme of the site. Because > that breaks the html on a lot of pages and would require a lot of > effort to correct those pages. > >>show field error messages by hand (if you want the messages near the >> fields), > > how can i do this? do you mean, by using field validators like on this > link? http://struts.apache.org/2.x/docs/using-field-validators.htmls > > Appreciate your help > > > On 4/19/09, Dave Newton wrote: >> Bhaarat Sharma wrote: >>> However, If i have the following line in my struts.properties then the >>> validation stops happening and I do not see any errors. >>> struts.ui.theme=simple >> >> Technically, the validation does not stop happening. >> >>> Has someone seen something like this before? >> >> Yes, anybody using the "simple" theme. >> >>> what is the best way to resolve this?? >> >> Stop using the "simple" theme. >> >> The "simple" theme tags don't display error messages--they're simple. >> You'll either need to switch themes, show field error messages by hand >> (if you want the messages near the fields), or modify/extend/create a >> theme to emit the HTML you want. >> >> Dave >> >> >> - >> 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: Struts2 Validation not working with theme simple
Stop using the "simple" theme. The "simple" theme tags don't display error messages--they're simple. You'll either need to switch themes, show field error messages by hand (if you want the messages near the fields), or modify/extend/create a theme to emit the HTML you want. At this time I cant afford to change the theme of the site. Because that breaks the html on a lot of pages and would require a lot of effort to correct those pages. >show field error messages by hand (if you want the messages near the fields), how can i do this? do you mean, by using field validators like on this link? http://struts.apache.org/2.x/docs/using-field-validators.htmls Appreciate your help On 4/19/09, Dave Newton wrote: > Bhaarat Sharma wrote: >> However, If i have the following line in my struts.properties then the >> validation stops happening and I do not see any errors. >> struts.ui.theme=simple > > Technically, the validation does not stop happening. > >> Has someone seen something like this before? > > Yes, anybody using the "simple" theme. > >> what is the best way to resolve this?? > > Stop using the "simple" theme. > > The "simple" theme tags don't display error messages--they're simple. > You'll either need to switch themes, show field error messages by hand > (if you want the messages near the fields), or modify/extend/create a > theme to emit the HTML you want. > > Dave > > > - > 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: Struts2 Validation not working with theme simple
Bhaarat Sharma wrote: However, If i have the following line in my struts.properties then the validation stops happening and I do not see any errors. struts.ui.theme=simple Technically, the validation does not stop happening. Has someone seen something like this before? Yes, anybody using the "simple" theme. what is the best way to resolve this?? Stop using the "simple" theme. The "simple" theme tags don't display error messages--they're simple. You'll either need to switch themes, show field error messages by hand (if you want the messages near the fields), or modify/extend/create a theme to emit the HTML you want. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 Validation not working with theme simple
I have a very weird error. I am trying to do a very simple basic validation like this example: http://struts.apache.org/2.x/docs/basic-validation.html However, If i have the following line in my struts.properties then the validation stops happening and I do not see any errors. struts.ui.theme=simple I spent a very long time in researching which line in my struts.properties file is causing this error. Has someone seen something like this before? what is the best way to resolve this?? Thanks! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation
sorry but i can't. this is my code jsp: and this is the image http://www.nabble.com/file/p22089792/Image.jpg i don't want the message; please help me -- View this message in context: http://www.nabble.com/struts2-validation-tp22068251p22089792.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation
2009/2/18 PEGASUS84 : > but in this way i'cant se the labels of the form; You can use s:label tag [1] > Can i override theme simple and remove only errorMessage? Yes you can, take a look on [2] and [3] [1] http://struts.apache.org/2.1.6/docs/label.html [2] http://struts.apache.org/2.1.6/docs/extending-themes.html [3] http://www.vitarara.org/cms/struts_2_cookbook/creating_a_theme Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation
thanks, but in this way i'cant se the labels of the form; Can i override theme simple and remove only errorMessage? -- View this message in context: http://www.nabble.com/struts2-validation-tp22068251p22087958.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation
Use theme simple [1] and add what tags you want [1] http://struts.apache.org/2.1.2/docs/themes-and-templates.html Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation
thanks for your answer i've removed the conversion error interceptor but the same message apper in my jsp page; if i see the html code i see with the message invalide field value... is there a way for remove this td? -- View this message in context: http://www.nabble.com/struts2-validation-tp22068251p22082549.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation
2009/2/17 PEGASUS84 : > Does someone knows how to hide the error message which cames from the action > with name=input? > i don't want to view this message Invalid field value... I thing you're talking about conversion errors, if so remove Conversion Error Interceptor [1] from your stack [1] http://struts.apache.org/2.1.6/docs/conversion-error-interceptor.html Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts2 validation help please
sorry I want delete or change the error message from an action input please help me but in my function validate() there isn't addfielderror. i think that i can change the return in function validate: can i change input in error? i'm sorry for my english but i'm an italian user. -- View this message in context: http://www.nabble.com/struts2-validation-help-please-tp22068361p22068361.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts2 validation
good evening; Does someone knows how to hide the error message which cames from the action with name=input? i don't want to view this message Invalid field value... -- View this message in context: http://www.nabble.com/struts2-validation-tp22068251p22068251.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2 validation failed method
The quick answer: in the default configuration, when the validation fails the result INPUT ("input") is returned. You frequently define a mapping for this action and result in your struts.xml which renders the "original" jsp (the input) so that the user can see the errors (eg: ) and reenter the data. Hernán J. González http://hjg.com.ar/ On Mon, Nov 3, 2008 at 7:59 AM, Harden ZHU <[EMAIL PROTECTED]> wrote: > Hi, > > I have Basic Validation. If validation failed, which method struts2 is > calling? Can I define some method like in struts1 input? > > Thanks > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 validation failed method
Hi! If you look at the relationship between the ValidationInterceptor [1] and the WorkflowInterceptor [2], you should be able to figure it out. [1] - http://struts.apache.org/2.0.12/docs/validation-interceptor.html [2] - http://struts.apache.org/2.0.12/docs/workflow-interceptor.html Nils-H On Mon, Nov 3, 2008 at 10:59 AM, Harden ZHU <[EMAIL PROTECTED]> wrote: > Hi, > > I have Basic Validation. If validation failed, which method struts2 is > calling? Can I define some method like in struts1 input? > > Thanks > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts2 validation failed method
Hi, I have Basic Validation. If validation failed, which method struts2 is calling? Can I define some method like in struts1 input? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 validation with portlet
The source for the example portlet app is here: http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_0_11_2/apps/portlet/ On Tue, Oct 21, 2008 at 5:46 PM, bakann <[EMAIL PROTECTED]> wrote: > > Did you find an example ? > I think it is not working. > > > devsahu wrote: >> >> Hi, >> >> Does stuts2 support its validation feature with portlet. >> Any help is highly appreciated. >> >> Thanks, >> Sabyasachi >> > > -- > View this message in context: > http://www.nabble.com/Struts2-validation-with-portlet-tp11445797p20093267.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > 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: Struts2 validation with portlet
Am Dienstag, 21. Oktober 2008 17:46:41 schrieb bakann: > Did you find an example ? > I think it is not working. It is working. I am using 2.0.11.2 with portlets. I am using some field validators and configured validators.xml and my *.xml for the actions and validation triggers fine. -- Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge. Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." -- Linus Torvalds smime.p7s Description: S/MIME cryptographic signature
Re: Struts2 validation with portlet
Did you find an example ? I think it is not working. devsahu wrote: > > Hi, > > Does stuts2 support its validation feature with portlet. > Any help is highly appreciated. > > Thanks, > Sabyasachi > -- View this message in context: http://www.nabble.com/Struts2-validation-with-portlet-tp11445797p20093267.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2 validation
Hi all, converting big S1 application and run into this problem. Even though form is being validated in S1 version by validator.xml there is an user field which was validated on focus lost by asynch call using Ajax - to find found if by user chosen user name is still available. Call is then intercepted and handled in S1 ACTION with following construct if (nameTaken) { msg = new ActionMessage(NAME_TAKEN); error = addMsgErrors(error,Constants.NAME_ERROR, msg); this.addErrors(request, error); return mapping.getInputForward(); }. My question is - provided asynch check must stay - how to handle this in S2 - or what is best practice to handle such a case - to create validation error programmatically? Thanks, Peter
Re: struts2 validation, tiles definition in input result type, problem!
Do you use xml based validation? If so, name the xml files correctly according to the name of actions, read [1], section Defining Validation Rules ProjectStatusAction-ProjectStatus_updateAddPage-validation.xml [1] http://struts.apache.org/2.1.2/docs/validation.html Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 validation, tiles definition in input result type, problem!
Sorry i amde a typo in the previous mail, ProjectStatus-validation,xml should be replaced with ProjectStatusAction-validation,xml 2008/7/25 Halil Ağın <[EMAIL PROTECTED]>: > Hello Dave; > > Yes you are right, There is no "ProjectStatus" action defined. > Now, i change the form action definition to > > .. > > and it is ok. validation works, but there is still a problem, > > When i request the > http://localhost:8080/TVQ/ProjectStatus_showAddPage.action (showAddPage > function is defined in ProjectStatus action class) > > it shows the AddPage.jsp (which is expected), but it shows all the > validation messages at first page load which is not expected. > > The correct scenario is that it should show the validation messages after i > press the add button. > > > Here is my jsp content and struts.xml content, respectively (I do not > include tiles definition, they works, morover, they are not needed to > analyze this problem, i think :) ) > > There is also a validation file named ProjectStatus-validation,xml in the > directory where ProjectStatusAction.java resides in. > > ===start:AddPage.jsp= > > > > > > > > > > > > > > ===end :AddPage = > > > > ===start:struts.xml= > > class="tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction" > method="{1}" > > > tvq.projectstatus.{1} > >tvq.projectstatus.{1} > type="redirect">/ProjectStatus_list.action > > > ===end :struts.xml = > > > > > > > Regards, > > > -Halil AGIN > > > > On Thu, Jul 24, 2008 at 6:22 PM, Dave Newton <[EMAIL PROTECTED]> > wrote: > >> Your action is submitting to "ProjectStatus"; is that action defined? >> >> Dave >> >> >> --- On Thu, 7/24/08, Halil Ağın <[EMAIL PROTECTED]> wrote: >> >> > From: Halil Ağın <[EMAIL PROTECTED]> >> > Subject: struts2 validation, tiles definition in input result type, >> problem! >> > To: user@struts.apache.org >> > Date: Thursday, July 24, 2008, 10:58 AM >> > Hello List; >> > >> > I am trying to implement validation in struts2. >> > >> > My action is as follow: >> > >> > > > >> > >> class="tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction" >> > method="{1}" > >> > >> > > > type="tiles" >> > >tvq.projectstatus.{1} >> > > > type="tiles" >> > >tvq.projectstatus.{1} >> > > > type="tiles">tvq.projectstatus.{1} >> > >> > > > type="redirect">/ProjectStatus_list.action >> > >> > >> > >> > >> > Since when validation process returns false, i want struts >> > to show the same >> > page. I search the web, and saw some solution like above. >> > But, when i try to >> > implement, i could not succeed. >> > >> > Here are my tiles definitions: >> > >> > > > name="tvq.projectstatus.showAddPage" >> > extends="tvq.template.default"> >> > > > value="Add A Project Status" /> >> > > > value="/jsp/projectstatus/AddPage.jsp" >> > /> >> > >> > >> > > > name="tvq.projectstatus.ListPage" >> > extends="tvq.template.default"> >> > > > value="Add A Project Status" /> >> > > > value="/jsp/projectstatus/ListPage.jsp" /> >> > >> > >> > > > extends="tvq.template.default"> >> > > > value="Add A Project Status" /> >> > > > value="/jsp/projectstatus/ListPage.jsp" /> >> > >> > >> > >> > >> > I call the page ass follows : >> > http://localhost:8080/TVQ/ProjectStatus_showAddPage.action >> > >> > (the ProjectStatusAction.java has showAddPage, list, and >> > add functions and >> > these functions returns the correct strings.) >> > >> > >> > Then, struts looks the action definition and it finds >> > showAddPage function >> >
Re: struts2 validation, tiles definition in input result type, problem!
Hello Dave; Yes you are right, There is no "ProjectStatus" action defined. Now, i change the form action definition to http://localhost:8080/TVQ/ProjectStatus_showAddPage.action (showAddPage function is defined in ProjectStatus action class) it shows the AddPage.jsp (which is expected), but it shows all the validation messages at first page load which is not expected. The correct scenario is that it should show the validation messages after i press the add button. Here is my jsp content and struts.xml content, respectively (I do not include tiles definition, they works, morover, they are not needed to analyze this problem, i think :) ) There is also a validation file named ProjectStatus-validation,xml in the directory where ProjectStatusAction.java resides in. ===start:AddPage.jsp= ===end :AddPage = ===start:struts.xml= tvq.projectstatus.{1} tvq.projectstatus.{1} /ProjectStatus_list.action ===end :struts.xml = Regards, -Halil AGIN On Thu, Jul 24, 2008 at 6:22 PM, Dave Newton <[EMAIL PROTECTED]> wrote: > Your action is submitting to "ProjectStatus"; is that action defined? > > Dave > > > --- On Thu, 7/24/08, Halil Ağın <[EMAIL PROTECTED]> wrote: > > > From: Halil Ağın <[EMAIL PROTECTED]> > > Subject: struts2 validation, tiles definition in input result type, > problem! > > To: user@struts.apache.org > > Date: Thursday, July 24, 2008, 10:58 AM > > Hello List; > > > > I am trying to implement validation in struts2. > > > > My action is as follow: > > > > > > > class="tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction" > > method="{1}" > > > > > > type="tiles" > > >tvq.projectstatus.{1} > > > type="tiles" > > >tvq.projectstatus.{1} > > > type="tiles">tvq.projectstatus.{1} > > > > > type="redirect">/ProjectStatus_list.action > > > > > > > > > > Since when validation process returns false, i want struts > > to show the same > > page. I search the web, and saw some solution like above. > > But, when i try to > > implement, i could not succeed. > > > > Here are my tiles definitions: > > > > > name="tvq.projectstatus.showAddPage" > > extends="tvq.template.default"> > > > value="Add A Project Status" /> > > > value="/jsp/projectstatus/AddPage.jsp" > > /> > > > > > > > name="tvq.projectstatus.ListPage" > > extends="tvq.template.default"> > > > value="Add A Project Status" /> > > > value="/jsp/projectstatus/ListPage.jsp" /> > > > > > > > extends="tvq.template.default"> > > > value="Add A Project Status" /> > > > value="/jsp/projectstatus/ListPage.jsp" /> > > > > > > > > > > I call the page ass follows : > > http://localhost:8080/TVQ/ProjectStatus_showAddPage.action > > > > (the ProjectStatusAction.java has showAddPage, list, and > > add functions and > > these functions returns the correct strings.) > > > > > > Then, struts looks the action definition and it finds > > showAddPage function > > in ProjectStatus. > > > > In result list, there is tvq.projectstatus.showAddPage, and > > i have this > > definition in my tiles.xml. > > > > Therefore, it shows the page. The problem occures after i > > press the add > > button in tvq.projectstatus.showAddPage. > > > > here is the content of the > > tvq.projectstatus.showAddPage(meanly,/jsp/projectstatus/AddPage.jsp) > > > > > > > > > > > validate="true" > > > > > > > > > > > > > > > > > > method="add" value="Add" > > /> > > > > > > > > > > > > > > > > And i have a required field validator on a field in my > > form(this field is > > listed in AddUpdateTemplate.jsp) > > > > > > ProjectStatus action has add function which returns the > > "ADDSUCCEED" string > > on success. > > > > > > When i press the add button without filling the req
Re: struts2 validation, tiles definition in input result type, problem!
Your action is submitting to "ProjectStatus"; is that action defined? Dave --- On Thu, 7/24/08, Halil Ağın <[EMAIL PROTECTED]> wrote: > From: Halil Ağın <[EMAIL PROTECTED]> > Subject: struts2 validation, tiles definition in input result type, problem! > To: user@struts.apache.org > Date: Thursday, July 24, 2008, 10:58 AM > Hello List; > > I am trying to implement validation in struts2. > > My action is as follow: > > > class="tr.com.portakalteknoloji.action.projectstatus.ProjectStatusAction" > method="{1}" > > > type="tiles" > >tvq.projectstatus.{1} > type="tiles" > >tvq.projectstatus.{1} > type="tiles">tvq.projectstatus.{1} > > type="redirect">/ProjectStatus_list.action > > > > > Since when validation process returns false, i want struts > to show the same > page. I search the web, and saw some solution like above. > But, when i try to > implement, i could not succeed. > > Here are my tiles definitions: > > name="tvq.projectstatus.showAddPage" > extends="tvq.template.default"> > value="Add A Project Status" /> > value="/jsp/projectstatus/AddPage.jsp" > /> > > > name="tvq.projectstatus.ListPage" > extends="tvq.template.default"> > value="Add A Project Status" /> > value="/jsp/projectstatus/ListPage.jsp" /> > > > extends="tvq.template.default"> > value="Add A Project Status" /> > value="/jsp/projectstatus/ListPage.jsp" /> > > > > > I call the page ass follows : > http://localhost:8080/TVQ/ProjectStatus_showAddPage.action > > (the ProjectStatusAction.java has showAddPage, list, and > add functions and > these functions returns the correct strings.) > > > Then, struts looks the action definition and it finds > showAddPage function > in ProjectStatus. > > In result list, there is tvq.projectstatus.showAddPage, and > i have this > definition in my tiles.xml. > > Therefore, it shows the page. The problem occures after i > press the add > button in tvq.projectstatus.showAddPage. > > here is the content of the > tvq.projectstatus.showAddPage(meanly,/jsp/projectstatus/AddPage.jsp) > > > > > validate="true" > > > > > > > > > method="add" value="Add" > /> > > > > > > > > And i have a required field validator on a field in my > form(this field is > listed in AddUpdateTemplate.jsp) > > > ProjectStatus action has add function which returns the > "ADDSUCCEED" string > on success. > > > When i press the add button without filling the required > field, there occure > a validation error(which is expected) > > At this level, i expect struts that it enters the input > result which is > defined in my action as a result. > > Here is the result definition. > > >tvq.projectstatus.{1} > > > I expect the struts to enter in input result, and it does. > but it cannot > produces the tiles definition, it leaves {1} as empty and > produce > "tvq.projectstatus." unlike > "tvq.projectstatus.showAddPage". > > What is the problem, i know i am doing something wrong, i > read the book > "struts2 in action", and searched the web, but > could not find such an > example. Meanly, i am using method action, tiles and > validation together, i > could not find such an example. > > > Please help me, > > > Thanks in advance, > > > -Halil Agin > > > the stack trace is below (i am using global exception > handler, therefore i > copied the html content and paste it here, you may want the > output of error > console, but please be sure that this is the exact error. i > see this error > in the console too) > > > Error Message > > tvq.projectstatus. > -- > Technical Details > > org.apache.tiles.definition.NoSuchDefinitionException: > tvq.projectstatus. at > org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394) > at > org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370) > at > org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105) > at > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) > at
Re: struts2 validation, tiles definition in input result type, problem!
2008/7/24 Halil Ağın <[EMAIL PROTECTED]>: > tomcat : apache-tomcat-6.0.16.tar.gz > > > WEB-INF/lib content: > > tiles-api-2.0.5.jar > tiles-core-2.0.5.jar > tiles-defs.xml > tiles-jsp-2.0.5.jar > struts2-config-browser-plugin-2.1.2.jar > struts2-core-2.1.2.jar > struts2-tiles-plugin-2.1.2.jar It seems that you are pretty up-to-date :-) (except Tiles, where the latest version is 2.0.6, but this is not important in this case). Can you open a JIRA issue, along with a test case (read: WAR file with sources)? https://issues.apache.org/struts/browse/WW Thanks Antonio
Re: struts2 validation, tiles definition in input result type, problem!
tomcat : apache-tomcat-6.0.16.tar.gz WEB-INF/lib content: tiles-api-2.0.5.jar tiles-core-2.0.5.jar tiles-defs.xml tiles-jsp-2.0.5.jar struts2-config-browser-plugin-2.1.2.jar struts2-core-2.1.2.jar struts2-tiles-plugin-2.1.2.jar -Halil AGIN 2008/7/24 Antonio Petrelli <[EMAIL PROTECTED]>: > 2008/7/24 Halil Ağın <[EMAIL PROTECTED]>: > > Hello List; > > org.apache.tiles.definition.NoSuchDefinitionException: tvq.projectstatus. > at > > > org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394) > > at > > > org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370) > > at > > > org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105) > > at > > > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) > > Mmm... It could be a bug. > What version of Struts and Tiles are you using, exactly? > What container are you using? > > Ciao > Antonio >
Re: struts2 validation, tiles definition in input result type, problem!
2008/7/24 Halil Ağın <[EMAIL PROTECTED]>: > Hello List; > org.apache.tiles.definition.NoSuchDefinitionException: tvq.projectstatus. at > org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394) > at > org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370) > at > org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105) > at > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) Mmm... It could be a bug. What version of Struts and Tiles are you using, exactly? What container are you using? Ciao Antonio
struts2 validation, tiles definition in input result type, problem!
Hello List; I am trying to implement validation in struts2. My action is as follow: tvq.projectstatus.{1} tvq.projectstatus.{1} tvq.projectstatus.{1} /ProjectStatus_list.action Since when validation process returns false, i want struts to show the same page. I search the web, and saw some solution like above. But, when i try to implement, i could not succeed. Here are my tiles definitions: I call the page ass follows : http://localhost:8080/TVQ/ProjectStatus_showAddPage.action (the ProjectStatusAction.java has showAddPage, list, and add functions and these functions returns the correct strings.) Then, struts looks the action definition and it finds showAddPage function in ProjectStatus. In result list, there is tvq.projectstatus.showAddPage, and i have this definition in my tiles.xml. Therefore, it shows the page. The problem occures after i press the add button in tvq.projectstatus.showAddPage. here is the content of the tvq.projectstatus.showAddPage(meanly,/jsp/projectstatus/AddPage.jsp) And i have a required field validator on a field in my form(this field is listed in AddUpdateTemplate.jsp) ProjectStatus action has add function which returns the "ADDSUCCEED" string on success. When i press the add button without filling the required field, there occure a validation error(which is expected) At this level, i expect struts that it enters the input result which is defined in my action as a result. Here is the result definition. tvq.projectstatus.{1} I expect the struts to enter in input result, and it does. but it cannot produces the tiles definition, it leaves {1} as empty and produce "tvq.projectstatus." unlike "tvq.projectstatus.showAddPage". What is the problem, i know i am doing something wrong, i read the book "struts2 in action", and searched the web, but could not find such an example. Meanly, i am using method action, tiles and validation together, i could not find such an example. Please help me, Thanks in advance, -Halil Agin the stack trace is below (i am using global exception handler, therefore i copied the html content and paste it here, you may want the output of error console, but please be sure that this is the exact error. i see this error in the console too) Error Message tvq.projectstatus. -- Technical Details org.apache.tiles.definition.NoSuchDefinitionException: tvq.projectstatus. at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:394) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370) at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:355) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:124) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:170) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.ja
RE: struts2 validation
Hi Pierre, Thanks for your code. Yes I did get it working with annotation, phew! Nicole -Original Message- From: Pierrot52 [mailto:[EMAIL PROTECTED] Sent: Wednesday, 16 July 2008 9:48 PM To: user@struts.apache.org Subject: Re: struts2 validation Hi Nicole, This is an action class that does validation of two parameters: public class SignonAction extends ActionSupport { private String username; private String password; @Override public String execute() throws Exception { Map session = null; boolean authenticated = false; try { authenticated = Utils.authenticate(username,password); } catch(Exception e) { // Swallow the exception } if (authenticated) { session = ActionContext.getContext().getSession(); User user = new User(); user.setLogin(username); user.setEmail("set your email"); session.put("loggedIn", user); return SUCCESS; } else { return ERROR; } } @RequiredStringValidator(message="", key = "username.required") @StringLengthFieldValidator(message = "", key = "username.invalidLength", minLength = "6" , maxLength = "15") @RegexFieldValidator(message = "", key = "prompt.invalidCharacters", expression = "^[a-zA-Z0-9]+$") public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @RequiredStringValidator(message="", key="password.required") @StringLengthFieldValidator(message = "", key = "password.invalidLength", minLength = "6" , maxLength = "15") @RegexFieldValidator(message = "", key = "prompt.invalidCharacters", expression = "^[a-zA-Z0-9]+$") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } It uses annotation to validate. Hope this will help. Regards. Pierre Nicole Luneburg wrote: > > Hi all! > > Been looking all over the net but my validation simply isn't working :( > > > > I have a JSP page with a dropdown box in a form. > > I just want to make sure the value in the dropdown box is not empty. > > It currently looks like this: > > > > > > > > > > > > > id=3D"fieldName" > > theme=3D"simple" > > size=3D"1" > > list=3D"fieldList" > > headerKey=3D"" > > headerValue=3D"- - Please Select - -"/> > > > > > > > > My setup is that I have an Action class, which uses a Form to set and get > f= ield values from the JSP page. > > In Struts1 I was using the validate(...) method in the Form class. > > It seems none of the Struts2 validation examples on the net are working > for= me. > > Or I'm not doing it right. > > > > Anyone any ideas how I can do this simply? > > > > Cheers! > > nic > > > > The contents of this email are confidential and may be subject to legal or > professional privilege and copyright. No representation is made that this > email is free of viruses or other defects. If you have received this > communication in error, you may not copy or distribute any part of it or > otherwise disclose its contents to anyone. Please advise the sender of > your incorrect receipt of this correspondence. > > -- View this message in context: http://www.nabble.com/struts2-validation-tp18438182p18485869.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 validation
Hi Nicole, This is an action class that does validation of two parameters: public class SignonAction extends ActionSupport { private String username; private String password; @Override public String execute() throws Exception { Map session = null; boolean authenticated = false; try { authenticated = Utils.authenticate(username,password); } catch(Exception e) { // Swallow the exception } if (authenticated) { session = ActionContext.getContext().getSession(); User user = new User(); user.setLogin(username); user.setEmail("set your email"); session.put("loggedIn", user); return SUCCESS; } else { return ERROR; } } @RequiredStringValidator(message="", key = "username.required") @StringLengthFieldValidator(message = "", key = "username.invalidLength", minLength = "6" , maxLength = "15") @RegexFieldValidator(message = "", key = "prompt.invalidCharacters", expression = "^[a-zA-Z0-9]+$") public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @RequiredStringValidator(message="", key="password.required") @StringLengthFieldValidator(message = "", key = "password.invalidLength", minLength = "6" , maxLength = "15") @RegexFieldValidator(message = "", key = "prompt.invalidCharacters", expression = "^[a-zA-Z0-9]+$") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } It uses annotation to validate. Hope this will help. Regards. Pierre Nicole Luneburg wrote: > > Hi all! > > Been looking all over the net but my validation simply isn't working :( > > > > I have a JSP page with a dropdown box in a form. > > I just want to make sure the value in the dropdown box is not empty. > > It currently looks like this: > > > > > > > > > > > > > id=3D"fieldName" > > theme=3D"simple" > > size=3D"1" > > list=3D"fieldList" > > headerKey=3D"" > > headerValue=3D"- - Please Select - -"/> > > > > > > > > My setup is that I have an Action class, which uses a Form to set and get > f= ield values from the JSP page. > > In Struts1 I was using the validate(...) method in the Form class. > > It seems none of the Struts2 validation examples on the net are working > for= me. > > Or I'm not doing it right. > > > > Anyone any ideas how I can do this simply? > > > > Cheers! > > nic > > > > The contents of this email are confidential and may be subject to legal or > professional privilege and copyright. No representation is made that this > email is free of viruses or other defects. If you have received this > communication in error, you may not copy or distribute any part of it or > otherwise disclose its contents to anyone. Please advise the sender of > your incorrect receipt of this correspondence. > > -- View this message in context: http://www.nabble.com/struts2-validation-tp18438182p18485869.html 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: struts2 validation
In case it helps anyone else, I found a simple solution ... Annotations. I did exactly what is here: http://struts.apache.org/2.x/docs/validation-annotation.html Thanks again for everyone's help! The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts2 validation
Ah! Now I understand ... Looks like I will be changing a few things in this project ... Thanks for your help! -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Monday, 14 July 2008 10:22 PM To: Struts Users Mailing List Subject: RE: struts2 validation If you don't have an action property named "fieldname" then not only will validation not work but neither will normal property copying (from form to action). If, for example, you have a MyForm named "form", and has an appropriate getter/setter, its form element would look like this: If you're handling validation programmatically (via the Validateable interface and the action's validate() method) you'd then validate against the MyForm instance, for example: public void validate() { if (StringUtils.isBlank(this.form.getFieldName())) { ... } ... } It sort of seems like you're implementing a bit of ModelDriven, but manually--not a problem, but seems a bit duplicative. Dave --- On Mon, 7/14/08, Nicole Luneburg wrote: > From: Nicole Luneburg <[EMAIL PROTECTED]> > Subject: RE: struts2 validation > To: "Struts Users Mailing List" > Date: Monday, July 14, 2008, 3:16 AM > ps. My post added some "3D" text that isn't > supposed to be there ... > > Thanks Jeromy. > > Yes I do have a attribute, maybe not > *exactly* but I have: > > > Apologies for the confusion. > What I meant in my pevious post was that I had tried a few > ways to do this validation task. > In my initial post I had described one of these attempts > which I think should have worked. > > What I am getting regardless of what sort of validation I > try to implement is this error: > > java.lang.StringIndexOutOfBoundsException: String index out > of range: -7 > > You mentioned the getters and setters for the fieldnames > ... this only works though if the fields are stored in the > action right? > coz the fields I have aren't stored in the action, they > are stored in a Form class. > > Ie my action looks something like: > > public String execute() { > MyForm myForm = (MyForm)super.form; > String myField = myForm.getFieldName(); > } > > Markus: Thanks for your reply too, I am trying it right > now. Just want this to work grrr > > > -Original Message- > From: Jeromy Evans > [mailto:[EMAIL PROTECTED] > Sent: Monday, 14 July 2008 4:25 PM > To: Struts Users Mailing List > Subject: Re: struts2 validation > > Nicole Luneburg wrote: > > > > > > > > method=3D"post" validate=3D"true"> > > > The validate attribute here is used to enable client-side > validation > only. That will only work if you include the > attribute in the > page. > > > > > > > > My setup is that I have an Action class, which uses a > Form to set and get f= ield values from the JSP page. > > > > In Struts1 I was using the validate(...) method in the > Form class. > > > > It seems none of the Struts2 validation examples on > the net are working for= me. > > > > > > You haven't mentioned whether you're using XML > validation or > annotation-based validation. If by not working you mean > "does nothing", > then your XML file is probably incorrectly named or your > missing an > annotation. (You need to enable this separately from > client-side > validation) > > Whatever the case, the main difference between Struts1 and > Struts2 here > is that Struts2 performs validation on the Object, not on > the form > parameters. > That means, to check that "fieldName" is > non-blank, it will call > getFieldName() after setFieldName() was called by the > ParametersInterceptor. > > A common problem is to forget the getter, but in that case > Struts will > keep returning INPUT (validation failed) instead of > invoking your action. > > Hope that helps, > Jeromy Evans > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > The contents of this email are confidential and may be > subject to legal or professional privilege and copyright. > No representation is made that this email is free of > viruses or other defects. If you have received this > communication in error, you may not copy or distribute any > part of it or otherwise disclose its contents to anyone. > Please advise the sender of your incorrect receipt of this > correspondence. > > - >
RE: struts2 validation
If you don't have an action property named "fieldname" then not only will validation not work but neither will normal property copying (from form to action). If, for example, you have a MyForm named "form", and has an appropriate getter/setter, its form element would look like this: If you're handling validation programmatically (via the Validateable interface and the action's validate() method) you'd then validate against the MyForm instance, for example: public void validate() { if (StringUtils.isBlank(this.form.getFieldName())) { ... } ... } It sort of seems like you're implementing a bit of ModelDriven, but manually--not a problem, but seems a bit duplicative. Dave --- On Mon, 7/14/08, Nicole Luneburg wrote: > From: Nicole Luneburg <[EMAIL PROTECTED]> > Subject: RE: struts2 validation > To: "Struts Users Mailing List" > Date: Monday, July 14, 2008, 3:16 AM > ps. My post added some "3D" text that isn't > supposed to be there ... > > Thanks Jeromy. > > Yes I do have a attribute, maybe not > *exactly* but I have: > > > Apologies for the confusion. > What I meant in my pevious post was that I had tried a few > ways to do this validation task. > In my initial post I had described one of these attempts > which I think should have worked. > > What I am getting regardless of what sort of validation I > try to implement is this error: > > java.lang.StringIndexOutOfBoundsException: String index out > of range: -7 > > You mentioned the getters and setters for the fieldnames > ... this only works though if the fields are stored in the > action right? > coz the fields I have aren't stored in the action, they > are stored in a Form class. > > Ie my action looks something like: > > public String execute() { > MyForm myForm = (MyForm)super.form; > String myField = myForm.getFieldName(); > } > > Markus: Thanks for your reply too, I am trying it right > now. Just want this to work grrr > > > -Original Message- > From: Jeromy Evans > [mailto:[EMAIL PROTECTED] > Sent: Monday, 14 July 2008 4:25 PM > To: Struts Users Mailing List > Subject: Re: struts2 validation > > Nicole Luneburg wrote: > > > > > > > > method=3D"post" validate=3D"true"> > > > The validate attribute here is used to enable client-side > validation > only. That will only work if you include the > attribute in the > page. > > > > > > > > My setup is that I have an Action class, which uses a > Form to set and get f= ield values from the JSP page. > > > > In Struts1 I was using the validate(...) method in the > Form class. > > > > It seems none of the Struts2 validation examples on > the net are working for= me. > > > > > > You haven't mentioned whether you're using XML > validation or > annotation-based validation. If by not working you mean > "does nothing", > then your XML file is probably incorrectly named or your > missing an > annotation. (You need to enable this separately from > client-side > validation) > > Whatever the case, the main difference between Struts1 and > Struts2 here > is that Struts2 performs validation on the Object, not on > the form > parameters. > That means, to check that "fieldName" is > non-blank, it will call > getFieldName() after setFieldName() was called by the > ParametersInterceptor. > > A common problem is to forget the getter, but in that case > Struts will > keep returning INPUT (validation failed) instead of > invoking your action. > > Hope that helps, > Jeromy Evans > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > The contents of this email are confidential and may be > subject to legal or professional privilege and copyright. > No representation is made that this email is free of > viruses or other defects. If you have received this > communication in error, you may not copy or distribute any > part of it or otherwise disclose its contents to anyone. > Please advise the sender of your incorrect receipt of this > correspondence. > > - > 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: struts2 validation
Struts2 does not have FormBeans anymore. All the form fields are instance variables directly in your Action class. Simply include a variable fieldName of type String with getters and setters in your Action class. The setFieldName() method will be called when you submit the form. In the execute() and validate() methods you can use the fieldName variable directly. What you can also do is put a instance variable of a bean in your Action class. You can then acces the getters and setters of this bean in the jsp: If you submit this form struts will call myaction.getMyBeanVariableName().setFieldName(selectedValue). Regards -- Markus Stauffer On Mon, Jul 14, 2008 at 9:16 AM, Nicole Luneburg <[EMAIL PROTECTED]> wrote: > ps. My post added some "3D" text that isn't supposed to be there ... > > Thanks Jeromy. > > Yes I do have a attribute, maybe not *exactly* but I have: > > > Apologies for the confusion. > What I meant in my pevious post was that I had tried a few ways to do this > validation task. > In my initial post I had described one of these attempts which I think should > have worked. > > What I am getting regardless of what sort of validation I try to implement is > this error: > > java.lang.StringIndexOutOfBoundsException: String index out of range: -7 > > You mentioned the getters and setters for the fieldnames ... this only works > though if the fields are stored in the action right? > coz the fields I have aren't stored in the action, they are stored in a Form > class. > > Ie my action looks something like: > > public String execute() { >MyForm myForm = (MyForm)super.form; >String myField = myForm.getFieldName(); > } > > Markus: Thanks for your reply too, I am trying it right now. Just want this > to work grrr > > > -Original Message- > From: Jeromy Evans [mailto:[EMAIL PROTECTED] > Sent: Monday, 14 July 2008 4:25 PM > To: Struts Users Mailing List > Subject: Re: struts2 validation > > Nicole Luneburg wrote: >> >> >> >> >> > The validate attribute here is used to enable client-side validation > only. That will only work if you include the attribute in the > page. > > >> >> >> My setup is that I have an Action class, which uses a Form to set and get f= >> ield values from the JSP page. >> >> In Struts1 I was using the validate(...) method in the Form class. >> >> It seems none of the Struts2 validation examples on the net are working for= >> me. >> >> > > You haven't mentioned whether you're using XML validation or > annotation-based validation. If by not working you mean "does nothing", > then your XML file is probably incorrectly named or your missing an > annotation. (You need to enable this separately from client-side > validation) > > Whatever the case, the main difference between Struts1 and Struts2 here > is that Struts2 performs validation on the Object, not on the form > parameters. > That means, to check that "fieldName" is non-blank, it will call > getFieldName() after setFieldName() was called by the ParametersInterceptor. > > A common problem is to forget the getter, but in that case Struts will > keep returning INPUT (validation failed) instead of invoking your action. > > Hope that helps, > Jeromy Evans > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > The contents of this email are confidential and may be subject to legal or > professional privilege and copyright. No representation is made that this > email is free of viruses or other defects. If you have received this > communication in error, you may not copy or distribute any part of it or > otherwise disclose its contents to anyone. Please advise the sender of your > incorrect receipt of this correspondence. > > - > 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: struts2 validation
ps. My post added some "3D" text that isn't supposed to be there ... Thanks Jeromy. Yes I do have a attribute, maybe not *exactly* but I have: Apologies for the confusion. What I meant in my pevious post was that I had tried a few ways to do this validation task. In my initial post I had described one of these attempts which I think should have worked. What I am getting regardless of what sort of validation I try to implement is this error: java.lang.StringIndexOutOfBoundsException: String index out of range: -7 You mentioned the getters and setters for the fieldnames ... this only works though if the fields are stored in the action right? coz the fields I have aren't stored in the action, they are stored in a Form class. Ie my action looks something like: public String execute() { MyForm myForm = (MyForm)super.form; String myField = myForm.getFieldName(); } Markus: Thanks for your reply too, I am trying it right now. Just want this to work grrr -Original Message- From: Jeromy Evans [mailto:[EMAIL PROTECTED] Sent: Monday, 14 July 2008 4:25 PM To: Struts Users Mailing List Subject: Re: struts2 validation Nicole Luneburg wrote: > > > > > The validate attribute here is used to enable client-side validation only. That will only work if you include the attribute in the page. > > > My setup is that I have an Action class, which uses a Form to set and get f= > ield values from the JSP page. > > In Struts1 I was using the validate(...) method in the Form class. > > It seems none of the Struts2 validation examples on the net are working for= > me. > > You haven't mentioned whether you're using XML validation or annotation-based validation. If by not working you mean "does nothing", then your XML file is probably incorrectly named or your missing an annotation. (You need to enable this separately from client-side validation) Whatever the case, the main difference between Struts1 and Struts2 here is that Struts2 performs validation on the Object, not on the form parameters. That means, to check that "fieldName" is non-blank, it will call getFieldName() after setFieldName() was called by the ParametersInterceptor. A common problem is to forget the getter, but in that case Struts will keep returning INPUT (validation failed) instead of invoking your action. Hope that helps, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 validation
If you want validation like in struts1 you can implement the interface com.opensymphony.xwork2.Validateable in your Action class. The method validate() is the same as in your struts1 FormBean. But maybe that's a bit old fashioned :) Regards -- Markus Stauffer On Mon, Jul 14, 2008 at 8:54 AM, Jeromy Evans <[EMAIL PROTECTED]> wrote: > Nicole Luneburg wrote: >> >> >> >> >> > > The validate attribute here is used to enable client-side validation only. > That will only work if you include the attribute in the page. > > >> >> >> My setup is that I have an Action class, which uses a Form to set and get >> f= ield values from the JSP page. >> >> In Struts1 I was using the validate(...) method in the Form class. >> >> It seems none of the Struts2 validation examples on the net are working >> for= me. >> >> > > You haven't mentioned whether you're using XML validation or > annotation-based validation. If by not working you mean "does nothing", > then your XML file is probably incorrectly named or your missing an > annotation. (You need to enable this separately from client-side > validation) > > Whatever the case, the main difference between Struts1 and Struts2 here is > that Struts2 performs validation on the Object, not on the form parameters. > That means, to check that "fieldName" is non-blank, it will call > getFieldName() after setFieldName() was called by the ParametersInterceptor. > > A common problem is to forget the getter, but in that case Struts will keep > returning INPUT (validation failed) instead of invoking your action. > > Hope that helps, > Jeromy Evans > > > > > > - > 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: struts2 validation
Nicole Luneburg wrote: The validate attribute here is used to enable client-side validation only. That will only work if you include the attribute in the page. My setup is that I have an Action class, which uses a Form to set and get f= ield values from the JSP page. In Struts1 I was using the validate(...) method in the Form class. It seems none of the Struts2 validation examples on the net are working for= me. You haven't mentioned whether you're using XML validation or annotation-based validation. If by not working you mean "does nothing", then your XML file is probably incorrectly named or your missing an annotation. (You need to enable this separately from client-side validation) Whatever the case, the main difference between Struts1 and Struts2 here is that Struts2 performs validation on the Object, not on the form parameters. That means, to check that "fieldName" is non-blank, it will call getFieldName() after setFieldName() was called by the ParametersInterceptor. A common problem is to forget the getter, but in that case Struts will keep returning INPUT (validation failed) instead of invoking your action. Hope that helps, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts2 validation
Hi all! Been looking all over the net but my validation simply isn't working :( I have a JSP page with a dropdown box in a form. I just want to make sure the value in the dropdown box is not empty. It currently looks like this: My setup is that I have an Action class, which uses a Form to set and get f= ield values from the JSP page. In Struts1 I was using the validate(...) method in the Form class. It seems none of the Struts2 validation examples on the net are working for= me. Or I'm not doing it right. Anyone any ideas how I can do this simply? Cheers! nic The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.
Re: Struts2 validation issue when internet is not available in the application server.
--- Dave Newton <[EMAIL PROTECTED]> wrote: > --- Nuwan Chandrasoma <[EMAIL PROTECTED]> wrote: > > This is my xml file. when we run in a local machine that has internet > > access this works fine. > > > > > > > "-//OpenSymphony Group//XWork Validator 1.0.2//EN" > > "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> > > Hmm, AFAICT that's exactly what I'm using. > > What container are you running in? I'm running via a local Tomcat via > Eclipse Europa; it's possible that Eclipse has cached my DTD or > something. I'll look in to it a bit more. Just as a quick followup, with no internet access and no DTD caching it still seems to work okay. It's also giving me confusing log entries; I have no annotations in my action class that's being validated, but the debugs are from the annotation validation manager. The messages being displayed are from the XML file. So I'm a little lost and potentially less useful than I thought ;) Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 validation issue when internet is not available in the application server.
I am using jboss-4.0.5-GA Dave Newton wrote: --- Nuwan Chandrasoma <[EMAIL PROTECTED]> wrote: This is my xml file. when we run in a local machine that has internet access this works fine. http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> Hmm, AFAICT that's exactly what I'm using. What container are you running in? I'm running via a local Tomcat via Eclipse Europa; it's possible that Eclipse has cached my DTD or something. I'll look in to it a bit more. 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: Struts2 validation issue when internet is not available in the application server.
--- Nuwan Chandrasoma <[EMAIL PROTECTED]> wrote: > This is my xml file. when we run in a local machine that has internet > access this works fine. > > >"-//OpenSymphony Group//XWork Validator 1.0.2//EN" > "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> Hmm, AFAICT that's exactly what I'm using. What container are you running in? I'm running via a local Tomcat via Eclipse Europa; it's possible that Eclipse has cached my DTD or something. I'll look in to it a bit more. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 validation issue when internet is not available in the application server.
This is my xml file. when we run in a local machine that has internet access this works fine. http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> Login name is required Password is required Dave Newton wrote: Is your DTD correct? As a trivial test I turned off my WiFi and restarted a webapp that uses a validation configuration file and no issues throught he startup or validation process. Dave --- Nuwan Chandrasoma <[EMAIL PROTECTED]> wrote: Hi All, Has any one come across this issue? . we dont have internet in our app server and the struts2 validation fails as it cant access www.opensymphony.com. Thanks, Nuwan. Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113) ... 160 more Caused by: java.lang.ExceptionInInitializerError at com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(ValidatorFileParser.java:177) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorConfigs(ValidatorFileParser.java:72) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:357) at com.opensymphony.xwork2.va 26 Mar 2008 17:58:04,489 INFO [STDOUT] lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(AnnotationActionValidatorManager.java:240) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:339) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:49) at org.apache.struts2.components.Form.getValidators(Form.java:412) ... 166 more Caused by: www.opensymphony.com - [unknown location] at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123) at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:114) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:99) at com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(ValidatorFactory.java:314) at com.opensymphony.xwork2.validator.ValidatorFactory.(ValidatorFactory.java:220) ... 174 more Caused by: java.net.UnknownHostException: www.opensymphony.com at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121)
Re: Struts2 validation issue when internet is not available in the application server.
So to take an example in the supplied validators xml 1 100 Invalid Count! 20 80 Smaller Invalid Count: ${count} The xwork package ValidatorFileParser.java hunts for type attribute of element short-circuit attribute of param element name attribute of element message element key attribute of the message element M- - Original Message - From: "Nuwan Chandrasoma" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Wednesday, March 26, 2008 8:16 AM Subject: Struts2 validation issue when internet is not available in the application server. > Hi All, > > Has any one come across this issue? . we dont have internet in our app > server and the struts2 validation fails as it cant access > www.opensymphony.com. > > Thanks, > > Nuwan. > > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) > at > freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113) > ... 160 more > Caused by: java.lang.ExceptionInInitializerError > at > com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(Va lidatorFileParser.java:177) > at > com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorCo nfigs(ValidatorFileParser.java:72) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile( AnnotationActionValidatorManager.java:357) > at com.opensymphony.xwork2.va > 26 Mar 2008 17:58:04,489 INFO [STDOUT] > lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(Annotati onActionValidatorManager.java:240) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildVali datorConfigs(AnnotationActionValidatorManager.java:339) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValida tors(AnnotationActionValidatorManager.java:69) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValida tors(AnnotationActionValidatorManager.java:49) > at org.apache.struts2.components.Form.getValidators(Form.java:412) > ... 166 more > Caused by: www.opensymphony.com - [unknown location] > at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123) > at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71) > at > com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefiniti ons(ValidatorFileParser.java:114) > at > com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefiniti ons(ValidatorFileParser.java:99) > at > com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(Validator Factory.java:314) > at > com.opensymphony.xwork2.validator.ValidatorFactory.(ValidatorFactory java:220) > ... 174 more > Caused by: java.net.UnknownHostException: www.opensymphony.com > at java.net.PlainSocketImpl.connect(Unknown Source) > at java.net.Socket.connect(Unknown Source) > at java.net.Socket.connect(Unknown Source) > at sun.net.NetworkClient.doConnect(Unknown Source) > at sun.net.www.http.HttpClient.openServer(Unknown Source) > at sun.net.www.http.HttpClient.openServer(Unknown Source) > at sun.net.www.http.HttpClient.(Unknown Source) > at sun.net.www.http.HttpClient.New(Unknown Source) > at sun.net.www.http.HttpClient.New(Unknown Source) > at > sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) > at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown > Source) > at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) > at > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) > at > org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) > at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) > at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown > Source) > at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown > Source) > at > org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown > Source) > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) > at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) > at org.apache.xerces.parsers.XML11C
Re: Struts2 validation issue when internet is not available in the application server.
Is your DTD correct? As a trivial test I turned off my WiFi and restarted a webapp that uses a validation configuration file and no issues throught he startup or validation process. Dave --- Nuwan Chandrasoma <[EMAIL PROTECTED]> wrote: > Hi All, > > Has any one come across this issue? . we dont have internet in our app > server and the struts2 validation fails as it cant access > www.opensymphony.com. > > Thanks, > > Nuwan. > > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) > at > freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113) > ... 160 more > Caused by: java.lang.ExceptionInInitializerError > at > com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(ValidatorFileParser.java:177) > at > com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorConfigs(ValidatorFileParser.java:72) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:357) > at com.opensymphony.xwork2.va > 26 Mar 2008 17:58:04,489 INFO [STDOUT] > lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(AnnotationActionValidatorManager.java:240) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:339) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69) > at > com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:49) > at org.apache.struts2.components.Form.getValidators(Form.java:412) > ... 166 more > Caused by: www.opensymphony.com - [unknown location] > at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123) > at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71) > at > com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:114) > at > com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:99) > at > com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(ValidatorFactory.java:314) > at > com.opensymphony.xwork2.validator.ValidatorFactory.(ValidatorFactory.java:220) > ... 174 more > Caused by: java.net.UnknownHostException: www.opensymphony.com > at java.net.PlainSocketImpl.connect(Unknown Source) > at java.net.Socket.connect(Unknown Source) > at java.net.Socket.connect(Unknown Source) > at sun.net.NetworkClient.doConnect(Unknown Source) > at sun.net.www.http.HttpClient.openServer(Unknown Source) > at sun.net.www.http.HttpClient.openServer(Unknown Source) > at sun.net.www.http.HttpClient.(Unknown Source) > at sun.net.www.http.HttpClient.New(Unknown Source) > at sun.net.www.http.HttpClient.New(Unknown Source) > at > sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown > Source) > at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown > Source) > at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) > at > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) > at > org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) > at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) > at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown > Source) > at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown > Source) > at > org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown > > Source) > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) > at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) > at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) > at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) > at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown > Source) > at javax.xml.parsers.SAXParser.parse(Unknown Source) > at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121) > ... 179 more > >
Struts2 validation issue when internet is not available in the application server.
Hi All, Has any one come across this issue? . we dont have internet in our app server and the struts2 validation fails as it cant access www.opensymphony.com. Thanks, Nuwan. Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113) ... 160 more Caused by: java.lang.ExceptionInInitializerError at com.opensymphony.xwork2.validator.ValidatorFileParser.addValidatorConfigs(ValidatorFileParser.java:177) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseActionValidatorConfigs(ValidatorFileParser.java:72) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:357) at com.opensymphony.xwork2.va 26 Mar 2008 17:58:04,489 INFO [STDOUT] lidator.AnnotationActionValidatorManager.buildAliasValidatorConfigs(AnnotationActionValidatorManager.java:240) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:339) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:49) at org.apache.struts2.components.Form.getValidators(Form.java:412) ... 166 more Caused by: www.opensymphony.com - [unknown location] at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123) at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:71) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:114) at com.opensymphony.xwork2.validator.ValidatorFileParser.parseValidatorDefinitions(ValidatorFileParser.java:99) at com.opensymphony.xwork2.validator.ValidatorFactory.parseValidators(ValidatorFactory.java:314) at com.opensymphony.xwork2.validator.ValidatorFactory.(ValidatorFactory.java:220) ... 174 more Caused by: java.net.UnknownHostException: www.opensymphony.com at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121) ... 179 more - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts2 Validation
Kevin, You didn't mention what page has the form you're submitting, but let me call that "page0". Let's say it has two buttons: Button1 for Action1, and Button2 for Action2. I'm assuming that you entered data and hit Button2, and this worked fine until you added the validation descriptor for Action2. The fact that it did stop working, and that it's trying to handle "input", says there was a vaidation failure. Trying to coerce "input" to take you to "page2" isn't likely to help, since on the validation failure the action isn't invoked, so edit() is never called. So, I have to assume that, from the data you entered, you didn't *expect* validation to fail. I'd suggest you review the validation you added, especially if there are any custom validators - maybe there's a combination of validators on some field that can never evaluate to true. If there's nothing obvious then I'd suggest adding an actionerror or some fielderror tags to page0, and let it redisplay so you can see what field is failing validation. ...Jeff -Original Message- From: djia002 [mailto:[EMAIL PROTECTED] Sent: Thursday, January 24, 2008 8:14 PM To: user@struts.apache.org Subject: Struts2 Validation Hello , I am new to struts2. Please help me on this problem. I have a configuration like this /page1.jsp /page2.jsp /page1.jsp /page2.jsp /page2.jsp The flow is I submit a form from page1 to Action ActionClass2.edit method, public String edit() throws Exception { // fetch some data and push into session for rendering page2.jsp ... return "detail"; // This will forward to page2.jsp } You can see from the code that edit() method try to store some data in session for displaying page2.jsp. Everything works fine until i added ActionClass2-validation.xml for validating the form on page2.jsp. I got error says "No result defined for action and result input." so I added page2.jsp into configuration. and then of course it just simply try to display page2.jsp without having data preloaded by edit() because edit() not get called at all. How can I work around with this problem? Thanks in advance. Kevin -- View this message in context: http://www.nabble.com/Struts2-Validation-tp15079124p15079124.html Sent from the Struts - User mailing list archive at Nabble.com. - 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]
Struts2 Validation
Hello , I am new to struts2. Please help me on this problem. I have a configuration like this /page1.jsp /page2.jsp /page1.jsp /page2.jsp /page2.jsp The flow is I submit a form from page1 to Action ActionClass2.edit method, public String edit() throws Exception { // fetch some data and push into session for rendering page2.jsp ... return "detail"; // This will forward to page2.jsp } You can see from the code that edit() method try to store some data in session for displaying page2.jsp. Everything works fine until i added ActionClass2-validation.xml for validating the form on page2.jsp. I got error says "No result defined for action and result input." so I added page2.jsp into configuration. and then of course it just simply try to display page2.jsp without having data preloaded by edit() because edit() not get called at all. How can I work around with this problem? Thanks in advance. Kevin -- View this message in context: http://www.nabble.com/Struts2-Validation-tp15079124p15079124.html 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: struts2 validation - wildcard mappings and the submit tag "method" parameter
use @SkipValidation annotation for methods, which you do not need to validate. This affects on StrutsValidationFramework For validate() method you must manually analyse the situation and skip its executing. Lindell, Andrew wrote: > > The problem I'm having is getting validation to run when the wildcard > mapped method is specified in the submit tag method parameter and not in > the form tag action parameter (action-method). > > Everything works fine when I set the form action param to specify the > action and method. > > > > If the method is specified in the submit tag does it use the same format > for validation files (actionclass-alias-method). > > > > Thanks > > > > -Andrew > > > > > > > -- View this message in context: http://www.nabble.com/struts2-validation---wildcard-mappings-and-the-submit-tag-%22method%22-parameter-tf4691287.html#a13423851 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts2 validation - wildcard mappings and the submit tag "method" parameter
The problem I'm having is getting validation to run when the wildcard mapped method is specified in the submit tag method parameter and not in the form tag action parameter (action-method). Everything works fine when I set the form action param to specify the action and method. If the method is specified in the submit tag does it use the same format for validation files (actionclass-alias-method). Thanks -Andrew
Re: struts2 validation for only one method in action
Thank you for your answer. It was very helpful. Ian Roughley wrote: > > you can always use and > - then you don't need the logic to > determine which button was clicked in the execute() method, and you can > use the validation config below. > > /ian > > Igor Vlasov wrote: >> This is not a solution. >> >> I have 2 submit button in one form: one for save and another for delete. >> All >> of them submit the form data to execute() method. There I can determine >> which button was pressed and do an appropriate bussines action. >> >> The problem is that i must to validate the data when "OK" button is >> pressed >> and NOT validate when "DEL" button is pressed. >> >> >> ros wrote: >> >>> For struts it's >>> >>> cancel,execute,delete,edit,list,print >>> >>> >>> Hope this helps. >>> >>> ros >>> >>> >>> Igor Vlasov wrote: >>> >>>> And how to disable the SERVER side validation when delete button >>>> clicked >>>> ? >>>> >>>> >>>> >>>> ros wrote: >>>> >>>>> Java Script validation fro button disabled by >>>>> >>>>> >>>> >>>>> onclick="document.getElementById('ticketForm').onsubmit = null;" /> >>>>> >>>>> >>>>> ros wrote: >>>>> >>>>>> If I have in one form DELETE and SAVE buttons, how to turn off client >>>>>> side validation for DELETE button? >>>>>> >>>>>> >>>>> >>>> >>> >> >> > > -- View this message in context: http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13269628 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: struts2 validation for only one method in action
you can always use and - then you don't need the logic to determine which button was clicked in the execute() method, and you can use the validation config below. /ian Igor Vlasov wrote: This is not a solution. I have 2 submit button in one form: one for save and another for delete. All of them submit the form data to execute() method. There I can determine which button was pressed and do an appropriate bussines action. The problem is that i must to validate the data when "OK" button is pressed and NOT validate when "DEL" button is pressed. ros wrote: For struts it's cancel,execute,delete,edit,list,print Hope this helps. ros Igor Vlasov wrote: And how to disable the SERVER side validation when delete button clicked ? ros wrote: Java Script validation fro button disabled by onclick="document.getElementById('ticketForm').onsubmit = null;" /> ros wrote: If I have in one form DELETE and SAVE buttons, how to turn off client side validation for DELETE button?
Re: struts2 validation for only one method in action
This is not a solution. I have 2 submit button in one form: one for save and another for delete. All of them submit the form data to execute() method. There I can determine which button was pressed and do an appropriate bussines action. The problem is that i must to validate the data when "OK" button is pressed and NOT validate when "DEL" button is pressed. ros wrote: > > For struts it's > > cancel,execute,delete,edit,list,print > > > Hope this helps. > > ros > > > Igor Vlasov wrote: >> >> And how to disable the SERVER side validation when delete button clicked >> ? >> >> >> >> ros wrote: >>> >>> Java Script validation fro button disabled by >>> >>> >> >>> onclick="document.getElementById('ticketForm').onsubmit = null;" /> >>> >>> >>> ros wrote: >>>> >>>> If I have in one form DELETE and SAVE buttons, how to turn off client >>>> side validation for DELETE button? >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13254948 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: struts2 validation for only one method in action
For struts it's cancel,execute,delete,edit,list,print Hope this helps. ros Igor Vlasov wrote: > > And how to disable the SERVER side validation when delete button clicked ? > > > > ros wrote: >> >> Java Script validation fro button disabled by >> >> > >> onclick="document.getElementById('ticketForm').onsubmit = null;" /> >> >> >> ros wrote: >>> >>> If I have in one form DELETE and SAVE buttons, how to turn off client >>> side validation for DELETE button? >>> >> >> > > -- View this message in context: http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13254840 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: struts2 validation for only one method in action
And how to disable the SERVER side validation when delete button clicked ? ros wrote: > > Java Script validation fro button disabled by > > > onclick="document.getElementById('ticketForm').onsubmit = null;" /> > > > ros wrote: >> >> If I have in one form DELETE and SAVE buttons, how to turn off client >> side validation for DELETE button? >> > > -- View this message in context: http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html#a13253735 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]