Hi,
I built a web application which has the following structure:
Assignment\
index.jsp
add.jsp
images\
logo.gif
Student\
record.jsp
WEB-INF\
web.xml
classes\
assignment\StudentServlet.class
lib\
dbLibrary.jar
I packaged it as Assignment.war and it was put under C:/tomcat4/webapps/,
i.e. C:/tomcat4/webapps/Assignment.war
I did not set the server.xml for the Context path as it is only a war file.
When I type:
http://localhost:8080/Assignment/index.jsp, it will display properly.
There are 3 links to
1. add.jsp and
2. /Student/record.jsp and
3. assignment.StudentServlet
in the index.jsp page.
When I click the links to add and record
jsp pages and the StudentServlet, it said no such files.
I saw the URL are
1.
http://localhost:8080/add.jsp 2.
http://localhost:8080/Student/record.jsp 3.
http://localhost:8080/servlet/StudentServlet instead of
1.
http://localhost:8080/Assignment/add.jsp 2.
http://localhost:8080/Assignment/Student/record.jsp 3.
http://localhost:8080/Assignment/servlet/StudentServlet Here is the web.xml:
<
servlet>
<servlet-name>StudentServlet</servlet-name>
<servlet-class>assignment.StudentServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>StudentServlet</servlet-name>
<url-pattern>/StudentServlet</url-pattern>
</servlet-mapping>
I think the web.xml has problem. It has not mapped to correct context "Assignment".
How should I set it in web.xml?
I use
tomcat 4 and JBuilder 6.
Thanks