Dear all,
Thank you very much for your help!
But what if my servlet contains package info? I.e. My servlet HelloWorld.java has this
sentence in it:
package com.myapi.msgservice.server;
In com.myapi, I defined some other packages other than msgservice, and I don't want to
change the directory of the HelloWorld servlet. Can you tell me how to access it by
http://localhost/servlet/HelloWorld ? I've changed the port to 80. Thanks a lot!
best regards
Ying
----- Original Message -----
From: "Tom Kochanowicz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 13, 2002 5:14 PM
Subject: Re: Problems in configuring Tomcat
> Ying,
>
> To execute a servlet under tomcat without changing your deployment
> descriptor file (web.xml) you need to put the name "servlet" in your URL.
> For example, lets say that you create a directory called "tom" (That's a
> real good name) under the "webapps" directory. The "tom" directory is where
> you (can) put your jsp's and html pages. below that directory you make a
> directory called "WEB-INF" (it is case sensitive. There you put your web.xml
> file (if you have one). Under the "WEB-INF" directory you make a "classes"
> directory. That is where you put your servlets. Now to access your jsp's and
> html pages your URL would be http://localhost/tom/someJSP.jsp but for your
> servlet your URL would be http://localhost/tom/servlet/MYservlet I suggest
> that you take the time to look at how the structure of tomcat is set up. It
> is very much worth your time to do so, since tomcat is the standard model
> for most containers.
>
> Hope this help,
>
> Tom K.
>
>
>
>
>
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ying
> Su
> Sent: Wednesday, March 13, 2002 1:53 AM
> To: [EMAIL PROTECTED]
> Subject: Problems in configuring Tomcat
>
>
> Dear all,
> I have set up Tomcat and seen the welcome page successfully. But I can't run
> servlet. For example, I wrote a simple servlet "HelloWorld.java" which
> prints "hello world" in brower, then put the "HelloWorld.class" file in
> Tomcat's "examples" directory. But when I visit it by
> http://localhost/examples/HelloWorld, Tomcat gives me an error message "The
> requested resource (/HelloWorld) is not available." However, jsp files could
> be executed properly. Does anyone know how to run my servlet?
>
> Thanks a lot!
>
> Sincerely
> Ying
>>
>
欢迎使用263天下邮免费信箱 http://freemail.x263.net
welcome to enjoy 263 Freemail http://freemail.x263.net
_____________________________________________________
263在线_中国人的网上家园
Tel:010-64262631 Fax:010-64240295 (c)1998-2001版权所有
263服务热线 [EMAIL PROTECTED]
韬{.n+壏瑉w^櫒ザ塨槽诮.澥&jwb澤nu瑙洝塄~豝欕,j瑠 鑮魟ER腖僑L
軉+薏m诃萣诫#j霈簑(涼玶痾响z诲z丕店薏豰歍^矉玵!囤6痡帅r壙顾lW靘z冠柗贶z萴歊菼4凟Q迻榤稛
%矅韗壙櫓頹[?呵f