这个文件是放在web-inf下面的


struts中struts-config.xml文件解释


struts-config.xml文件中的每一个<action/>节点都对应一个ActionMapping

struts中struts-config.xml文件解释

<action path="/login" name="loginForm" type="cn.itcast.LoginAction" scope="request" validate="false">
           <forward name="LoginSuccess" path="http://www.baidu.com" redirect="true"></forward>
           <forward name="LoginSuccess2" path="/AddStudent2.jsp"></forward>
           <forward name="LoginFailure" path="/LoginFailure.jsp"></forward>
        </action>

scope属性的值默认为sesion.

可以通过一下方法得到相应的信息:

        String name = mapping.getName();
        String type = mapping.getType();
        String path = mapping.getPath();
        
        System.out.println("actionName:" + name + "\ttype:" + type + "\tpath:" + path);
        String[] forwardNames = mapping.findForwards();
        
        for(String forwardName: forwardNames){
            ActionForward actionForward = mapping.findForward(forwardName);
            String fname = actionForward.getName();
            String fpath = actionForward.getPath();
            
            System.out.println("forwardNmae:" + forwardName +

                               "\tfname:" + fname +           

                               "\tfpath:"+ fpath );
        }



struts中struts-config.xml文件解释

ActionForward相当于导航器,<forward/>节点中redirect属性默认为false或no

struts中struts-config.xml文件解释

false时是容器内转发路径相对于当前应用,true时是容器外转发路径写绝对路径(http://www....)。



struts中struts-config.xml文件解释





转载于:https://www.cnblogs.com/xzf007/archive/2012/07/07/2873909.html

相关文章: