我用的是struts2+urlrewrite但是报错404,我之前匹配的时候没有用正规直接用的user来写的传递成功了.这次用正规不行了小弟不太会正规..大家帮我看一下吧.
我在urlrewrite配置如下.就配置了一个
用来匹配user/loginUser用的.正规写的应该是对的吧
<from>^([0-9a-zA-Z]+)\\/([0-9a-zA-Z]+)$</from>  
<to type="forward">$1_$2.action</to>
我的页面代码是这么写的.但是报错404<form id="loginFrom" action="user/loginUser" method="post">
          <table border="0" cellpadding="4" cellspacing="0" class="fontSize12px">
            <tr>
              <td height="40" align="center" valign="bottom">用户:
              <input name="user.username" type="text" class="InputTextStyle" tabindex="1"></td>
            </tr>
            <tr>
              <td height="40" align="center" valign="top">密码:
              <input name="user.password" type="password" class="InputTextStyle" tabindex="2"></td>
            </tr>
             <tr>
              <td height="40" align="center" valign="top">登录:
              <input name="submit" type="submit"  value="登录"  /></td>
            </tr>
          </table>
     </form>
报错404,内容是这样的.HTTP Status 404 - There is no Action mapped for namespace /user and action name loginUser.

解决方案 »

  1.   

    试试这个:<from>^/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$</from>
      

  2.   

    <from>^/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$</from>这个是可以的.^/不包括/的意思.你就少些了一个/
      

  3.   

    明白了但是我这个又有错啊返回的时候不对...
    我的index.jsp在
    ssh2/index.jsp不是user/index.jsp              我觉得是因为刚才的请求之后的问题.那我改怎么办呢.HTTP Status 404 - /ssh2/user/index.jsp
      

  4.   

    我从返回的路径中这么写了.
    只取index.jsp对吧.
    <outbound-rule>
            <from>^/ssh2/([0-9a-zA-Z]+)/([0-9a-zA-Z]+?.jsp)$</from>
            <to>/$2</to>
        </outbound-rule>
      

  5.   

    urlwrite会拿完整的含/的路径去匹配,所以领头的/字符不能省的。
      

  6.   


    我的返回路径怎么办啊????ssh2是我项目名称
    index.jsp在webroot跟目录.
    反响url我咋配置呢?
    我用struts2返回写的是<result name="success">index.jsp</result>报错404/ssh2/user/index.jsp求教.
      

  7.   

    <result name="success">/index.jsp</result>