Lijuan Jing wrote:
This is a question related to action and tile.

<action path="someURL"
name="submitForm"
type="someActionClass">
<forward name="success"
path=".pages.tileDef1"/>
</action>
-------------------------------
tile definition:
<definition
name=".pages.Base" path="/pages/common/layouts/baseLayout.jsp">
<put name="footer" value="/pages/common/header.jsp" />
<put name="content" value="/pages/content/home_content.jsp" />
<put name="footer" value="/pages/common/footer.jsp" />
</definition>


<definition
name=".pages.tileDef1" extends=".pages.Base">
<put name="content" value="/pages/content/real_content.jsp" />
</definition>


After someActionClass executed successfully, it
displays page .pages.tileDef1, but the URL on browser still shows someURL. If user clicks browser's refresh button, the 'submitForm' will
be submitted again and 'someActionClass' will be
executed again which end up processing the
'submitForm' multiple times depends
on how many time user clicks refresh. It becomes worse
if the content of the form will be written to
database.


How do I know (while I am in action code) if it comes
from the real button click or the refresh button
click?


Or I could show a different URL after the form is
processed, then a dummy action has to be added. Not a
clean way to do.


<action path="someURL"
name="submitForm"
type="someActionClass">
<forward name="success"
path="/do/dummy"/>
</action>


<action path="/dummy"
name="dummyForm"
type="dummyActionClass">
<forward name="success"
path=".pages.tileDef1"/>
</action>


Thanks,
Lijuan





__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
Which method (GET or POST) are you using to submit the request? If the request will be modifying data in a database, you should be using the POST method. When issuing a reload using the POST method, browsers will display a message to the user warning that they are re-sending duplicate information.

If you want to be absolutely sure that your request is a "new" request, you will probably need to include some sort of token parameter in the request. When you generate the original form, you generate a random number. You store this number as a session attribute named "expectedToken" and send it to the user as the value of a hidden form field named "token". The user fills out the form and sends it back to you. If the "token" parameter matches the "expectedToken" attribute, then you change (or delete) the "expectedToken" attribute and process the request. If they do not match, you return a meaningful error to the user.

There is no way in standard HTTP / Servlets to distinguish between a refresh and an original request.

Jeff Beal

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to