RE: Validation Multiple Pages forward-Failure
I hate action chaining but this solution might work: For the display of the multi-page form, use another action. Then, your validation failure can use the multi-form display action as the input= parameter and call it from the regular action by a forward, if it ever needs to call the display to continue. How could you easily set the individual input pages in the struts-config.xml file? Probably by using a few set-property name= value= / tags within the action... . (here) ... /action declaration. They go there like a local forward but they have a different usage and purpose. Then you could set a page name for step 1 to use to display, step 2, step 3, etc. Regards, David -Original Message- From: Robert Lehner [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 3:40 PM To: Struts Users Mailing List Subject: Re: Validation Multiple Pages forward-Failure Hello Matthias Wessendorf wrote: hi enter input=/myFormular.jsp so validate goes back to formular there you can display action-messages (or even errors if you use) Yes this would work if I hade one JSP-Page, but I have (now) one Form(getter and setter methods), one ActionForm and seven JSP-Pages wich are would be filled one after the other (and validated, without validation it works for now). At the end I would show all the values to the user and when submitting the entries the actionFrom should call a bussnessdelegate and store the vaules pesistent (via JDO) in a DBMS. CU Robert cheers, matthias -Original Message- From: Robert Lehner [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 7:13 PM To: Struts Users Mailing List Subject: Re: Validation Multiple Pages forward-Failure Hallo I'm using *.do mapping in my web.xml so I must use input=/newUser ? This does not work! Ben Anderson wrote: You want to put validate=true for the action you are submitting to. That's also where you specify the input. The input is an application relative path beginning with a /, so if you're using /do/* mapping in your web.xml you'd want something like this action name=newUserFrom path=/nextPathInProcess validate=true input=/do/newUser however, I think it's generally best to just forward back to the jsp: input=/pages/newUser.jsp I could not user input=/newuser/newUser.jsp because there is no file like newUser.jsp . I have the files index.jsp, address.jsp, services.jsp, status.jsp where I distribute the objects (name, fist name, street, city etc) from my NewUserFrom. When I mistype anything i.E. in index.jsp it should redisplay the index.jsp with the errormsg otherwise it should display the next page (address.jsp) and so on. Like in my NewUserAktion snippt down. (Also shown in the struts-validation example of the struts-distribution but without JavaScript!!) If you would see the full NewUserAction mail me and i would send it to you via pm. thx Robert Lehner From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 18:19:18 +0100 Hello I saw this in the dtd, but I don't knowe what I should enter as value of input. I tried newUser, newUser.do, newUserFrom nothing worked es expected. I would to get back the form where the validation find the failure, so the User could corret his failure an procced the applikation. BTW: I used the struts-validation exmaple as pattern. I changed in the pattern struts-config.xml at the action multiRegistration the validation to true and the applikation dosen't work any more. Why? Thx Robert Lehner Ben Anderson wrote: struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered
RE: Validation Multiple Pages forward-Failure
What is exectly the positiv/negativ DynaValidatorActionFrom oposite Form-File (the one with the setter an getter methods). At the whole using DynamicActionForm you have no need to getters and setters, just defining parameters and their types in struts-config.xml is enough.hope I understood your question correctly; the major difference between ActionForm and DynaActionForm(in this case DynaVaidatorActionForm) is that the latter one implements and handle the Data Transfer Object(DTO) or the bean of getters and setters -that you mentioned- implicitly, so easy and fast. And about input page of multi page forms : there's no need to specify input , leave it blank. In the case of 7 pages: 1) html:form method=post action=yourActionClass (don't forget to map your DynaValidatorActionForm to ActionClass;) ) 2)write this line in every pages: html:hidden property=page value=yourPageNumber you must specify 'page' in your DynaValidatorAction with the type of java.lang.Integer not java.lang.String! then in validation.xml define page in each property attributes, for example: .. depends=required page=3/ using page=3, then this attribute won't be validate in pages 1 and 2. and will be validate in page 3 where is the appopriate place for validation. hope it helps Nafise - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
RE: Validation Multiple Pages forward-Failure
struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property=action/ html:hidden property=page value=1/ ... /html:form I don's see any problem, wheres my failure? Thx Robert Lehner [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ High-speed usersbe more efficient online with the new MSN Premium Internet Software. http://join.msn.com/?pgmarket=en-uspage=byoa/premST=1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Multiple Pages forward-Failure
Hello I saw this in the dtd, but I don't knowe what I should enter as value of input. I tried newUser, newUser.do, newUserFrom nothing worked es expected. I would to get back the form where the validation find the failure, so the User could corret his failure an procced the applikation. BTW: I used the struts-validation exmaple as pattern. I changed in the pattern struts-config.xml at the action multiRegistration the validation to true and the applikation dosen't work any more. Why? Thx Robert Lehner Ben Anderson wrote: struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property=action/ html:hidden property=page value=1/ ... /html:form I don's see any problem, wheres my failure? Thx Robert Lehner [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ High-speed usersbe more efficient online with the new MSN Premium Internet Software. http://join.msn.com/?pgmarket=en-uspage=byoa/premST=1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Multiple Pages forward-Failure
You want to put validate=true for the action you are submitting to. That's also where you specify the input. The input is an application relative path beginning with a /, so if you're using /do/* mapping in your web.xml you'd want something like this action name=newUserFrom path=/nextPathInProcess validate=true input=/do/newUser however, I think it's generally best to just forward back to the jsp: input=/pages/newUser.jsp -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 18:19:18 +0100 Hello I saw this in the dtd, but I don't knowe what I should enter as value of input. I tried newUser, newUser.do, newUserFrom nothing worked es expected. I would to get back the form where the validation find the failure, so the User could corret his failure an procced the applikation. BTW: I used the struts-validation exmaple as pattern. I changed in the pattern struts-config.xml at the action multiRegistration the validation to true and the applikation dosen't work any more. Why? Thx Robert Lehner Ben Anderson wrote: struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property=action/ html:hidden property=page value=1/ ... /html:form I don's see any problem, wheres my failure? Thx Robert Lehner [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ High-speed usersbe more efficient online with the new MSN Premium Internet Software. http://join.msn.com/?pgmarket=en-uspage=byoa/premST=1 - 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] _ Check out the new MSN 9 Dial-up fast reliable Internet access with prime features! http://join.msn.com/?pgmarket=en-uspage=dialup/homeST=1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation Multiple Pages forward-Failure
Robert, is there a reason, why you dont use DynaValidatorActionForm ? you can define in validator.xml which attributes a needed for e.g. /submit2 -- formset form name=/submit2 field depends=required,email property=email ... greetings, matthias -Original Message- From: Ben Anderson [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 5:59 PM To: [EMAIL PROTECTED] Subject: RE: Validation Multiple Pages forward-Failure struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property=action/ html:hidden property=page value=1/ ... /html:form I don's see any problem, wheres my failure? Thx Robert Lehner [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ High-speed usersbe more efficient online with the new MSN Premium Internet Software. http://join.msn.com/?pgmarket=en-uspage=byoa/premST=1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation Multiple Pages forward-Failure
using DynaValidatorActionForm would be the best way, you can use attribue page and use one Action form for all your 7 pages. tell me if you need more info, I'll describe it in details - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Re: Validation Multiple Pages forward-Failure
Hallo I'm using *.do mapping in my web.xml so I must use input=/newUser ? This does not work! Ben Anderson wrote: You want to put validate=true for the action you are submitting to. That's also where you specify the input. The input is an application relative path beginning with a /, so if you're using /do/* mapping in your web.xml you'd want something like this action name=newUserFrom path=/nextPathInProcess validate=true input=/do/newUser however, I think it's generally best to just forward back to the jsp: input=/pages/newUser.jsp I could not user input=/newuser/newUser.jsp because there is no file like newUser.jsp . I have the files index.jsp, address.jsp, services.jsp, status.jsp where I distribute the objects (name, fist name, street, city etc) from my NewUserFrom. When I mistype anything i.E. in index.jsp it should redisplay the index.jsp with the errormsg otherwise it should display the next page (address.jsp) and so on. Like in my NewUserAktion snippt down. (Also shown in the struts-validation example of the struts-distribution but without JavaScript!!) If you would see the full NewUserAction mail me and i would send it to you via pm. thx Robert Lehner From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 18:19:18 +0100 Hello I saw this in the dtd, but I don't knowe what I should enter as value of input. I tried newUser, newUser.do, newUserFrom nothing worked es expected. I would to get back the form where the validation find the failure, so the User could corret his failure an procced the applikation. BTW: I used the struts-validation exmaple as pattern. I changed in the pattern struts-config.xml at the action multiRegistration the validation to true and the applikation dosen't work any more. Why? Thx Robert Lehner Ben Anderson wrote: struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property=action/ html:hidden property=page value=1/ ... /html:form I don's see any problem, wheres my failure? Thx Robert Lehner [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ High-speed usersbe more efficient online with the new MSN Premium Internet Software. http://join.msn.com
RE: Validation Multiple Pages forward-Failure
hi enter input=/myFormular.jsp so validate goes back to formular there you can display action-messages (or even errors if you use) cheers, matthias -Original Message- From: Robert Lehner [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 7:13 PM To: Struts Users Mailing List Subject: Re: Validation Multiple Pages forward-Failure Hallo I'm using *.do mapping in my web.xml so I must use input=/newUser ? This does not work! Ben Anderson wrote: You want to put validate=true for the action you are submitting to. That's also where you specify the input. The input is an application relative path beginning with a /, so if you're using /do/* mapping in your web.xml you'd want something like this action name=newUserFrom path=/nextPathInProcess validate=true input=/do/newUser however, I think it's generally best to just forward back to the jsp: input=/pages/newUser.jsp I could not user input=/newuser/newUser.jsp because there is no file like newUser.jsp . I have the files index.jsp, address.jsp, services.jsp, status.jsp where I distribute the objects (name, fist name, street, city etc) from my NewUserFrom. When I mistype anything i.E. in index.jsp it should redisplay the index.jsp with the errormsg otherwise it should display the next page (address.jsp) and so on. Like in my NewUserAktion snippt down. (Also shown in the struts-validation example of the struts-distribution but without JavaScript!!) If you would see the full NewUserAction mail me and i would send it to you via pm. thx Robert Lehner From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 18:19:18 +0100 Hello I saw this in the dtd, but I don't knowe what I should enter as value of input. I tried newUser, newUser.do, newUserFrom nothing worked es expected. I would to get back the form where the validation find the failure, so the User could corret his failure an procced the applikation. BTW: I used the struts-validation exmaple as pattern. I changed in the pattern struts-config.xml at the action multiRegistration the validation to true and the applikation dosen't work any more. Why? Thx Robert Lehner Ben Anderson wrote: struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property
RE: Validation Multiple Pages forward-Failure
You need to have a value for the input attribute on your action mapping definition for your newUser action. When enabling validation, what struts does is that if validation fails, it does not give control to your action class but directly forwards to the target defined by the input attribute. So you would have something like this in your struts config: action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... *** Add this input=the_form_i_come_from.jsp Eric. -Original Message- From: Robert Lehner [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 4:35 PM To: Struts Users Mailing List Subject: Validation Multiple Pages forward-Failure Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false contextRelative=false/ forward name=user1 path=newuser/index.jsp redirect=false contextRealtive=false/ ... /action newuser/index.jsp snippet: ... logic:messagesPresent html:messages id=error bean:write name=error/ /html:messages /logic:messagesPresent html:form action=newUser html:hidden property=action/ html:hidden property=page value=1/ ... /html:form I don's see any problem, wheres my failure? Thx Robert Lehner [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Multiple Pages forward-Failure
Hello Matthias Wessendorf wrote: hi enter input=/myFormular.jsp so validate goes back to formular there you can display action-messages (or even errors if you use) Yes this would work if I hade one JSP-Page, but I have (now) one Form(getter and setter methods), one ActionForm and seven JSP-Pages wich are would be filled one after the other (and validated, without validation it works for now). At the end I would show all the values to the user and when submitting the entries the actionFrom should call a bussnessdelegate and store the vaules pesistent (via JDO) in a DBMS. CU Robert cheers, matthias -Original Message- From: Robert Lehner [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 7:13 PM To: Struts Users Mailing List Subject: Re: Validation Multiple Pages forward-Failure Hallo I'm using *.do mapping in my web.xml so I must use input=/newUser ? This does not work! Ben Anderson wrote: You want to put validate=true for the action you are submitting to. That's also where you specify the input. The input is an application relative path beginning with a /, so if you're using /do/* mapping in your web.xml you'd want something like this action name=newUserFrom path=/nextPathInProcess validate=true input=/do/newUser however, I think it's generally best to just forward back to the jsp: input=/pages/newUser.jsp I could not user input=/newuser/newUser.jsp because there is no file like newUser.jsp . I have the files index.jsp, address.jsp, services.jsp, status.jsp where I distribute the objects (name, fist name, street, city etc) from my NewUserFrom. When I mistype anything i.E. in index.jsp it should redisplay the index.jsp with the errormsg otherwise it should display the next page (address.jsp) and so on. Like in my NewUserAktion snippt down. (Also shown in the struts-validation example of the struts-distribution but without JavaScript!!) If you would see the full NewUserAction mail me and i would send it to you via pm. thx Robert Lehner From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 18:19:18 +0100 Hello I saw this in the dtd, but I don't knowe what I should enter as value of input. I tried newUser, newUser.do, newUserFrom nothing worked es expected. I would to get back the form where the validation find the failure, so the User could corret his failure an procced the applikation. BTW: I used the struts-validation exmaple as pattern. I changed in the pattern struts-config.xml at the action multiRegistration the validation to true and the applikation dosen't work any more. Why? Thx Robert Lehner Ben Anderson wrote: struts validation uses the input attribute of the action tag to send you back to where you came from if validation fails. Here's the excerpt from the dtd: input Module-relative path of the action or other resource to which control should be returned if a validation error is encountered. Valid only when name is specified. Required if name is specified and the input bean returns validation errors. Optional if name is specified and the input bean does not return validation errors you must specify this attribute if you want to use struts validation. -Ben From: Robert Lehner [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Validation Multiple Pages forward-Failure Date: Tue, 27 Jan 2004 14:01:16 +0100 Hello, I have a MultiPageFrom with 7 seperate JSP-Pages. I want to validate all these pages. When I run the application and whould test if the validation works well, I get the following error when I hit Submit. --- type Status report message No input attribute for mapping path /newUser description The server encountered an internal error (No input attribute for mapping path /newUser) that prevented it from fulfilling this request. --- When validate is false, it works correctly, without validation. No validation is not a solution. Some more information: NewUserAktion snippet: ... ActionErrors errors = newUserFrom.validate(mapping, request); if (errors != null errros.isEmpty()){ if (newUserFrom.getPage() == 1) return mapping.findForward(user2); ... if (newUserFrom.getPage() == 7) return mapping.findForward(success); } else { saveErrors(request, errors); if (newUserFrom.getPage() == 1) return mapping.findForward(user+newUserFrom.getPage()); if (newUserFrom.getPage() == 2) return mapping.findForward(user+newUserForm.getPage()); ... } struts-config snippet: ... action attribute=newUserFrom name=newUserFrom path=/newUser scope=session type=... validate=true forward name=success path=/index.html redirect=false