• 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

double submission handling

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am pretty new to the struts framework so I am wondering if this is possible. Suppose the client could send us duplicate requests in a very short time. On the server side we use struts 1.3 and we want to only process the first one of the two requests and "drop" duplicate. How can we do that?

If we use the token check function, it goes to an error page. So in this case the client could see a correct page he expects to see (the server processes the first request as normal) , then an error page. Now the error page is a noise to the client. We can’t change the client even there might be a bug there to cause the double submission. How can we not return anything to the client for the second request. Thanks in advance.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ricky

As per my understanding, You need to control/stop the user from double/duplicate submissions.
Solution: You required to disable the submit button after it selected/pressed. It is very simple fix - you need not to do changes at server side.
 
ricky hoe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply. The client is flash and we don't have access to the code. and actually we don't know why there were duplicate requests coming to the server side yet, probably the load balancer, or somewhere in hte network. what is why we are considering to prevent this on the server.
 
ricky hoe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i use filter and it seems to be working.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ricky, filter would work fine. But just to add up, Struts has RequestProcessor which processes all the requests.

java.lang.Object
|_ org.apache.struts.action.RequestProcessor



And this provides a behaviour called "processPreprocess" which just return "true" always => please process this request and then it continues processing else it doesnt do anything expecting that the response has already completed. Extending this is best way to do it.

Few words from the API,

protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response)
General-purpose preprocessing hook that can be overridden as required by subclasses. Return true if you want standard processing to continue, or false if the response has already been completed. The default implementation does nothing.




Anyways, your issue is resolved:thumbup:

 
ricky hoe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shankar Tanikella wrote:Ricky, filter would work fine. But just to add up, Struts has RequestProcessor which processes all the requests.

java.lang.Object
|_ org.apache.struts.action.RequestProcessor



And this provides a behaviour called "processPreprocess" which just return "true" always => please process this request and then it continues processing else it doesnt do anything expecting that the response has already completed. Extending this is best way to do it.

Few words from the API,

protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response)
General-purpose preprocessing hook that can be overridden as required by subclasses. Return true if you want standard processing to continue, or false if the response has already been completed. The default implementation does nothing.




thanks for the knowledge transfer. I did learn a lot from this site.

Anyways, your issue is resolved:thumbup:

 
reply
    Bookmark Topic Watch Topic
  • New Topic