In struts2, is it possible to use an optional template with a variable?

constant

<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.patternMatcher" value="regex" />

Current version

<action name="list/{pageNo}" method="list" class="xx.GroupAction">
    <result type="dispatcher">/WEB-INF/jsp/sys/group/list.jsp</result>
</action>
<action name="list">
    <result type="redirectAction">list/</result>
</action>

this is what i want

<action name="list(/{pageNo})?" method="list" class="xx.GroupAction">
    <result type="dispatcher">/WEB-INF/jsp/sys/group/list.jsp</result>
</action>

Introduced from wildcard-mappings

Can I achieve what I want?

+4
source share
1 answer

No.

The documentation you specify explains the options available. Optional matches and brackets are not objects of wildcard matches.

0
source

Source: https://habr.com/ru/post/1534586/


All Articles