struts1 demo

来源:互联网 发布:c语言编辑 编辑:程序博客网 时间:2024/06/06 06:54

直接附上源码  http://download.csdn.net/detail/yongzhian/7965285

核心配置:

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">  <display-name>struts1</display-name>  <welcome-file-list>    <welcome-file>index.html</welcome-file>    <welcome-file>index.htm</welcome-file>    <welcome-file>index.jsp</welcome-file>    <welcome-file>default.html</welcome-file>    <welcome-file>default.htm</welcome-file>    <welcome-file>default.jsp</welcome-file>  </welcome-file-list>  <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>3</param-value>    </init-param>    <init-param>      <param-name>detail</param-name>      <param-value>3</param-value>    </init-param>    <load-on-startup>0</load-on-startup>  </servlet>  <servlet-mapping>    <servlet-name>action</servlet-name>    <url-pattern>*.do</url-pattern>  </servlet-mapping></web-app>

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config><form-beans><form-bean name="LoginForm" type="com.yza.struts.form.LoginForm"></form-bean></form-beans><global-exceptions /><global-forwards /><action-mappings><action path="/login" name="LoginForm" type="com.yza.struts.action.LoginAction"scope="request" input="/index.jsp"> <forward name="success" path="/success.jsp"></forward></action></action-mappings><message-resources parameter="com.yza.struts.ApplicationResources" /></struts-config>



信息: Initializing composable request processor for module prefix ''


Action有2种execute方法,参数类型不同。

 

1、public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)

 

 

2、public ActionForward execute(ActionMapping arg0, ActionForm arg1,
   ServletRequest arg2, ServletResponse arg3) throws Exception

 

action 里面要选择第一种方法


0 0