struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yayo <eduy...@gmail.com>
Subject Re: How to redirect error message
Date Sun, 09 Dec 2007 21:16:44 GMT
Errors are stored in a request scope attribute and after a redirect they're
lost because a new request is launched by the client browser. You must
explicitly (by code) store them in a session attribute to get them in the
second request.

^^

On Dec 9, 2007 3:18 PM, Edgaras <skorpukas@yahoo.com> wrote:

> Hallo,
>
> i want to redirect my errors "together" with page redirect...:  if user is
> logged he should see message "person created" on StartPage.jsp  and  if
> not   on Login.jsp. It works if I do directly forward,  but  if i redirect
>  Login.jsp  to  StartPage.jsp  error  massege is  gone. Could you help me
> :)
>
> Thanks
>
> Edgaras
>
> struts-config.xml:
>
>
>
>    <global-forwards>
>
>
>
>        <forward
>
>            name="Start"
>
>            path="/pages/StartPage.jsp" />
>
>
>
>    </global-forwards>
>
>
>
>    <action
>
>            path="/CreatePerson"
>
>            type="actions.CreatePerson"
>
>            name="PersonForm"
>
>            input="/pages/JoinUs.jsp"
>
>            scope="request"
>
>            validate="false">
>
>
>
>        <forward
>
>            name="success_create"
>
>            path="/pages/Login.jsp" />
>
> Login.jsp:
> ....
> <logic:present name="user" scope="session">
> <logic:redirect forward="Start" />
> </logic:present>
>        <font color="red"><html:errors/></font>
> ....
>
> CreatePerson.do:
> ...
> ActionMessages errors = new ActionMessages();
> errors.add"personcrated", new ActionMessage("message.person.created"));
> saveErrors(request, errors);
> return (mapping.findForward("success_create"));
> .....
>
>
>
>
>
>
>
>
>
>
>      __________________________________________________________
> Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
>



-- 
"Sit tibi terra levis"

http://yayocaturas.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message