访问这个地址可以进入到首页http://xxx.xxx.xx/indexAction.do?method=list
但是如果恶意输入http://xxx.xxx.xx/xxx/xxx/indexAction.do?method=list之后回车就会出现404....
能不能在哪里配置,如果没有找到action就跳转一个默认页面呢.

解决方案 »

  1.   

    在web.xml中 <error-page>
      <error-code>404</error-code>
      <location>/404.jsp</location>
      </error-page>
        
      <error-page>
      <error-code>500</error-code>
      <location>/500.jsp</location>
      </error-page> 把<location>标签中的页面改成你的默认页面就可以了。
      

  2.   

    在web.xml中
     <error-page>
      <error-code>404</error-code>
      <location>/404.jsp</location>
      </error-page>建议LZ  可以看看 web.xml的详细参数配置 有很多会对你有用的...
      

  3.   

    在你的struts xml配置文件中,package配置下面加上如下字段:<!--如果找不到你访问的action,就来找这个action-->
    <default-action-ref name="default">
    </default-action-ref>
    <action name="default">
    <result name="success">这里是访问到默认action时你要到达的页面</result>
    </action>
    你还可以配置默认的result,当struts找不到你的返回值时就返回你默认的result