日期:2014-05-17  浏览次数:20728 次

Struts2 通配符配置完不知道如何测试哇
Java code

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
    <constant name="struts.devMode" value="true" />
    <package name="actions" namespace="/actions" extends="struts-default">
        <action name="Student*" class="action.StudentAction" method="{1}">
            <result>
                /Student{1}_success.jsp
            </result>
        </action>
        
        <action name="*_*" class="action.{1}Action" method="{2}">
            <result>
                /{1}_{2}_success.jsp
            </result>
        </action>
    </package>
</struts>


Struts2_0600_ActionWildcard
--src
---action
----StudentAction.java
----TeacherAction.java
--WebRoot
---Studentadd_success.jsp
---Studentdelete_success.jsp
---Teacheradd_success.jsp
---Teacherdelete_success.jsp
------------------------------------
视频上直接敲loaclhost:8080/Struts2_0600_ActionWildcard/
就可以显示链接这几个jsp页面的地址,这个页面应该如何写呢??

------解决方案--------------------
前台jsp中form表单提交的action:StudentmyMethod,在action中写一个myMethod的方法,在返回的视图资源中 /StudentmyMethod_success.jsp