Struts配置文件action中必须配置的属性?

解决方案 »

  1.   

    <action name="Filminfo_*" class="com.pojo.web.action.FilminfoAction" method="{1}">
    name  class method
      

  2.   

    name ---FormBean的名字,必须在<form-beans>中配置过
    type ---Action类的名称,必须是全路径其他的非必须。注:以上为struts1.*下的写法 2.0的就没做过,不晓得。
      

  3.   

    <action   name="loginActionForm"
        path="/loginAction" scope="request"
        type="org.chen.struts.loginAction">
        <forward name="scuess" path="/scuess.jsp" />
        <forward name="error" path="/error.jsp" />
            </action>
         说明:
             A)name:并不是Action本身的名字,而是与之关联的ActionForm的名称
             B)path:非常重要的属性。ActionSerlvet将用户的请求转发与之同名的Action.同名的意思是将请求           的".do"后缀去掉。匹配Action的path属性值 
             C)struts-config.xml中只要遇到path属性都要加"/"表示相当于WebRoot根目录而言
             D)type:Action的类名
             E)forward:将Action的转发映射到实际的jsp页面,在实际编程时应该用逻辑名进行转发 
      

  4.   

    必配的,就path了吧,一般name、type、scope、forward比较常用,可以说是必配了
      

  5.   

    struts2:
    1.<package name="crm" namespace="/login" extends="struts-default">
        <action name="helloworld" class="com.wj.crm.HelloWorldAction" method="execute">
           <result name="success">/WEB-INF/page/hello.jsp</result>
        </action>
     </package>
    name:action名称(唯一)
    class:类路径(包名+类名 默认ActionSupport)
    method:方法名 (execute默认方法名)
    result: 返回视图 (默认success)2.<package name="crm" namespace="/login" extends="struts-default">
        <action name="option_*" class="com.wj.crm.HelloWorldAction" method="{1}">
           <result name="success">/WEB-INF/page/hello.jsp</result>
        </action>
     </package>
    请求路径:/login/option_hello.action(hello为action中的方法名.action可以省略(默认))struts1:
    1.<action forward="/WEB-INF/page/hello.jsp" path="/hello">
    2.<action attribute="usersForm" name="usersForm" parameter="op"
    path="/users" scope="request"
    type="org.springframework.web.struts.DelegatingActionProxy"
    validate="false"> 如果是true forward必须配置一个name="input"的视图
    <forward name="toLogin" path="/login.jsp" />
    </action>