You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anurag Garg <an...@nucleussoftware.com> on 2003/07/11 12:07:33 UTC

Refreshing Issue.

Hi All,

I am facing a problem in jsp page refreshing. After submitting the page to
add a new record in the database, I again display the same page with the
added record in the list. Now If I press F5 (I am not clicking the ADD
button) it again adds a new record(duplicate record) in the database, which
it should not do.

I have added the following line in my Action Class
	response.setHeader("pragma","no-cache");

I have also added the following statement in the struts-config.xml
	<controller nocache="true"/>

But still it is adding the duplicate record in the database when i press F5.
Any solution how to overcome this problem..

Thanks and Regards,
Anurag Garg


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


Re: Refreshing Issue.

Posted by Jason Lea <ja...@kumachan.net.nz>.
Hi Anurag,

Sounds like that when you reset the parameters are being resent, so the 
action 'add' action is being called again.

Struts has a way of dealing with this situation with a token stored in 
the submit form, here is a link to an earlier thread:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg68432.html

Apparently there is an example of its use in struts-example.war

-- 
Jason Lea


Anurag Garg wrote:
> Hi All,
> 
> I am facing a problem in jsp page refreshing. After submitting the page to
> add a new record in the database, I again display the same page with the
> added record in the list. Now If I press F5 (I am not clicking the ADD
> button) it again adds a new record(duplicate record) in the database, which
> it should not do.
> 
> I have added the following line in my Action Class
> 	response.setHeader("pragma","no-cache");
> 
> I have also added the following statement in the struts-config.xml
> 	<controller nocache="true"/>
> 
> But still it is adding the duplicate record in the database when i press F5.
> Any solution how to overcome this problem..
> 
> Thanks and Regards,
> Anurag Garg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 




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


Re: Refreshing Issue.

Posted by Mark Lowe <ma...@talk21.com>.
opps.. you may loss what it is your displaying if your putting it in 
the request..

in which case

..this is the action that lists all your records...
<action path="/displayList" 
type="com.sparrow.struts.DisplayListAction"...

//your forward then recalls the original action
<forward name="good" path="/displayList.do" redirect="true" />

// in your action
return (mapping.findForward("good");

would be one way of doing what you want....


On Friday, July 11, 2003, at 11:27 AM, Mark Lowe wrote:

> redirect="true" where you define your forward.
>
> //in your action
> return (mapping.findForward("good"));
>
> //Struts-config
> <forward name="good" path="/myPage.jsp" redirect="true"/>
>
> HTH mark
>
> On Friday, July 11, 2003, at 11:07 AM, Anurag Garg wrote:
>
>> Hi All,
>>
>> I am facing a problem in jsp page refreshing. After submitting the 
>> page to
>> add a new record in the database, I again display the same page with 
>> the
>> added record in the list. Now If I press F5 (I am not clicking the ADD
>> button) it again adds a new record(duplicate record) in the database, 
>> which
>> it should not do.
>>
>> I have added the following line in my Action Class
>> 	response.setHeader("pragma","no-cache");
>>
>> I have also added the following statement in the struts-config.xml
>> 	<controller nocache="true"/>
>>
>> But still it is adding the duplicate record in the database when i 
>> press F5.
>> Any solution how to overcome this problem..
>>
>> Thanks and Regards,
>> Anurag Garg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: Refreshing Issue.

Posted by Mark Lowe <ma...@talk21.com>.
redirect="true" where you define your forward.

//in your action
return (mapping.findForward("good"));

//Struts-config
<forward name="good" path="/myPage.jsp" redirect="true"/>

HTH mark

On Friday, July 11, 2003, at 11:07 AM, Anurag Garg wrote:

> Hi All,
>
> I am facing a problem in jsp page refreshing. After submitting the 
> page to
> add a new record in the database, I again display the same page with 
> the
> added record in the list. Now If I press F5 (I am not clicking the ADD
> button) it again adds a new record(duplicate record) in the database, 
> which
> it should not do.
>
> I have added the following line in my Action Class
> 	response.setHeader("pragma","no-cache");
>
> I have also added the following statement in the struts-config.xml
> 	<controller nocache="true"/>
>
> But still it is adding the duplicate record in the database when i 
> press F5.
> Any solution how to overcome this problem..
>
> Thanks and Regards,
> Anurag Garg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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