my dog learned polymorphism*
The moose likes Servlets and the fly likes redirection 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 "redirection" Watch "redirection" New topic


A Babu
Ranch Hand

Joined: Nov 28, 2005
Posts: 114
Below is my servlet now i want to redirect to form (view.jsp)if the data coming from the form is same as previous request.

how we can do redirection in this case.please give me suggestion with sample code of line.


Bruno Boehr

Joined: Feb 15, 2006
Posts: 17
A Babu,

It is not quite clear from your post exactly what you are trying to do:

> now i want to redirect to form (view.jsp)

Did you mean redirect or forward? Is your form's name view.jsp? But you are already forwarding (unconditionally) to /view.jsp in both doPost() and doGet() methods.

> if the data coming from the form is same as previous request

Let me guess: are you trying to prevent double postings? Well, if that's the case, there are a number of techniques to do that. But first, let's make sure we are on the same page here.

<a href="" target="_blank" rel="nofollow">Your first website in Java: easier than you think</a>
Consider Paul's rocket mass heater.
subject: redirection
Similar Threads
How to catch exception from Servlet in error.jsp
How to implement mvc using servlets
database best practice
display the log/output in JSP or HTML page
Forward pages with Servlets