本文共 1936 字,大约阅读时间需要 6 分钟。
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" " "> <web-app> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <taglib> <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri> <taglib-location>/WEB-INF/struts-template.tld</taglib-location> </taglib> </web-app> 这是一个web.xml的实例,请参考 <!--所有的servlet写在这里--> <servlet> <!--依次写下每个servlet和类的对应关系--> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <!--该servlet的初始化参数,共有两个--> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!--如果有别的servlet,仿照第一个书写形式把它们依次写在这里--> <!--开始写路径对应关系--> <servlet-mapping> <servlet-name>action</servlet-name> <!--url对应,比如你写 *.do,它都会交给名字叫Action的servlet来执行--> <url-pattern>*.do</url-pattern> <!--如果有别的servlet,仿照第一个书写形式把它们路径对应关系写在这里--> </servlet-mapping>
本文转自 cuiyingfeng 51CTO博客,原文链接:http://blog.51cto.com/cuiyingfeng/6670,如需转载请自行联系原作者