Hi!! The solution suggested by Gin is good. Here is one more easy way to do this. You can place these 3 buttons in 3 different forms. Make these buttons as "Submit" type. Set the "action" parameter of these forms as per your relative path of the destination servlet. e.g. <Form name=frm1 action="../servlet/login1" method=post> <input type="Submit" name=<%=button1%> value="<%=button1%>" style="width:200px"> </form>
Hope this helps. Sandeep Disclaimer: This document is intended for transmission to the named recipient only. If you are not that person, you should note that legal rights reside in this document and you are not authorized to access, read, disclose, copy, use or otherwise deal with it and any such actions are prohibited and may be unlawful. The views expressed in this document are not necessarily those of HCL Technologies Ltd. Notice is hereby given that no representation, contract or other binding obligation shall be created by this e-mail, which must be interpreted accordingly. Any representations, contractual rights or obligations shall be separately communicated in writing and signed in the original by a duly authorized officer of the relevant company. -----Original Message----- From: Chen, Gin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 8:53 PM Subject: Re: How to redirect JSP to Servlet by clicking button? use javascript. have onclick events in all 3 buttons with different locations as the parameter to a function call. use something like window.location = destination for the body of ur script. the concept is so easy that i will not include code. (actually i had a late night and i'm too tired right now to put code) this should be enough anyways. you can go to msdn.microsoft.com/library and look under webdevelopment for more info. -Tim -----Original Message----- From: Edward [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 3:40 AM To: [EMAIL PROTECTED] Subject: How to redirect JSP to Servlet by clicking button? Importance: High I want to call Servlet from JSP,In JSP,I have three button,named "button1","button2","button3",for example: <input type="button1" name=<%=button1%> value="<%=button1%>" style="width:200px"> <input type="button1" name=<%=button2%> value="<%=button2%>" style="width:200px"> <input type="button1" name=<%=button3%> value="<%=button3%>" style="width:200px"> When I click button1 with mouse,I want to redirect to a servlet,it locates: /servlet/login1;when I click button2 with mouse,I want to redirect to servlet:/servlets/login2;when I click button3,I want to redirect to servlet:/webapp/welcome. How to realize this function? Thanks in advance! Edward =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com