Posts

Showing posts from June, 2019

redirect to servlet page using anchor tag

Redirect to servlet page using h r ef -------------------------------------------------------------------- Normally what we do ,we redirect a page to another servlet or jsp page by using action    in form (<form method="post" action="purchaseServlet" ></form>) But what if we want to redirect to a servlet using the anchor tag  e.g. (<a href="purchaseservlet">Purchase</a>) Solution ------------------------------------------------------------------------------------------ <form action="recipentServlet"  method="post"> <input type="submit" value="PrintReceipt" /> <br> <a href="purchaseServlet">Purchase</a> </form> In above code snippet when user will click the submit button...by using action it will redirect to recipentServlet.java But when user will click on Purchase link we expect it should go to the purchaseServlet.java...