1:创建文件目录结构
mytest
WEB-INF
web.xml
classes
lib
index.jsp
index.jsp(jsp文件新建立后需要重起tomcat)
<table width="100%">
<tr>
<td align="left" width="130">你好,我来了!!<%out.println("Hello jsp");%></td>
</tr>
</table>
web.xml
<?xml version="1.0" encoding="gb2312"?>
<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>Welcome to HelloWorld</display-name>
<description>
Welcome to HelloWorld
</description>
<!-- JSPC servlet mappings start servlet需要配置的地方-->
<servlet>
<servlet-name>HelloWorld2</servlet-name>
<servlet-class>HelloWorld2</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld2</servlet-name>
<url-pattern>/HelloWorld2.shtml</url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
</web-app>
浙公网安备 33010602011771号