0

There is a project download from network, in its structs.xml, there is action configuration:

<action name="elecMenuAction_*" class="elecMenuAction" method="{1}">
    <result name="menuHome">/WEB-INF/page/menu/home.jsp</result>
</action>

I don't know the method="{1}" mean, how to understand the mean?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
three-blocks
  • 353
  • 1
  • 4
  • 20

2 Answers2

1

This link can be useful in understanding the above syntax Struts2, best practice for using method={1}

Kathir
  • 1,282
  • 1
  • 15
  • 19
Pooja Arora
  • 574
  • 7
  • 19
1

If there is method="{number}", corresponding, the action config should have * in its name,

Example:

<action name="user_*" class="UserAction" method="{1}">

and in its corresponding jsp if has a form :

In that way, structs will let the user_userLogin action according to the user_*’s format analysis, and take out the * according the number 1, 2, 3 …, 1 means the first *.

If the action config like this:

<action name="user_*_*" class="com.xyz.{1}Action" method="{2}">

and the jsp form is like this:

<form action="user_Login_userLogin" method="post">

Its action will become like this:

class="com.xyz.Login" method="{userLogin}"
aircraft
  • 25,146
  • 28
  • 91
  • 166