This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting Servlet" Watch "Redirecting Servlet" New topic
Author

Redirecting Servlet

asdvenky
Greenhorn

Joined: Jul 26, 2001
Posts: 1
Hi
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

"asdvenky"
your name doesn't seem to agree with the javaranch guidelines.
please take a moment and re-register after reviewing the
guidelines at http://www.javaranch.com/name.jsp
thanks for your cooperation.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Sam Dalton
Author
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">
</form>
Now either clicking the button/image will submit back to the same servlet (the servlet represented by servletname in the forms action.

<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Redirecting Servlet