Re: Action input
Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? I create distinct mapping for each page/form on which the action can be reached. Each action has the same type attribute, but different path (ofcoz) and different input. Hth, Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action input
The only way I found was to do the following: Turn on validate. Don't return the errors generated, put them in the request under the Globals.ERRORS_KEY. This way, the ActionServlet will not return immediately to prior page but the ErrorsTag will still know where to find the errors. Save the last action map in your form in the prior action. All you need is the string. At the start of your action pull the errors from the request, if there are any errors, and return to the mapping you saved in your prior action. Not to straight forward but not a big deal either. Edgar -Original Message- From: Sri Sankaran [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 26, 2003 9:41 PM To: 'Struts Users Mailing List' Subject: RE: Action input If your intent is to re-use the same action class you can simply create an action mapping for each usage. The only thing that has to be unique is the path. Each action mapping can, of course, define it's own input attribute; effectively providing the dynamism you seek. Sri -Original Message- From: harish krishnaswamy [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 26, 2003 8:30 PM To: [EMAIL PROTECTED] Subject: Action input Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.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: Action input
Well you could fake it maybe? In one.jsp point your form to action1, in two.jsp point it to action2. However in struts-config.xml just map action1 and action2 both to the same action class with appropriate input fields. This ought to work I think. (And if it doesn't, I already have an excuse..;)) But maybe you wanted a slicker solution..? Maybe there is one in Struts1.1.. Regards, Geeta harish krishnaswamy wrote: Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.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: Action input
Or you could have a custom action for each screen, all exactly the same except for the defined success forward and the input screen -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Thursday, 27 February 2003 12:48 PM To: Struts Users Mailing List Subject: Re: Action input Well you could fake it maybe? In one.jsp point your form to action1, in two.jsp point it to action2. However in struts-config.xml just map action1 and action2 both to the same action class with appropriate input fields. This ought to work I think. (And if it doesn't, I already have an excuse..;)) But maybe you wanted a slicker solution..? Maybe there is one in Struts1.1.. Regards, Geeta harish krishnaswamy wrote: Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action input
If your intent is to re-use the same action class you can simply create an action mapping for each usage. The only thing that has to be unique is the path. Each action mapping can, of course, define it's own input attribute; effectively providing the dynamism you seek. Sri -Original Message- From: harish krishnaswamy [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 26, 2003 8:30 PM To: [EMAIL PROTECTED] Subject: Action input Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.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: Action input
I actualy had a similar question before and the answer I came up with was to describe that universal action in struts-config w/o input and forwards, then define the views/jsp pages this action will be called from as global forwards and then use the global forwards aliases as a value passed as parameter to the action. example: in struts-config.xml global-forwards forward name=home path=/index.jsp/ forward name=rv path=/registrationView.jsp/ /global-forwards action path=/myAction type=MyAction name=myActionForm scope=request /action public final class MyActionForm extends ActionForm { // view private String view; public void setView(String val){ this.view = val; } public String getView(){ return view; } } public final class MyAction extends Action{ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String view = ((MyActionForm)form).getView(); ... return mapping.findForward(view); } } so in your index.jsp a href=/myAction.action?view=homeprocess/a in registrationView.jsp a href=/myAction.action?view=rvprocess/a so you defined one action and the user still will not see the real view names. If anybody has a better solution besides extending ActionServlet , let me know beacuse I'd like to make it more efficient. Cheers, Ivan - Original Message - From: harish krishnaswamy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 26, 2003 8:29 PM Subject: Action input Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.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: Action input
Create an action that has no input and validate is false. In this action you call validate on the form and check the return value. Then create a forward using request.getRequestURI() if is fails otherwise go to a forward you have defined that matches the request.getRequestURI() or some you can easily derive from the request.getRequestURI(). -Original Message- From: harish krishnaswamy [mailto:[EMAIL PROTECTED] Sent: 27 February, 2003 03:30 To: [EMAIL PROTECTED] Subject: Action input Is there a way of providing the action input in a dynamic fashion? In other words, if I had the same action being submitted from multiple pages/forms, how would I go back to the page/form I came from? __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relating to the official business of Standard Bank Group Limited is proprietary to the company. It is confidential, legally privileged and protected by law. Standard Bank does not own and endorse any other content. Views and opinions are those of the sender unless clearly stated as being that of Standard Bank. The person addressed in the e-mail is the sole authorised recipient. Please notify the sender immediately if it has unintentionally reached you and do not read, disclose or use the content in any way. Standard Bank can not assure that the integrity of this communication has been maintained nor that it is free of errors, virus, interception or interference. __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Display values after validation (was RE: action input)
But by using an action path for input instead of a JSP, isn't the ActionForm reset, so you no longer have your form values to show in the JSP again? How do you redisplay the incorrect values the user typed into the JSP? Susan Bradeen On 01/16/2003 03:22:14 PM Mark Galbreath wrote: Try it and see. input is the application-relative path to the input form to which control should be returned if a validation error is encountered and you have to specify the name attribute of the form bean associated with the action. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- 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: Display values after validation (was RE: action input)
2003. január 17. 14:22 dátummal Susan Bradeen ezt írtad: But by using an action path for input instead of a JSP, isn't the ActionForm reset, so you no longer have your form values to show in the JSP again? How do you redisplay the incorrect values the user typed into the JSP? The request is the same, so all the paramers are still in the request, and they will be populated. Hth, Tib -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Display values after validation (was RE: action input)
It only resets numeric. For example, there is an amount property of your bean which is a Double. If you enter abc and submit, abc is reset to 0.0. To avoid this, change Double to String so struts can keep the original value. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Susan Bradeen [mailto:[EMAIL PROTECTED]] Sent: January 17, 2003 8:23 AM To: Struts Users Mailing List Subject: Display values after validation (was RE: action input) But by using an action path for input instead of a JSP, isn't the ActionForm reset, so you no longer have your form values to show in the JSP again? How do you redisplay the incorrect values the user typed into the JSP? Susan Bradeen On 01/16/2003 03:22:14 PM Mark Galbreath wrote: Try it and see. input is the application-relative path to the input form to which control should be returned if a validation error is encountered and you have to specify the name attribute of the form bean associated with the action. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- 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: Display values after validation (was RE: action input)
Susan, since the request is being forwarded (and not redirected) , then it (the request) still contains the invalid user input and although the form is being reset, since the request still has the user input, the form fields should be repopulated with the users original (incorrect) values. robert -Original Message- From: Susan Bradeen [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 8:23 AM To: Struts Users Mailing List Subject: Display values after validation (was RE: action input) But by using an action path for input instead of a JSP, isn't the ActionForm reset, so you no longer have your form values to show in the JSP again? How do you redisplay the incorrect values the user typed into the JSP? Susan Bradeen On 01/16/2003 03:22:14 PM Mark Galbreath wrote: Try it and see. input is the application-relative path to the input form to which control should be returned if a validation error is encountered and you have to specify the name attribute of the form bean associated with the action. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- 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: Display values after validation (was RE: action input)
Like I said, Try it and see. I've never tried it, and apparently no one else here has either. Let us know how it turns out. Mark -Original Message- From: Susan Bradeen [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 8:23 AM But by using an action path for input instead of a JSP, isn't the ActionForm reset, so you no longer have your form values to show in the JSP again? How do you redisplay the incorrect values the user typed into the JSP? Susan Bradeen On 01/16/2003 03:22:14 PM Mark Galbreath wrote: Try it and see. input is the application-relative path to the input form to which control should be returned if a validation error is encountered and you have to specify the name attribute of the form bean associated with the action. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- 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: Display values after validation (was RE: action input)
Yep, works fine. Quite impressive, saves some work. I ended up having an issue with a custom record lock when trying to fetch information for editing a second time. Not a Struts issue! Thank you to all who replied. Susan Bradeen Mark Galbreath [EMAIL PROTECTED] 01/17/2003 09:32 AM Please respond to Struts Users Mailing List To: 'Struts Users Mailing List' [EMAIL PROTECTED] cc: Subject:RE: Display values after validation (was RE: action input) Like I said, Try it and see. I've never tried it, and apparently no one else here has either. Let us know how it turns out. Mark -Original Message- From: Susan Bradeen [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 8:23 AM But by using an action path for input instead of a JSP, isn't the ActionForm reset, so you no longer have your form values to show in the JSP again? How do you redisplay the incorrect values the user typed into the JSP? Susan Bradeen On 01/16/2003 03:22:14 PM Mark Galbreath wrote: Try it and see. input is the application-relative path to the input form to which control should be returned if a validation error is encountered and you have to specify the name attribute of the form bean associated with the action. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: action input
yes Brandon Goodin Phase Web and Multimedia P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 12:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: action input
Try it and see. input is the application-relative path to the input form to which control should be returned if a validation error is encountered and you have to specify the name attribute of the form bean associated with the action. Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: action input
Yes. The input attribute can point to JSPs as well as actions. Make sure the input attribute begins with the / character (/mypage.jsp or /myAction2.do) - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 1:58 PM Subject: action input action path=/myAction type=fully.qualified.action.class.name input=mypage.jsp Can I set input=myAction2.do? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.435 / Virus Database: 244 - Release Date: 1/2/2003 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]