Karan, I think you missed the point a little bit. I'll leave the discussion of whether it's a good idea to let the user access a JSP page directly or not out of this. Truly, there is nothing wrong with doing that if all you are doing is setting up the form on that page. But, leaving that aside... I am not really following you when you say "action bean" and making sure your variables are set up correctly.
The point of all this was to solve the problem of potentially confusing the user who will see the same page in front of them, but the URL will be different. In your case, your form will redisplay with some error messages on it but the URL will end in adduser.do. The truth is that I am myself not so sure this is such a big deal and would confuse the user that much. Someone I know contends that it is and wanted to know if there was a workaround to make struts keep the original URL in place. IMHO, all this is really academic since I would never want to store the form data on the session unless there was some pressing need to do this. Just to avoid this possible confusing seems not worth it. But... if it was or wasn't a good idea wasn't the question. :) Thanks, Yaakov. -----Original Message----- From: Karan [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 08, 2005 4:48 PM To: Struts Users Mailing List Subject: Re: Redirecting back to input This method will cause an actual redirect, and so, the user will see the correct name of the action in the address bar. But it IS a bad idea to be showing the url of the webpage. If you can, you want to use only action URLs, because in ur action bean you can check if u have ur variables set up correctly etc etc, which being unset would cause mayhem on a webopage. Also its supposed to reset the request variables, but I have not yet faced a problem. I hardly save any variables in the session scope -- most of the times, i save my objects in the request scope only. Also, instead of using ActionErrors, a more elegant approach is to forward to the same action which calls the form-bean, for example: <action path="/main" type="okay.beans.MainAction"> <forward name="success" path="/main.ftl"/> </action> <action path="/adduser" input="/main.ftl" type="okay.beans.UsersAction" name="usersForm" validate="true" scope="request"> <forward name="error" path="/main.do" redirect="true"/> <forward name="success" path="/next.do"/> </action> So everytime I forward to main.do, I can display my webpage which is main.ftl (freemarker), which actually the user does not know even exists. And after performing the requested action, I can either display my form again (in case of an error) or move on. Someone, plz correct me if im wrong. Karan Joe Germuska wrote: > At 4:34 PM -0500 2/7/05, Chaikin, Yaakov Y. wrote: > >> Actually, I traced this in code also and I think it already does >> mapping.findForward(input) inside.... >> >> In either case, how could you specify to Struts to construct a >> ForwardConfig >> object with redirect=true?? > > > Either nested within an <action> element, or in <global-forwards>, > simply use: > <forward name="foo" path="/bar" redirect="true" /> > > Joe > > > >> Thanks, >> Yaakov. >> >> -----Original Message----- >> From: Joe Germuska [mailto:[EMAIL PROTECTED] >> Sent: Monday, February 07, 2005 4:03 PM >> To: Jeff Beal; user@struts.apache.org >> Subject: Re: Redirecting back to input >> >> At 3:32 PM -0500 2/7/05, Jeff Beal wrote: >> >>> I looked at the source of the RequestProcessor.processValidate() >>> method, and it certainly doesn't look like there's any way to >>> redirect on validation error without modifying the behavior there. >> >> >> I think that if in your <controller> element in Struts config, you use: >> <set-property property="inputForward" value="true" /> >> >> then Struts will do a "mapping.findForward(input)" upon validation >> failure. This forward could be defined with "redirect='true'" >> >> That doesn't help with getting the errors stored in session scope >> instead of request scope, though. >> >> Joe >> >> -- >> Joe Germuska >> [EMAIL PROTECTED] >> http://blog.germuska.com >> "Narrow minds are weapons made for mass destruction" -The Ex >> >> --------------------------------------------------------------------- >> 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] > > > > -- > Joe Germuska > [EMAIL PROTECTED] > http://blog.germuska.com > "Narrow minds are weapons made for mass destruction" -The Ex > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > . > -- CM II Resolution Systems Inc. /-- never compromise. what if you compromise and lose? --/ --------------------------------------------------------------------- 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]