struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hubert Rabago <jakartau...@yahoo.com>
Subject Re: forward vs redirect ?
Date Mon, 01 Dec 2003 16:51:56 GMT
Hi Caroline,

I sent you a struts war file ready to deploy.  It includes all source files. 
Call up the displayItem.do, enter a bid amount, submit the form, then refresh on
the resulting page.  Both action objects do a System.out.println when they're
called.  When you refresh the page after submitting the bid, you'll see that
displayItem.do is the only one being called, and that the address bar will show
the displayItem.do URL.
I ran this in Tomcat 4.1.x.
Please reply to this mailing list so others can help if there are issues.

Here's the mappings:
    <action-mappings>
        <action path="/displayItem"
            type="com.hkrabago.redirect.DisplayItem">
            <forward name="doDisplay" path="/item.jsp"/>
        </action>
        <action path="/processBid"
            type="com.hkrabago.redirect.ProcessBid">
            <forward name="doRedirect" path="/displayItem.do" redirect="true"/>
        </action>
    </action-mappings>

Hubert

--- Caroline Lauferon <caroline.lauferon@cgey.com> wrote:
> > For example, say i had an action which saved some details from a form to a
> > database. if the page is not redirected then if the user were to refresh
> the
> > page, the action would be called again and the data saved again. This
> > obviously i would not want the user to do so in this case i redirect the
> > page, so that if the user were to refresh the page, the save action would
> > not be called again.
> 
> I'm not sure I understand what you mean. The case you describe is very close
> to mine, and so I would like to prevent the user from making twice the
> addition on refresh:
> I've got one first form, Form1, which calls Action1:
> <action path="/action1" name="Form1" type="actions.Action1" scope="session"
> input="/form1.jsp">
>     <forward name="ok" path="page2.jsp" redirect="true"/>
> </action>
> 
> but once the user is on page2, if he makes a refresh, action1 is called
> again.... and the data added by action1 is added once more....
> 
> What didn't I understand?
> Thanks
> Caroline
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message