关于Struts2的404问题

问题:全部路径配置都正确,可是报404html

解决方案:将该页面用action调配json


问题描述:今天出了个问题,在超连接调action时,页面显示404,可是文件路径都是正确的,我甚至能够直接经过404报的地址,在地址栏里直接访问,因此一定不是输入错误。jsp

当时想了很久,才发现当前页面我是直接经过文件地址路径访问的,没有经过action。后来在加了一个空方法,走struts.xml,再访问,成功了。spa


原理我也不太清楚,若是有大神能解答不胜感激。code

贴一下改过的代码orm

<action name="bedRoom" class="com.stumanagewx.action.BedRoomAction_w">
    		<result name="daqinList">manage/dong_w.jsp</result>
    		<result name="xiaoqinList">manage/daqin_w.jsp</result>    		
    		<result name="studentInfo4chaqin">manage/studentInfo4chaqin_w.jsp</result>    		
    		<result name="informDaqin">manage/daqin_w.jsp</result>
    		<result name="shaixuan" type="json">
    			<param name="root">result</param>
    		</result>
    		<result name="showImgInTable">manage/show.jsp</result>    //这个页面是shaixuan_w.html中超连接访问action跳转的页面
                                                                          //没有把shaixuan_w.html设为经过action以前,一直404
    		<result name="toShaiXuan_w">manage/shaixuan_w.html</result>//把 shaixuan_w.html设置为经过action访问 以前是直接访问
    		
    	</action>