File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Redirecting Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting Servlet" Watch "Redirecting Servlet" New topic

Redirecting Servlet


Joined: Jul 26, 2001
Posts: 1
How can i redirect a Servlet to its self.
I want this action to be performed on click of button or on an image.
Help in this
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

your name doesn't seem to agree with the javaranch guidelines.
please take a moment and re-register after reviewing the
guidelines at
thanks for your cooperation.
- satya

Take a Minute, Donate an Hour, Change a Life
Sam Dalton
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
Have your servlet produce a form similar to this.
<form method=post action=servletname>
<input type=submit value="Click Me">
<input type=image src="image.gif">
Now either clicking the button/image will submit back to the same servlet (the servlet represented by servletname in the forms action.

<a href="" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of []Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
It is sorta covered in the JavaRanch Style Guide.
subject: Redirecting Servlet
jQuery in Action, 3rd edition