我的通配符开始这样设<action name="*_*_*" />  可以找到相应的action ,但是那样配置太难看了,我想改成下面那个<action name="*/*_*" />  ,但是这样配的话,相应的action找不到了,望各位帮帮忙....

解决方案 »

  1.   

    这个我记得好像是struts2的一个bug
      

  2.   

    我见过 *_*_* 但是没有见过    <action name="*/*_*" />
      

  3.   


    \  转义字符要么就像4楼讲的将*/写在namespace中,用命名空间来分
      

  4.   


    那样不行,因为通配符要对应{1} {2} {3} 如果写在namespace中就对应不起来了
      

  5.   

    是不是类似于这样,多试一下
    <action name="****_*_*" />因为双星可匹配包含'/'Wildcard patterns can contain one or more of the following special tokens:
    *  Matches zero or more characters excluding the slash ('/') character.
    **  Matches zero or more characters including the slash ('/') character.
    \character  The backslash character is used as an escape sequence. Thus'\*'matches the character asterisk ('*'), and'\\'matches the character backslash ('\').
      

  6.   


    实用好是好,不过像这种路径在地址栏上很难看。如:http://localhost:8080/index_index_method
      

  7.   

    action的路径都不好看,但是一般在JSP网站中都会用URL重写的
      

  8.   

    <constant name="struts.enable.SlashesInActionNames" value="true"/>定义这个常量