But you cannot submit a form with a link unless you use javascript - which
is not a good idea if you want to make sure your forms always get submitted.
Instead, you need to use the image input tag and then on the server-side
check for its "existence" in the query parameters. You have got to do this
because it doesn't function like a normal button. Instead, when pressed the
coordinates of where you click on the image are sent as parameters, which
comes out to look like:
foo.jsp?imageField.x=13&imageField.y=12
You can't name these "image buttons", so if you have more than one they are
named in the order they appear in the html, so if the user clicked on the
third image button, it would look like this in the query string:
foo.jsp?imageField3.x=42&imageField3.y=16
This means you'll need to ensure that they always remain in the same order
in the html, or you'll need to change something in your code. IMHO, I don't
think this is worth the hassle and is error prone - use regular submit
buttons instead if possible.
Scott Evans
> -----Original Message-----
> From: Zhu Jianga [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 17, 2000 3:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: How to call a servlet from a JSP page ?
>
>
> I think the problem is in your link:
>
>
> <a href="http://127.0.0.1:7001/servletclasses/myServlet.class"<img
> border=0
> > height=14 hspace=8 src="/pics/buttons/submit.gif"></a>
>
> you do not have end ">" in the start "<a>";
>
> 404 is "file not found error",so the problem is with the name of your
> servlet.
>
> another issue is when you upload the servlet to your server,
> you can give a
> name to it
> so that you don't need to use the class name of it. Anyway, i
> am sure you
> can use a link
> to call a servlet.
>
>
> -----Original Message-----
> From: EXT rahul khandelwal [mailto:[EMAIL PROTECTED]]
> Sent: 17. April 2000 14:16
> To: [EMAIL PROTECTED]
> Subject: Re: How to call a servlet from a JSP page ?
>
>
> Dear Pam,
> if u want ur image to work as a submit button then u can use this
> <input type="image" border=0
> height=14 src="/pics/buttons/submit.gif">.
> now this image will act as a submit button, and in the form
> action in the
> JSP page u can specify the name of the servlet, which u want
> the page to be
> submitted to.I hope this should work,
> enjoy programming,
>
> Rahul
>
>
>
> ----- Original Message -----
> From: Pamela Cotture <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 13, 2000 8:09 PM
> Subject: How to call a servlet from a JSP page ?
>
>
> > I'd like to call a servlet from a JSP page when I click on
> an image that
> > represents my submit button.
> >
> > I've tested the following code in my jsp page but I got an
> 404-Error :
> >
> > <a href="http://127.0.0.1:7001/servletclasses/myServlet.class"<img
> border=0
> > height=14 hspace=8 src="/pics/buttons/submit.gif"></a>
> >
> > Anyone can help me ?
> >
> > Thanks
> >
> > Pamela
> >
> > mailto:[EMAIL PROTECTED]
> >
> >
> ==============================================================
> =============
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets