Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   JSP, Servlet, and Java Classes location in Tomcat (http://www.velocityreviews.com/forums/t134128-jsp-servlet-and-java-classes-location-in-tomcat.html)

Matt 06-06-2004 01:39 AM

JSP, Servlet, and Java Classes location in Tomcat
 
In tomcat, I want to know JSP files, Servlets, and Java classes
should put in different locations:

I put all JSP files in the following:
C:\jakarta-tomcat-4.1.30\webapps\proj1

I put all servlet files in the following:
C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes

I put all Java classes in the following with package proj1:
C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1

When I execute servlet files, it has HTTP error 404, file not found.

I am not using web.xml at this moment. Please advise for the
workarounds so that it will work in all cases. thanks!!!

Ryan Stewart 06-06-2004 01:56 AM

Re: JSP, Servlet, and Java Classes location in Tomcat
 
"Matt" <jrefactors@hotmail.com> wrote in message
news:ba8a039e.0406051739.73fe0344@posting.google.c om...
> In tomcat, I want to know JSP files, Servlets, and Java classes
> should put in different locations:
>
> I put all JSP files in the following:
> C:\jakarta-tomcat-4.1.30\webapps\proj1
>
> I put all servlet files in the following:
> C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes
>
> I put all Java classes in the following with package proj1:
> C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1
>
> When I execute servlet files, it has HTTP error 404, file not found.
>
> I am not using web.xml at this moment. Please advise for the
> workarounds so that it will work in all cases. thanks!!!
>

If you have no web.xml, you have no servlets. You must make the following
entries in web.xml for each servlet:
<servlet>
<servlet-name>someNameYouMakeUp</servlet-name>
<servlet-class>com.foo.ServletClass</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>someNameYouMakeUp</servlet-name>
<url-pattern>/foo</url-pattern>
</servlet-mapping>

The servlet-name is simply used to link servlet to mapping. The
servlet-class is the fully qualified name of the class file. The url-pattern
is the context-relative path that will cause this servlet to be invoked
(i.e. http://localhost:8080/myWebapp/foo in this example).




All times are GMT. The time now is 04:28 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.