web.xml和struts-config.xml配置方法
2008-12-20 16:35
405 查看
web.xml文件
<?xml version="1.0" encoding="Shift_JIS"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</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>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>/jsp/login.jsp</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/jeffy</taglib-uri>
<taglib-location>/WEB-INF/jeffy.tld</taglib-location>
</taglib>
<!--
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
-->
</jsp-config>
</web-app>
struts-config.xml文件
<?xml version="1.0"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources></data-sources>
<form-beans>
<form-bean name="test" type="form.TestForm"></form-bean>
</form-beans>
<global-exceptions></global-exceptions>
<global-forwards></global-forwards>
<action-mappings>
<action path="/test" name="test" type="action.TestAction" scope="request" validate="false">
<forward name="success" path="/success.jsp" />
<forward name="logerror" path="/Logerror.jsp" />
</action>
</action-mappings>
<controller />
<message-resources parameter="person" null="false" />
</struts-config>
struts1 必备jar包:
commons-chains.jar
commons-beanutils.jar
commons-digester.jar
commons-core.jar
<?xml version="1.0" encoding="Shift_JIS"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</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>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>/jsp/login.jsp</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/jeffy</taglib-uri>
<taglib-location>/WEB-INF/jeffy.tld</taglib-location>
</taglib>
<!--
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
-->
</jsp-config>
</web-app>
struts-config.xml文件
<?xml version="1.0"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources></data-sources>
<form-beans>
<form-bean name="test" type="form.TestForm"></form-bean>
</form-beans>
<global-exceptions></global-exceptions>
<global-forwards></global-forwards>
<action-mappings>
<action path="/test" name="test" type="action.TestAction" scope="request" validate="false">
<forward name="success" path="/success.jsp" />
<forward name="logerror" path="/Logerror.jsp" />
</action>
</action-mappings>
<controller />
<message-resources parameter="person" null="false" />
</struts-config>
struts1 必备jar包:
commons-chains.jar
commons-beanutils.jar
commons-digester.jar
commons-core.jar
相关文章推荐
- web.xml和struts-config.xml配置方法
- java Web项目javaEE中web.xml文件中配置 contextConfigLocation 方法
- 一个web项目放置两个struts-config.xml方法
- struts-config.xml , web.xml配置示例
- struts配置文件讲解:web.xml和struts-config.xml
- Struts中web.xml和struts-config.xml配置详解
- Struts1中web.xml和struts-config.xml的配置
- 配置文件:persistence.xml-----beans.xml----jdbc.properties----log4j.properties---oscache----paoding---struts.config---web.xml
- 如何使用Javaconfig代替web.xml配置spring
- Struts-config.xml配置文件讲解(一)
- ASP.NET配置(web.config)无法连接到SQL Server 数据库的解决方法
- struts-config.xml配置文件
- Struts1.2 struts-config.xml配置详解
- ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法
- struts 使用多个配置文件 struts-config.xml
- struts.xml配置方法
- C#连接数据库的新方法(通过web.config配置文件)
- Struts2 方法动态调用,验证表签,xml配置Action
- IIS7 伪静态 web.config 配置方法【详解】
- httphandler程序部署在IIS上webconfig配置方法