You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by cbarnes <cb...@tarantella.com> on 2002/06/21 12:28:10 UTC

path info for servlets and JSPs

In web.xml I have added a servlet mapping so that the servlet can take extra
path information as follows:

<servlet-mapping>
        <servlet-name>myservlet</servlet-name>
        <url-pattern>/myservlet/*</url-pattern>
</servlet-mapping>

Is it possible to do something similar with JSPs - and if so how and where
do I configure this?
I would like to be able to use a URL such as
http://server/application/mypage.jsp/extra/path/info

Thanks,
Catharine


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: path info for servlets and JSPs

Posted by Milt Epstein <me...@uiuc.edu>.
On Fri, 21 Jun 2002, cbarnes wrote:

> In web.xml I have added a servlet mapping so that the servlet can take extra
> path information as follows:
>
> <servlet-mapping>
>         <servlet-name>myservlet</servlet-name>
>         <url-pattern>/myservlet/*</url-pattern>
> </servlet-mapping>
>
> Is it possible to do something similar with JSPs - and if so how and
> where do I configure this?
> I would like to be able to use a URL such as
> http://server/application/mypage.jsp/extra/path/info

I don't think this is possible directly, with the way extensions are
handled (I think the extension has to be in the last segement of the
URL path).  You should check out the spec on this point, it's not too
hard to deciper.

As someone else suggested, you might be able to use the query string
to do this.

In addition, you might be able to use a servlet-mapping to do this.
The key point to note is that you can use a servlet-mapping to link a
url-pattern to a jsp-file instead of a servlet-name.  So if you have a
servlet-mapping like:

  <servlet-mapping>
    <jsp-file>mypage.jsp</jsp-file>
    <url-pattern>mypagejsp</url-pattern>
  </servlet-mapping>

You could use a URL like:

http://server/application/mypagejsp/extra/path/info

(Warning: The above is totally untested and will likely need to be
hashed out to get working.)

Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>