HTTP Status 404
-ROOT
----myapp
------index.html
------WEB-INF
---------classes
-----------javaName.java
-----------javaname.class
step
1 make a file under /projectName/classes/javaName.java
2 compile : javac -classpath ./:/usr/share/apache-tomcat-7. 0.35/lib/servlet-api.jar javaName.java
3 put it into /porjectName/WEB-INF/web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Sand Box Test </display-name>
<description> Sand Box Test </description>
<servlet>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Sand Box Test </display-name>
<description> Sand Box Test </description>
<servlet>
<servlet-name>javaName</ servlet-name>
<servlet-class>javaName</ servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>javaName</ servlet-name>
<url-pattern>/javaName</url- pattern>
</servlet-mapping>
</web-app>
沒有留言:
張貼留言