我在struts.xml中添加了 
<constant name="struts.action.extension" value="do" />
然后再jsp中将
<a href="<%=basePath %>users/goods!moreGoods">返回列表</a>
改为
<a href="<%=basePath %>users/goods.do!moreGoods">返回列表</a>请问这样为什么会出现404错误,上面的代码是没有将action的访问后缀改为.do的时候的的代码,第二段是将action 的访问后缀改为.do的代码。

解决方案 »

  1.   

    goods!moreGoods,这里不是应该用?么
      

  2.   

    这个写法是调用goodsaction的moreGoods方法,朋友,没写错
      

  3.   

    在WEB.XML中需要加入监听<filter-mapping>
            <filter-name>struts</filter-name>
            <url-pattern>*.do</url-pattern>
    </filter-mapping>
      

  4.   

    struts.xml文件中添加开发模式,或是删除tomcat中的部署文件重新部署。
      

  5.   

    首先你要明白一点:web.xml是最先执行的。然后进入Struts2的filter。然后才会做一些其他的存在(读取全局配置文件..)。所以首先要将Filter配置好
    <filter-mapping>
      <filter-name>struts</filter-name>
      <url-pattern>*.do</url-pattern>
    </filter-mapping>
      

  6.   

    <a href="<%=basePath %>users/goods.do">返回列表</a>
    那就应该改成这样啊!你要执行moreGoods这个方法
    这加在.do后面是不行的!
      

  7.   


    这个配置是需要的  如果你用的是structs2 的话