Re[2]: If several JSPs share the same action mapping...?
Sorry James, I don't think I described the situation to well and I'm sure there probably is a better way to handle this... Easiest way is an extreme example.. What if you had 4 different JSPs that captured the same information in a form YET everything else on the page was radically different. Upon submission, though, you want to forward all the pages to the same Action and even possibly forward all of them to the same results page. The problem(I think) is you also want to validate the form information. I'm wondering how you would get the validation to know to return back to the correct JSP page if there were validation errors? I thought you needed to provide the input=yourJsp.jsp so that it knew were to go back to, but if all 4 jsps shared this action mapping what would you put in the input=? section? (maybe I'm totally wrong and the validation doesn't need that but I thought it did). Thanks for the help, Rick On Wednesday, June 12, 2002, 3:43:18 PM, James wrote: JM Not sure why you are submitting a form from diff jsp, but one work JM around might be to forward to a known jsp JM I'm guessing that you are passing something to the action to tell it where JM you came from.. JM !-- Save mail subscription -- JM action path=/saveSubscription JMtype=org.apache.struts.webapp.example.SaveSubscriptionAction JMname=subscriptionForm JM scope=request JM input=/WEB-INF/jsp/subscription.jsp JM forward name=success path=/editRegistration.do?action=Edit/ JM forward name=fail-jsp1 path=/jsp1.jsp/ JM forward name=fail-jsp2 path=/jsp2.jsp/ JM forward name=fail-jsp3 path=/jsp3.jsp/ JM !-- or you might use a different exception -- JM exception JM key=failure.reason1 JMtype=org.apache.struts.webapp.exception.Reason1 JMpath=/jsp1.jsp/ JM /action JM I didn't actually run this.so.hope it gives you some ideas. JM James Mitchell JM Software Engineer\Struts Evangelist JM Struts-Atlanta, the Open Minded Developer Network JM http://struts-atlanta.open-tools.org -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 3:31 PM To: Struts List Subject: If several JSs share the same action mapping...? How to do you deal with the input=? parameter when setting up an action mapping that different JSPs will share? I thought this input declaration was so if you are using validation it knows which page to return to with the validation errors. How is this accomplished when you have different JSPs that could share this action mapping but also need to be validated and thus I think also require the input field to be supplied? TIA -- Rick mailto:[EMAIL PROTECTED] Maybe in order to understand mankind, we have to look at the word itself: 'Mankind'. Basically, it's made up of two separate words - 'mank' and 'ind'. What do these words mean ? It's a mystery, and that's why so is mankind. -Jack Handey -- To unsubscribe, e-mail: JM mailto:[EMAIL PROTECTED] JM For additional commands, e-mail: JM mailto:[EMAIL PROTECTED] -- Rick mailto:[EMAIL PROTECTED] It's amazing to me that one of the world's most feared diseases would be carried by one of the world's smallest animals: the real tiny dog. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re[2]: If several JSPs share the same action mapping...?
On Wednesday, June 12, 2002, 4:50:15 PM, Ted wrote: TH Each JSP can have its own action-mapping, and own input settings, and TH the rest of it, and all the action-mappings can share the same Action. Sorry if I was confusing, yes I meant JSPs sharing an action-mapping. I was trying to avoid having to write the same action-mapping over again for a few jsp's that are very similar and will end up fowarding to the same page after validation. The similar forms on each page will need to be validated though and I was just trying to find a good way to accomplish this but ran into a snag because the input has to be defined in the action-mapping that they would all share, so how would the validation know which page to return to if there were errors? TH Of course, action-mappings can also share JSPs, and so forth. There are TH no 1:1's here. TH -T. TH Rick Reumann wrote: Sorry James, I don't think I described the situation to well and I'm sure there probably is a better way to handle this... Easiest way is an extreme example.. What if you had 4 different JSPs that captured the same information in a form YET everything else on the page was radically different. Upon submission, though, you want to forward all the pages to the same Action and even possibly forward all of them to the same results page. The problem(I think) is you also want to validate the form information. I'm wondering how you would get the validation to know to return back to the correct JSP page if there were validation errors? I thought you needed to provide the input=yourJsp.jsp so that it knew were to go back to, but if all 4 jsps shared this action mapping what would you put in the input=? section? (maybe I'm totally wrong and the validation doesn't need that but I thought it did). Thanks for the help, Rick -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re[2]: If several JSPs share the same action mapping...?
On Wednesday, June 12, 2002, 5:42:27 PM, Ted wrote: TH The input property doesn't have to be a JSP. It could be another TH action. If that action had another way, besides the input TH property, to determine where to send control, it could return TH whatever ActionForward needed. Hmmm, actually I easily have a way to determine where to send control since there already is a field in the DynaForm that ends up dictating the initial page to go to in the first place. I didn't know I could use an Action as an input property. If that's the case then I would think, after I put an Action in the input property, I could use this Action to check the field in the DynaForm and call the appropriate ActionForward which would return me to the correct page and display my validation errors? --- Rick TH One nasty kludge would be to put the name of the JSP into the file as a TH hidden property. The action would then know to look for that propery and TH could create an ActionForward back to it. You could also try looking at TH the refer header, but I don't know how reliable that would be. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Re[2]: If several JSPs share the same action mapping...?
Rick, if you have multiple JSPs all using the same action and need to determine where to send the user upon a validation error, why not just have several action mappings and explicitely define the appropriate input path for each one. That's what the action mappings are for. I don't think it is necessarily bad to have a bunch of action mappings. IMHO, I would rather have multiple action mappings than a code kludge. My advice would be to use the framework. You can always use a tool to manage your struts-config file. I do this very thing for my project. I have productized download screens that all use the same download action. If an error occurs, I need to send them back to the correct product download screen. Using multiple action mappings that all map to the same action but have different inputs defined has made this extremely easy. No kludge at all. Just my .02. robert -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 5:58 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re[2]: If several JSPs share the same action mapping...? On Wednesday, June 12, 2002, 5:42:27 PM, Ted wrote: TH The input property doesn't have to be a JSP. It could be another TH action. If that action had another way, besides the input TH property, to determine where to send control, it could return TH whatever ActionForward needed. Hmmm, actually I easily have a way to determine where to send control since there already is a field in the DynaForm that ends up dictating the initial page to go to in the first place. I didn't know I could use an Action as an input property. If that's the case then I would think, after I put an Action in the input property, I could use this Action to check the field in the DynaForm and call the appropriate ActionForward which would return me to the correct page and display my validation errors? --- Rick TH One nasty kludge would be to put the name of the JSP into the file as a TH hidden property. The action would then know to look for that propery and TH could create an ActionForward back to it. You could also try looking at TH the refer header, but I don't know how reliable that would be. -- 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]