I am trying to call a Http Servlet from another Http Servlet. But the page is not displayed. I am clicking a link on the displayed webpage(from a servlet), this link is supposed to take me to another Servlet. can we call a servlet my just clicking a href link(like an html page), how do you call a servlet from a servlet and pass parameters, i will appreciate if someone can help me thanks
If what you're trying to do is have your first servlet generate html containing a hyperlink to a second servlet, then have the first servlet generate something like this:
And don't forget to urlEncode the address if you want to maintain session. [This message has been edited by Miftah Khan (edited September 20, 2001).]
Joined: Jun 13, 2000
what do you mean by urlencode., how do you maintain sessions
Joined: Nov 22, 2008
what do you mean by urlencode
Steve's response shows an example of how to urlEncode a web address.
how do you maintain sessions
You should read up on the servlet Session Tracking API. In particular, check out the javax.servlet.http.HttpSession interface, as well as the getSession() method of the javax.servlet.http.HttpServletRequest interface.
subject: how to call Http Servlets from other Http Servlets