Multiple Error Pages
Hi All, i wanted to know if it is possible to have multiple error pages in the application, where two jsps are using the same action servlet and the form bean. the validation in both are seperate ( NOT JAVA SCRIPT VALIDATION ) and i want them to return to two different pages in case of errors. that is if there is an error on submitting i want the page to return to respective jsp page. Thanks in advance, Niel.
Multiple error pages from validate method
Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help??
Re: Multiple error pages from validate method
Here's one hacky way of doing this: Set a request attribute, something like goToErrorPage2 right after you validate. On the top of the error page if that attribute goToErrorPage2 is nonnull, then forward to the second error page else simply render the normal error page.. [EMAIL PROTECTED] wrote: Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help?? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple error pages from validate method
Thanks geeta! Yes that might be a roundabout way of doing it.Lemme try! Geeta Ramani [EMAIL PROTECTED] 10/24/2003 02:36 PM Please respond to Struts Users Mailing List To: Struts Users Mailing List [EMAIL PROTECTED] cc: Subject:Re: Multiple error pages from validate method Here's one hacky way of doing this: Set a request attribute, something like goToErrorPage2 right after you validate. On the top of the error page if that attribute goToErrorPage2 is nonnull, then forward to the second error page else simply render the normal error page.. [EMAIL PROTECTED] wrote: Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help?? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple error pages from validate method
Here's another way that I can think of: I'm assuming you will have 2 actions (one for add and one for edit) or a single action that uses a lookupdispatch add/edit handling. In either case don't have validate=true in your struts-config but rather do the validation from your action method: public ActionForward addAction() { ActionErrors errors = myBean.validate(...); if( errors != null !errors.isEmpty()) { return aMapping.findForward(ERROR_PAGE_ADD); } } Do the same for edit. Of course there are a lot of other ways to do this as well. -Tim -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2003 3:36 PM To: Struts Users Mailing List Subject: Re: Multiple error pages from validate method Here's one hacky way of doing this: Set a request attribute, something like goToErrorPage2 right after you validate. On the top of the error page if that attribute goToErrorPage2 is nonnull, then forward to the second error page else simply render the normal error page.. [EMAIL PROTECTED] wrote: Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help?? - 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: Multiple error pages from validate method
Thanks Tim.This too makes good sense..thanks Chen, Gin [EMAIL PROTECTED] 10/24/2003 02:45 PM Please respond to Struts Users Mailing List To: 'Struts Users Mailing List' [EMAIL PROTECTED] cc: Subject:RE: Multiple error pages from validate method Here's another way that I can think of: I'm assuming you will have 2 actions (one for add and one for edit) or a single action that uses a lookupdispatch add/edit handling. In either case don't have validate=true in your struts-config but rather do the validation from your action method: public ActionForward addAction() { ActionErrors errors = myBean.validate(...); if( errors != null !errors.isEmpty()) { return aMapping.findForward(ERROR_PAGE_ADD); } } Do the same for edit. Of course there are a lot of other ways to do this as well. -Tim -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2003 3:36 PM To: Struts Users Mailing List Subject: Re: Multiple error pages from validate method Here's one hacky way of doing this: Set a request attribute, something like goToErrorPage2 right after you validate. On the top of the error page if that attribute goToErrorPage2 is nonnull, then forward to the second error page else simply render the normal error page.. [EMAIL PROTECTED] wrote: Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help?? - 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: Multiple error pages from validate method
Ah! I was assuming that the original poster was validating in the form bean..:) Chen, Gin wrote: Here's another way that I can think of: I'm assuming you will have 2 actions (one for add and one for edit) or a single action that uses a lookupdispatch add/edit handling. In either case don't have validate=true in your struts-config but rather do the validation from your action method: public ActionForward addAction() { ActionErrors errors = myBean.validate(...); if( errors != null !errors.isEmpty()) { return aMapping.findForward(ERROR_PAGE_ADD); } } Do the same for edit. Of course there are a lot of other ways to do this as well. -Tim -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2003 3:36 PM To: Struts Users Mailing List Subject: Re: Multiple error pages from validate method Here's one hacky way of doing this: Set a request attribute, something like goToErrorPage2 right after you validate. On the top of the error page if that attribute goToErrorPage2 is nonnull, then forward to the second error page else simply render the normal error page.. [EMAIL PROTECTED] wrote: Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help?? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple error pages from validate method
The input page is specified in the action mapping. Use separate action mappings for each input page (add.jsp and edit.jsp). You can use the same Action class for both. -Max - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 24, 2003 12:15 PM Subject: Multiple error pages from validate method Hello, I am using one ActionForm bean for multiple pages..say for add.jsp and edit.jsp.But when I validate and I get an error I want the user to go to different error pages instead of one just specified in struts-config file as input parameter? Can somebody help?? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple error pages for a single action mapping
I'm sorry, but I'm not quite sure I understand the response. I don't know what the item is that I need to include on this single error page you refer to. Also, I'm not sure I understand what the criteria is . What I _think_ you mean is that I'm to include all error reporting from what would be multiple error pages onto a single one. Please correct if this assumption is wrong. The cruxt of my problem though is the fact that I _don't_ want a single error page. Most of the examples I've seen, as well as follow the pattern of reporting errors on the same page that failed validation. The problem is that the examples only include 1 .jsp page, and so naturally using the input attribute of the action mapping makes sense. If they've only got one page to go through, any errors can be returned back to that page via the input attribute. But the problem is that when you get into multiple pages, the input attribute can't be used. Say a user is in the middle of a multi-page registration process. If the user makes a mistake on page4.jsp, they should be returned to page4.jsp, and have those errors reported on that page. And so my question from all this is basically, what's the best way to do this? Carl -Original Message- From: adam [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 6:30 PM To: Struts Users Mailing List Subject: Re: Multiple error pages for a single action mapping Remember, one error page can just be use a simple include based on your error criteria for multiple other error pages. Schmidt, Carl wrote: Thank you for the reply. However, isn't setInput essentially setting the input attribute of the action mapping tag in struts-config.xml? In other words, since the action mapping is part of a global collection, will the setInput changes be reflected to any other users on the site, accessing these pages? Carl -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 12:08 PM To: [EMAIL PROTECTED] Subject: Multiple error pages for a single action mapping Hi I believe you are checking you inputs while you going through the pages. E.g..: page2 checking for date-of-birth or it's format. When you checking this you could say something like mapping.setInput(/page2.jsp); instead of setting your input page on struts-config action. I hope this will help. Anton M David Developer IS Solutions Plc Switchboard: 01932-89 Direct: 01932-893370 Fax: 01932-893433 Mobile: 07880771179 Email: [EMAIL PROTECTED] http://www.issolutions.co.uk UK Registered Office, Windmill House, 91 - 93 Windmill Road, Sunbury on Thames, Middlesex TW16 7EF Company registration number 1892751 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Multiple error pages for a single action mapping
Thank you for the reply. However, isn't setInput essentially setting the input attribute of the action mapping tag in struts-config.xml? In other words, since the action mapping is part of a global collection, will the setInput changes be reflected to any other users on the site, accessing these pages? Carl -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 12:08 PM To: [EMAIL PROTECTED] Subject: Multiple error pages for a single action mapping Hi I believe you are checking you inputs while you going through the pages. E.g..: page2 checking for date-of-birth or it's format. When you checking this you could say something like mapping.setInput(/page2.jsp); instead of setting your input page on struts-config action. I hope this will help. Anton M David Developer IS Solutions Plc Switchboard: 01932-89 Direct: 01932-893370 Fax: 01932-893433 Mobile: 07880771179 Email: [EMAIL PROTECTED] http://www.issolutions.co.uk UK Registered Office, Windmill House, 91 - 93 Windmill Road, Sunbury on Thames, Middlesex TW16 7EF Company registration number 1892751 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Multiple error pages for a single action mapping
Remember, one error page can just be use a simple include based on your error criteria for multiple other error pages. Schmidt, Carl wrote: Thank you for the reply. However, isn't setInput essentially setting the input attribute of the action mapping tag in struts-config.xml? In other words, since the action mapping is part of a global collection, will the setInput changes be reflected to any other users on the site, accessing these pages? Carl -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 12:08 PM To: [EMAIL PROTECTED] Subject: Multiple error pages for a single action mapping Hi I believe you are checking you inputs while you going through the pages. E.g..: page2 checking for date-of-birth or it's format. When you checking this you could say something like mapping.setInput(/page2.jsp); instead of setting your input page on struts-config action. I hope this will help. Anton M David Developer IS Solutions Plc Switchboard: 01932-89 Direct: 01932-893370 Fax: 01932-893433 Mobile: 07880771179 Email: [EMAIL PROTECTED] http://www.issolutions.co.uk UK Registered Office, Windmill House, 91 - 93 Windmill Road, Sunbury on Thames, Middlesex TW16 7EF Company registration number 1892751 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Multiple error pages for a single action mapping
I have a reset password section of the web site where the user must go through a set of pages, verifying their information and then have their password reset. Each page submits to the same action mapping, and I have a session bean that tracks answers to each of the questions on each page. As each page is validated though, all I can use is just one input tag in the action mapping to return the user back to some central error page. What I'd like to do is return the user back to the page which contained the errors, dispaying the errors at the top. How do I do this? Carl -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]