This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes HttpServletRequest question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServletRequest question" Watch "HttpServletRequest question" New topic
Author

HttpServletRequest question

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
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

Joined: Jan 10, 2002
Posts: 60822
    
  65

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
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).


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
 
 
subject: HttpServletRequest question
 
Similar Threads
capturing browser refresh event
Design problem
how to get a variable and print in same page
Maintain Data Across Errors
jsp:getProperty Bean Problem.