0

I have a method ajouterModifierClient() in my action class pl.admin.HomeAction that handles both operations, the add operation and the update operation.

How to map two disctinct action names in on single action tag.

Here is my wanted result:

<action name="{ajouter,modifier}-client" class="pl.admin.HomeAction" method="ajouterModifierClient">
    <result name="success">ajouterModifierClient.jsp</result>
</action>
Roman C
  • 49,761
  • 33
  • 66
  • 176
marsouf
  • 1,107
  • 8
  • 15
  • Unrelated, but what's the point of trying to wedge this into a single `` element? Totally doable (see answer), but harder to read, more confusing to modify, and harder to search for. I wouldn't bother. – Dave Newton Jan 10 '18 at 13:58

1 Answers1

0

You can use pattern matcher regex:

<constant name="struts.patternMatcher" value="regex" />

<action name="{(ajouter|modifier)}-client" class="pl.admin.HomeAction" method="ajouterModifierClient">
    <result name="success">ajouterModifierClient.jsp</result>
</action>
Roman C
  • 49,761
  • 33
  • 66
  • 176