• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest question

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • 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).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic