Struts. xml 해석

2655 단어 xmljspstruts


/*
1----     

2 .namespace:    action     ,    ,              , 
    / ,  /aaa  /aaa/bbb                /index.jsp 
/aaa/index.jsp , /aaa/bbb/index.jsp 

3.package name="default"         action name    

4.        com.zhe.Action1,   index.jsp

5 , method="add"     Action1 add  ,        execute  ,          ,            /index/!add  ----       ,   DMI      

6.         ,{1}  name="index*"      *,       /indexadd
  method="add"           indexadd.jsp
             :
 <action name="*_*" class="com.zhe.{1}"  method="{2}">  
     <result >{1}_{2}_success.jsp </result> 
 </action> 
                
 7.              default-action-ref    action  

8.           ,         global-results  ,      package      package  result,        package,  extends=“user”      package   user       

9. ${}      value stack    , Action             value stack ,    r   Action     。。。     ,     

10. redirect       jsp,            jsp     Action,      Action,  <s:property value="name"/>   (   value stack    ),   <s:property value="#parameters.name" />      
*/ 

 

    <constant name="struts.devMode" value="true" />    //1
    <package name="default" namespace="/" extends="struts-default"> //2,3
     <default-action-ref name="index"></default-action-ref>//7
     <global-results>  //8
           <result name="aaa">/index.jsp</result>
        </global-results>
        <action name="index"  class="com.zhe.Action1" > //4 
 //<action name="index"  class="com.zhe.Action1" method="add"> 5
//  <action name="index*" class="com.zhe.Action1"  method="{1}">  6
            <result > 
                /index.jsp   //index{1}  6
            </result> 
            //<result>${r}</result>  9
         //<result type="redirect" >/index.jsp?name=${name}</result>  10
        </action> 
    </package>

 

public class Action1 extends ActionSupport{

 @Override
 public String execute() throws Exception {
  // TODO Auto-generated method stub
  return "success";
 }

}

 

좋은 웹페이지 즐겨찾기