You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sandor Spruit <as...@acm.org> on 2000/09/06 11:05:54 UTC
Re[2]: How can I avoid the String ".../servlet/..." in URL?
Hello all,
On Tuesday, September 05, 2000, 6:29:09 PM, Simon Kitching wrote:
>> -----Original Message-----
>> From: Nguyen, Hong Chau [SMTP:Hong.Chau.Nguyen@opendata.de]
>> Sent: Tuesday, September 05, 2000 6:00 PM
>> To: 'tomcat-user@jakarta.apache.org'
>> Subject: How can I avoid the String ".../servlet/..." in URL?
>>
>> I have added following to my web.xml file:
>>
>> <servlet>
>> <servlet-name>ServletName</servlet-name>
>> <servlet-class>ServletClass</servlet-class>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>ServletName</servlet-name>
>> <url-pattern>/ServletName</url-pattern>
>> </servlet-mapping>
>>
>> It works, but I don't want to make it for every servlet in my web-app.
>> Is there any other methods to do it at once for the whole servlets in my
>> context?
Kitching> [Kitching Simon]
Kitching> No, I doubt it.
Kitching> To summarize, you don't want your servlets to have a prefix
Kitching> that the webserver can use to tell them apart from html
Kitching> pages, and you don't want to specify them one-by-one. So how
Kitching> is the webserver going to know what is a servlet and what
Kitching> isn't ???
Okay. I have some trouble refering to my servlets using URLs. Maybe
some of you kind folks could help me out here. Here's what I've done:
(1) I've a user defined context, with HTML pages, servlets, the works.
All of this stuff can be addressed via the Tomcat's built-in http
server, no problem. No Apache as yet.
(2) My context's web.xml contains a list of servlet elements, with the
servlet names and classes. The classes live in WEB-INF\classes. No
user defined packages, just the default one.
No: how to I refer to MyServlet from inside an arbitrary HTML file ? I
have tried /servlet/MyServlet and /servlets/MyServlet. But only using
a full and absolute URL seems to work, i.e. a mapping "mounting" the
servlet somewhere in the server's file space, then http:// etc.
I have a gut feeling this is not the way it is supposed to work :( But
I can't get it to work otherwise. Since this is the only thing I have
not yet figured out, any suggestions would be much appreciated ...
Regards,
Sandor
--
ir A.G.L. Spruit, Utrecht University, the Netherlands
Institute of information and computing sciences
"There is a bit of magic in everything, and then some
loss to even things out" (from: Lou Reed, "Magic and Loss")