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]