You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sreekanth S. Nair" <sr...@egovernments.org> on 2013/03/07 08:40:59 UTC

Multiple Window and Struts2 token issue.

Hi,
     I have a web app where its having a couple of operations say for
example Create User and Create Role. Both these forms are having struts2
token for handling duplicate submit. Its working as expected.

Now the problem is when try to open both of it and try to save both of it.
The window opened first is showing duplicate form submission error.
1) Open Create User in browser tab.
2) Open Create Role in another tab.
3) Try to save the Create User throws Duplicate Token error.
4) Try to save the Create Role, its saving as expected.

Since token is saved in http session i guess this could be a problem.

Can anybody tell me any workaround or fix for this.?

regards
Nick

Re: Multiple Window and Struts2 token issue.

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
I found it myself that <s:token/> itself is the problem. token should
always accompany with a unique name, struts2 always uses the default name
for token field ie *struts.token*. As a conclusion to avoid the below
mentioned problem, we have to add token tag like <s:token name="xyz"/>.

So now my first form having <s:token name="xyz"/> and second one
having <s:token name="xyztyy"/> and that did the trick.

On Thu, Mar 7, 2013 at 1:10 PM, Sreekanth S. Nair <
sreekanth.nair@egovernments.org> wrote:

> Hi,
>      I have a web app where its having a couple of operations say for
> example Create User and Create Role. Both these forms are having struts2
> token for handling duplicate submit. Its working as expected.
>
> Now the problem is when try to open both of it and try to save both of it.
> The window opened first is showing duplicate form submission error.
> 1) Open Create User in browser tab.
> 2) Open Create Role in another tab.
> 3) Try to save the Create User throws Duplicate Token error.
> 4) Try to save the Create Role, its saving as expected.
>
> Since token is saved in http session i guess this could be a problem.
>
> Can anybody tell me any workaround or fix for this.?
>
> regards
> Nick
>
>
>
>