<action name="en/articles/categories/*" class="it.cms.article.action.SearchArticleCustom">
<param name="locale">en</param>
<param name="categoryFriendlyUrl">{1}</param>
<result name="success">/pages/article/search_article.jsp</result>
</action>
<action name="en/articles/categories/*/*" class="it.cms.article.action.SearchArticleCustom">
<param name="locale">en</param>
<param name="categoryFriendlyUrl">{2}</param>
<result name="success">/pages/article/search_article.jsp</result>
</action>
<action name="en/articles/categories/*/*/*" class="it.cms.article.action.SearchArticleCustom">
<param name="locale">en</param>
<param name="categoryFriendlyUrl">{3}</param>
<result name="success">/pages/article/search_article.jsp</result>
</action>
所以,我的情况是类别可以嵌套而没有限制。 当前的struts-config文件对于3级子类别非常有用。
我是否可以将此代码设置为“递归”以涵盖无限级别的子类别?
答案 0 :(得分:1)
完全未经测试,但我会尝试类似的事情:
<action name = "en/articles/categories**/*"
class = "it.cms.article.action.SearchArticleCustom">
<param name = "locale">en</param>
<param name = "categoryFriendlyUrl">{2}</param>
<result name = "success">/pages/article/search_article.jsp</result>
</action>
**
:匹配零个或多个字符,包括斜杠('/')字符。