Pass a parameter along with your hyperlink. In your doGet() method check for
that parameter, and if it exists, call the doPost() method..
<A HREF="http://host/servlet/whateverservlet?PARAM=POST_THIS
whateverServlet
------------------------
public void doGet( req, resp)
{
if(req.getParameter("PARAM").equals("POST_THIS") )
doGet(req,resp) ;
else
blah blah blah....
}
Cheers,
Amar..
Sanjay Garg <[EMAIL PROTECTED]> on 11/19/99 03:33:27 PM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc: (bcc: Amarnath Nanduri/IT/VANCPOWER)
Subject: Calling servlet from hyper text link
Hi,
I am trying to invoke doPost() method of a servlet from a hyper
text link in my JSP, but it is always calling doGet(). I am doing
different stuff in each method, so can't do a doPost() within
a doGet(). Is there a way I can force a method type for my servlet
when invoked from a link.
In HTML Unleased book it is mentioned that if link is with a
<FORM> </FORM> and the method defined is "POST" then doPost()
(of CGI program) would be called. But link is not exactly a form
element , so I am not sure how it would work. Anyway it is not
working for my servlet. Is there any setMethod (like request.getMethod())
which I could use.
Of course I can always create 2 different servlets. Is this the
standard/recommended practice, not to have different functionality
for doGet and doPost .
BTW, I running Websphere 2.0 server on NT.
Would appreciate any help.
Sanjay
-----
Sent using MailStart.com ( http://MailStart.Com/welcome.html )
The FREE way to access your mailbox via any web browser, anywhere!
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html