• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

HttpServletRequest question

 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jsp form that submits to a servlet, the servlet processes the request and sets attributes in the request and forwards it back to the same jsp page. The jsp page gives a status message and shows the same form. When I submit the form again, it process my new set of data plus the data I submitted last time.

Now I realize that this is because of the fact that I did a Request Dispatch forward which will the request back to the jsp. Is there another alternative way? I just do nto want my old request parameters to be submitted when I do another submit to the servlet.
I guess I could do a redirect or something. The only problem is I stored a status message inside an attribute in my request object.
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When I submit the form again, it process my new set of data plus the data I submitted last time.


Not sure what you mean by this. Since you are submitting one form, how are you getting and processing two sets of data?
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

Not sure what you mean by this. Since you are submitting one form, how are you getting and processing two sets of data?


ditto. I think there's more of a logic problem in your code rather than JSP stuff (like redirect/forward).
 
What are your superhero powers? Go ahead and try them on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic