Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
188 views
in Technique[技术] by (71.8m points)

java - Wrong URL match in action mapping

<action name="/partner/*/*" class="webStoreAction">
    <param name="saveUrl">true</param>
    <param name="homeName">HomePartner</param>
    <param name="partner">{1}</param>
    <param name="partnerId">{2}</param>
    <param name="homeFromMenu">false</param>
    <result name="success" type="jsf">
        /WEB-INF/pages/load.xhtml
    </result>
</action>

Why localhost:8080/partner/partnerName matches with this action?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try <constant name="struts.patternMatcher" value="regex"/> the only viable matcher for the constants above. This is usually used with advanced wildcards mode, explained here.

Advanced Wildcards From 2.1.9+ regular expressions can be defined defined in the action name. To use this form of wild card, the following constants must be set:

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

The URL splitted into namespace / and action name partner/partnerName. The last matches a pattern compiled from the name in the action config using a wildcard mapper, which is a default mapper.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...