使用struts結構,所需要的設定
首先,你需要將此段程式碼放入web.xml中
<web-app>
<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>application</param-name>
<param-value>ApplicationResources</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>
</web-app>
放入後請記得,在WEBINF/lib底下,記得要放上
struts.jar
commons-beanutils.jar
commons-codec-1.3.jar
commons-collections-3.1.jar
commons-dbcp-1.3.jar
commons-digester.jar
commons-email-1.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
commons-pool-1.5.4.jar
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<form-beans>
<form-bean name="UserActionForm" type="com.scriptplay.actionform.UserActionForm" />
</form-beans>
<global-forwards>
<forward name="login_member" path="/signin.jsp" redirect="true" />
</global-forwards>
<action-mappings>
<action name="UserActionForm" path="/UserAction" scope="request" type="com.scriptplay.action.UserAction" validate="false" />
</action-mappings>
</struts-config>
<!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>
<form-beans>
<form-bean name="UserActionForm" type="com.scriptplay.actionform.UserActionForm" />
</form-beans>
<global-forwards>
<forward name="login_member" path="/signin.jsp" redirect="true" />
</global-forwards>
<action-mappings>
<action name="UserActionForm" path="/UserAction" scope="request" type="com.scriptplay.action.UserAction" validate="false" />
</action-mappings>
</struts-config>
接著就可以使用囉
這樣環境就配置完成了!!!
Comments
Post a Comment