解决Struts2带参数访问的问题

1.struts.xml

        <!--用户-->
        <action name="user_*" class="com.mtea.erp.web.action.basic.UserAction" method="{1}">
            <result name="chain_to_list" type="chain">user_list?pageNumber=${pageNumber}</result>
            <result name="input">/WEB-INF/page/admin/basic/user/userInput.jsp</result>
            <result name="list">/WEB-INF/page/admin/basic/user/userList.jsp</result>
        </action>


2.出现异常:

java.lang.NoSuchMethodException: com.mtea.erp.web.action.basic.UserAction.list?pageNumber=2()


3.如下修改:

        <!--用户-->
        <action name="user_*" class="com.mtea.erp.web.action.basic.UserAction" method="{1}">
            <result name="chain_to_list" type="chain">
                <param name="actionName">user_list</param>
                <param name="pageNumber">${pageNumber}</param>
            </result>
            <result name="input">/WEB-INF/page/admin/basic/user/userInput.jsp</result>
            <result name="list">/WEB-INF/page/admin/basic/user/userList.jsp</result>
        </action>

你可能感兴趣的:(Web,jsp,xml,struts)