You need to do a number of things, assuming that I understand the question.

1) create your servlet (duh)

2) create jsp (duh also)

3) modify WEB-INF/web.xml

        add servlet entry for the servlet, should look something like this:

        <servlet>
                <servlet-name>foo</servlet-name>
                <servlet-class>org.somewhere.Bar</servlet-class>
        </servlet

        add a mapping for a file extension to the servlet, looks like this:

        <servlet-mapping>
                <servlet-name>foo</servlet-name>
                <url-pattern>*.form</url-pattern>
        </servlet-mapping>

        Note: the name of the servlet should be the same in both places and in
        order to have tomcat auto-magically map the request to the servlet you
        need have the link or action have the extension that you specify in the
        url-pattern.

Now there's an added complication if you're not running tomcat stand alone
(ie
using mod_jk and apache or something) in that you'll need to also tell the
front end web server to pass the requests for your mapping through to tomcat
as well (this is the part that I *always* forget about).

If you have any problems setting this up email and I'll try to answer
questions
or provide examples.

--mikej
-=-----
mike jackson
[EMAIL PROTECTED]

> -----Original Message-----
> From: Alex [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 20, 2002 9:17 AM
> To: [EMAIL PROTECTED]
> Subject: calling servlets from jsp
>
>
> Hello,
>
>  I want to call a servlet from a jsp ( i mean, when i press a button
>  in the html file generated by the jsp, i want to call a servlet).
>  for ex: document.location.href = "SERVLET";
>  How can i do this ?
>
>  Thanks in advance...
>  Alex.
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to