You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rodrigo Poblanno Balp <ba...@gmx.net> on 2003/05/17 04:22:37 UTC

Tomcat: webapp servlets with packages???

Hi pals.
I'm building a webapp for it to be run in Tomcat.

I have several servlets whose sources whith this structure:

webapps
    |
    --html
            |--myhtml.html
    --src
            |--mypackage
                            |--MyServlet.java
    --WEB-INF
            |--classes
                |--mypackage
                            |--MyServlet.class

In an html document contained in the directory html/ I can't make the
servlet run by making:

<a href="../servlet/mypackage/MyServlet>Go Online!</a>

nor

<a href="../servlet/MyServlet>Go Online!</a>

Anyway, if I remove the "package mypackage;" statement form MyServlet.java
and put
the MyServlet.class in WEB-INF/classes/ and using the:

<a href="../servlet/MyServlet>Go Online!</a>

it does work!

I can't stop using my packages 'cause I have a lot of Servlets and they need
to be organized this way.

My question is: how should I acces the servlets that are under packages????
Do I have to modify the web.xml file????

Thanx for your help in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat: webapp servlets with packages???

Posted by Tim Funk <fu...@joedog.org>.
Use dots for the servlet name.
<a href="../servlet/mypackage.MyServlet>Go Online!</a>

Also make sure the invoker is enabled. But the invoker is evil. More 
information about the invoker:
http://tomcatfaq.sourceforge.net/miscellaneous.html

-Tim

Rodrigo Poblanno Balp wrote:
> Hi pals.
> I'm building a webapp for it to be run in Tomcat.
> 
> I have several servlets whose sources whith this structure:
> 
> webapps
>     |
>     --html
>             |--myhtml.html
>     --src
>             |--mypackage
>                             |--MyServlet.java
>     --WEB-INF
>             |--classes
>                 |--mypackage
>                             |--MyServlet.class
> 
> In an html document contained in the directory html/ I can't make the
> servlet run by making:
> 
> <a href="../servlet/mypackage/MyServlet>Go Online!</a>
> 
> nor
> 
> <a href="../servlet/MyServlet>Go Online!</a>
> 
> Anyway, if I remove the "package mypackage;" statement form MyServlet.java
> and put
> the MyServlet.class in WEB-INF/classes/ and using the:
> 
> <a href="../servlet/MyServlet>Go Online!</a>
> 
> it does work!
> 
> I can't stop using my packages 'cause I have a lot of Servlets and they need
> to be organized this way.
> 
> My question is: how should I acces the servlets that are under packages????
> Do I have to modify the web.xml file????
> 
> Thanx for your help in advance.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat: webapp servlets with packages???

Posted by Paul Yunusov <py...@rogers.com>.
On Friday 16 May 2003 10:22 pm, Rodrigo Poblanno Balp wrote:
> Hi pals.
> I'm building a webapp for it to be run in Tomcat.
>
> I have several servlets whose sources whith this structure:
>
> webapps
>
>     --html
>
>             |--myhtml.html
>
>     --src
>
>             |--mypackage
>             |
>                             |--MyServlet.java
>
>     --WEB-INF
>
>             |--classes
>             |
>                 |--mypackage
>                 |
>                             |--MyServlet.class
>
> In an html document contained in the directory html/ I can't make the
> servlet run by making:
>
> <a href="../servlet/mypackage/MyServlet>Go Online!</a>
>
> nor
>
> <a href="../servlet/MyServlet>Go Online!</a>
>
> Anyway, if I remove the "package mypackage;" statement form MyServlet.java
> and put
> the MyServlet.class in WEB-INF/classes/ and using the:
>
> <a href="../servlet/MyServlet>Go Online!</a>
>
> it does work!
>
> I can't stop using my packages 'cause I have a lot of Servlets and they
> need to be organized this way.
>
> My question is: how should I acces the servlets that are under packages????
> Do I have to modify the web.xml file????
>
> Thanx for your help in advance.

Use dots instead of forward slashes to prepend package names.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org