• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple Forms, Multiple Submissions

 
Ranch Hand
Posts: 229
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand that Strut's Action class has saveToken(), isTokenValid(), resetToken() methods to facilitate the prevention of multiple form submissions.

Suppose that I have two different forms (let's call them form A and form B), and both of them can be opened at the same time in two different popup windows. Consider the following events:

(1) Click link to open form A, and fill in form A's fields.
(2) Click link to open form B, and fill in form B's fields.
(3) Click Submit button in form A.
(4) Wait for server to return response page.
(5) Click Submit button in form B.
(6) Wait for server to return response page.

I understand that Struts is only using one session attribute, org.apache.struts.action.TOKEN, and one request parameter org.apache.struts.taglib.html.TOKEN to facilitate the handling of multiple form submissions. But if I have more than one form, how does that single session attribute be able to tell which form it is for?

In (1) above, it will generate a hidden field value (org.apache.struts.taglib.html.TOKEN), and a new session attribute value for org.apache.struts.action.TOKEN. In (2) a hidden field value will be generated too, but the session attribute value, org.apache.struts.action.TOKEN, for (1), would have been overwritten. In that case, when we come to (3), wouldn't we have a problem?
 
reply
    Bookmark Topic Watch Topic
  • New Topic