To preserve messages across redirects, you need to do a little magic.

Struts 1.2 does not have the automatic ability to put messages into session
scope if validation fails. Instead, you should customize the Controller
(through a subclass you write) to copy any messages from the request into
the session if they are unaccessed. You should customize processValidate to
do something similar:

ActionErrors errors = validation.
if (errors are found) {
  if (errors are unaccessed) {
    create session if necessary;
    copy them to session;
}

This will be a standard part of the upcoming 1.4 release.

Paul

On 9/19/07, abhiram <[EMAIL PROTECTED]> wrote:
>
> it is struts 1.2, and my application server is tomcat 5.5.9
>
> Paul Benedict <[EMAIL PROTECTED]> wrote: What ver of Struts?
>
> On 9/19/07, abhiram  wrote:
> >
> > Hi!! your method works..but i am not able to see my error message..
> > i mean.. i want it to work like javascript... like display the err mesg
> > when validation fails, and once i refresh the page, display the page
> without
> > error message(the original input page)..,with url intact.
> >
> > may seem like i am greedy.. but i just want to know if it is possible..
> >
> > and thanks for such a prompt reply sir.
> >
> > Paul Benedict
> wrote: You can do it, but it's a
> > little bit more work.
> >
> > 1) Set inputForward=true on the Controller
> > 2) Convert your input attributes on the action mapping to refer to a
> > mapping
> > name.
> > 3) Add a corresponding forward.
> >
> > Example:
> >
> >
> >
> >
> >
> >
> > Paul
> >
> > On 9/19/07, abhiram  wrote:
> > >
> > > HII! i have a small doubt.. when i submit a form from a jsp called
> > > LoginForm.jsp, and if the validation fails in the validate() method of
> > the
> > > ActionForm, I am being shown LoginForm.jsp, but with URL as
> > LoginAction.do.
> > > How to avoid this ? i want it to be shown as LoginForm.jsp. can we
> > > redirect to input page after validation fails ?
> > >
> > > this is happening even after i refresh the page.. and even the error
> > > message(the custom message we try to put in the input page when a
> > validation
> > > fails) doesn't go.
> > >
> > > please help.
> > > thanks,
> > > abhiram
> > >
> > >
> > > ---------------------------------
> > > Get the freedom to save as many mails as you wish. Click here to know
> > how.
> >
> >
> >
> >       abhiram
> >
> >
> >
> >
> >
> > ---------------------------------
> > Unlimited freedom, unlimited storage. Get it now
>
>
>
>
>       abhiram
>
>
>
>
>
> ---------------------------------
> Get the freedom to save as many mails as you wish. Click here to know how.

Reply via email to