You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by senthil Kumar <se...@tarangtech.com> on 2005/07/14 10:54:25 UTC

How to avoid calling .do again once click F5 button.

Hi All.,

In our application, I hava a list of tasks. Each task have a chech box and once checked the check box and click "AddAlert" button,  alert for the checked task is created.

Up to this functionality working fine for me.

 My problem is once creating alert and unfortunately click F5 button, again the alert is created for the same task  i.e the same alert action(.do) calling again.


How to avoid it.
any one help me.


Thanks in advance.


Regs.,
Senthil S




This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents.

Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved

Re: How to avoid calling .do again once click F5 button.

Posted by Martin Gainty <mg...@hotmail.com>.
Indeed
The intricacies of session scoped beans vs request scoped beans with regards 
to the security enforcement provisions of the transaction token are explored 
at
http://www.netspread.com/tips2.html
Please keep us apprised as to how you make out,
Martin-
----- Original Message ----- 
From: "Yaroslav Novytskyy" <sp...@n-ix.com.ua>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, July 14, 2005 5:44 AM
Subject: Re: How to avoid calling .do again once click F5 button.


> Hello!
>
> I would advise to use synchronization via Session tockens. (I'm working at 
> this process' automation at the moment). Struts' Action already has, what 
> is needed for this are saveToken() and isTokenValid() methods.
>
> This technique makes it imposible to execute an action more then once (if 
> not on purpouse) exclueding double-submits, refreshes, by-bookmark-visits.
>
> Read the doc and check if that is what you need. And if yes, you can take 
> look in my two days old message titled "synchronization strategies" - I 
> beleave most answers (along with some questions :) ) are there.
>
> Yaroslav Novytskyy
>
> Leon Rosenberg wrote:
>> before Michael jumps on the train :-)
>>
>> simply send a redirect after executing create action to the list action
>> again?
>>
>> regards
>> Leon
>>
>> On Thu, 2005-07-14 at 14:24 +0530, senthil Kumar wrote:
>>
>>>Hi All.,
>>>
>>>In our application, I hava a list of tasks. Each task have a chech box 
>>>and once checked the check box and click "AddAlert" button,  alert for 
>>>the checked task is created.
>>>
>>>Up to this functionality working fine for me.
>>>
>>> My problem is once creating alert and unfortunately click F5 button, 
>>> again the alert is created for the same task  i.e the same alert 
>>> action(.do) calling again.
>>>
>>>
>>>How to avoid it.
>>>any one help me.
>>>
>>>
>>>Thanks in advance.
>>>
>>>
>>>Regs.,
>>>Senthil S
>>>
>>>
>>>
>>>
>>>This e-mail and any files transmitted with it are for the sole use of the 
>>>intended recipient(s) and may contain confidential and privileged 
>>>information. If you are not the intended recipient or received it in 
>>>error, please contact the sender by reply e-mail and destroy all copies 
>>>of the original message. Please do not copy it for any purpose or 
>>>disclose its contents.
>>>
>>>Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights 
>>>Reserved
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


Re: How to avoid calling .do again once click F5 button.

Posted by Michael Jouravlev <jm...@gmail.com>.
I guess it is easier to repost, than to explain how to search mailing
list. Rick, Leon, you already have read this ;)

=== cut here ===
Tokens are better solution than nothing, but not the best. Token
works *after* POST request has been resubmitted. It can help to
prevent *data resubmission* on business/persisntence layer, but it
does nothing to prevent browser message: "Do you want to resend
POSTDATA?" What? What is POSTDATA? I don't care what it is, and I
don't know do I want to resend it or not, just show the damn page. The
simple "send POST, get page" approach results in horrible UI, like I
had to go through when I was ordering parts for my car. Car make->POST
form. Model->POST form. Year->POST form. Suspension part->POST form.
Struts (no put intended)->POST form -> (looking for Tokico struts,
don't see any). Go Back. "Do you want to resend POSTDATA?" - No -> I
see the same page. Back again. "Do you want to resend POSTDATA?" - Yes
-> The previous page is reloaded with the same POST, running the same
query on the server. Same happens three or four more times. I wanted
to strangle the programmer who desinged that. Right, if pages were
cachable, it would help. Or if I used Opera. But this is only one
example of many. In other cases Opera caching does not help, it gets 
in the way.

Another example. You want to log in. You enter name, it is incorrect,
it is redisplayed. Again, and again, and again. You decided to drop
the idea, and to return back. How many times you need to click Back?

Also, token knows nothing about your business data. You are
shopping in the online store. You selected item, clicked "Add to
cart", it was added, and you forwarded to another page. Then you
realised that you need two of them. You click Back, see the same item
again and click "Add to cart". Now it tells you that you cannot do
this, because you are resubmitting the same request, apparently by
mistake. Your webapp can prove it to you, it has the freaking token. 
But it is not a mistake, you actually want to add the same item again.

So, tokens better than nothing, like Yugo comparing to bike. But it is
still a Yugo.
=== cut here ===

Michael

On 7/14/05, Yaroslav Novytskyy <sp...@n-ix.com.ua> wrote:
> Hello!
> 
> I would advise to use synchronization via Session tockens. (I'm working
> at this process' automation at the moment). Struts' Action already has,
> what is needed for this are saveToken() and isTokenValid() methods.
> 
> This technique makes it imposible to execute an action more then once
> (if not on purpouse) exclueding double-submits, refreshes,
> by-bookmark-visits.
> 
> Read the doc and check if that is what you need. And if yes, you can
> take look in my two days old message titled "synchronization strategies"
> - I beleave most answers (along with some questions :) ) are there.
> 
> Yaroslav Novytskyy
> 
> Leon Rosenberg wrote:
> > before Michael jumps on the train :-)
> >
> > simply send a redirect after executing create action to the list action
> > again?
> >
> > regards
> > Leon
> >
> > On Thu, 2005-07-14 at 14:24 +0530, senthil Kumar wrote:
> >
> >>Hi All.,
> >>
> >>In our application, I hava a list of tasks. Each task have a chech box and once checked the check box and click "AddAlert" button,  alert for the checked task is created.
> >>
> >>Up to this functionality working fine for me.
> >>
> >> My problem is once creating alert and unfortunately click F5 button, again the alert is created for the same task  i.e the same alert action(.do) calling again.
> >>
> >>
> >>How to avoid it.
> >>any one help me.
> >>
> >>
> >>Thanks in advance.
> >>
> >>
> >>Regs.,
> >>Senthil S
> >>
> >>
> >>
> >>
> >>This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents.
> >>
> >>Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


what's wrong with this simple code

Posted by Vicky <ja...@yahoo.com>.
I don't see anything displayed on jsp with below
simple code in my struts action class. 
 
MenuComponent mc = new MenuComponent(); 
mc.setName("Menu 1"); 
mc.setLocation("Menu 1"); 
mc.setTitle("Menu 1"); 
 
MenuComponent mc2 = new MenuComponent(); 
mc2.setName("Menu 2"); 
mc2.setLocation("Menu 2"); 
mc2.setTitle("Menu 3"); 
 
mc2.setParent(mc); 
 
repository.addMenu(mc); 
 
session.setAttribute("changeMgmtRepository",
repository); 
 
///jsp 
all required tag libs, imports in jsp and below code. 
 
<body> 
<div class="dynamicMenu tree">  
<menu:useMenuDisplayer name="ListMenu"
repository="changeMgmtRepository">  
 
<c:forEach var="menu" items="${repository.topMenus}"> 
<menu-el:displayMenu name="${menu.name}"/> 
</c:forEach> 
 
</menu:useMenuDisplayer> 
 
</div> 
</body>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


RE: How to avoid calling .do again once click F5 button.

Posted by parimal <pa...@mahindrabt.com>.
Yes I do believe using tokens is a cleaner way

rgds
parimal

-----Original Message-----
From: Yaroslav Novytskyy [mailto:sp_ynovytskyy@n-ix.com.ua]
Sent: Thursday, July 14, 2005 3:15 PM
To: Struts Users Mailing List
Subject: Re: How to avoid calling .do again once click F5 button.


Hello!

I would advise to use synchronization via Session tockens. (I'm working
at this process' automation at the moment). Struts' Action already has,
what is needed for this are saveToken() and isTokenValid() methods.

This technique makes it imposible to execute an action more then once
(if not on purpouse) exclueding double-submits, refreshes,
by-bookmark-visits.

Read the doc and check if that is what you need. And if yes, you can
take look in my two days old message titled "synchronization strategies"
- I beleave most answers (along with some questions :) ) are there.

Yaroslav Novytskyy

Leon Rosenberg wrote:
> before Michael jumps on the train :-)
>
> simply send a redirect after executing create action to the list action
> again?
>
> regards
> Leon
>
> On Thu, 2005-07-14 at 14:24 +0530, senthil Kumar wrote:
>
>>Hi All.,
>>
>>In our application, I hava a list of tasks. Each task have a chech box and
once checked the check box and click "AddAlert" button,  alert for the
checked task is created.
>>
>>Up to this functionality working fine for me.
>>
>> My problem is once creating alert and unfortunately click F5 button,
again the alert is created for the same task  i.e the same alert action(.do)
calling again.
>>
>>
>>How to avoid it.
>>any one help me.
>>
>>
>>Thanks in advance.
>>
>>
>>Regs.,
>>Senthil S
>>
>>
>>
>>
>>This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient or received it in error,
please contact the sender by reply e-mail and destroy all copies of the
original message. Please do not copy it for any purpose or disclose its
contents.
>>
>>Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


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


Re: How to avoid calling .do again once click F5 button.

Posted by Yaroslav Novytskyy <sp...@n-ix.com.ua>.
Hello!

I would advise to use synchronization via Session tockens. (I'm working 
at this process' automation at the moment). Struts' Action already has, 
what is needed for this are saveToken() and isTokenValid() methods.

This technique makes it imposible to execute an action more then once 
(if not on purpouse) exclueding double-submits, refreshes, 
by-bookmark-visits.

Read the doc and check if that is what you need. And if yes, you can 
take look in my two days old message titled "synchronization strategies" 
- I beleave most answers (along with some questions :) ) are there.

Yaroslav Novytskyy

Leon Rosenberg wrote:
> before Michael jumps on the train :-)
> 
> simply send a redirect after executing create action to the list action
> again?
> 
> regards
> Leon
> 
> On Thu, 2005-07-14 at 14:24 +0530, senthil Kumar wrote:
> 
>>Hi All.,
>>
>>In our application, I hava a list of tasks. Each task have a chech box and once checked the check box and click "AddAlert" button,  alert for the checked task is created.
>>
>>Up to this functionality working fine for me.
>>
>> My problem is once creating alert and unfortunately click F5 button, again the alert is created for the same task  i.e the same alert action(.do) calling again.
>>
>>
>>How to avoid it.
>>any one help me.
>>
>>
>>Thanks in advance.
>>
>>
>>Regs.,
>>Senthil S
>>
>>
>>
>>
>>This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents.
>>
>>Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

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


Re: How to avoid calling .do again once click F5 button.

Posted by Leon Rosenberg <st...@anotheria.net>.
before Michael jumps on the train :-)

simply send a redirect after executing create action to the list action
again?

regards
Leon

On Thu, 2005-07-14 at 14:24 +0530, senthil Kumar wrote:
> Hi All.,
> 
> In our application, I hava a list of tasks. Each task have a chech box and once checked the check box and click "AddAlert" button,  alert for the checked task is created.
> 
> Up to this functionality working fine for me.
> 
>  My problem is once creating alert and unfortunately click F5 button, again the alert is created for the same task  i.e the same alert action(.do) calling again.
> 
> 
> How to avoid it.
> any one help me.
> 
> 
> Thanks in advance.
> 
> 
> Regs.,
> Senthil S
> 
> 
> 
> 
> This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents.
> 
> Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved



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