It's not a secret anymore!
The moose likes Struts and the fly likes need help in wildcard mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "need help in wildcard mapping" Watch "need help in wildcard mapping" New topic

need help in wildcard mapping

rajiv shrestha
Ranch Hand

Joined: Aug 25, 2010
Posts: 30

my action class look like below:

package action;

import com.opensymphony.xwork2.ActionSupport;

public class UserAction extends ActionSupport {

private String message;

public String getMessage() {
return message;

public void setMessage(String message) {
this.message = message;

public String execute() throws Exception {
message = "inside execute method";
return "success";

public String add() {
message = "inside add method";
return "success";

public String delete() {
message = "inside delete method";
return "success";

public String edit() {
message = "inside edit method";
return "success";


In struts.xml:

<action name="*User" method="{1}" class="action.UserAction">
<result name="success">/success.jsp</result>

this program works well with the desired output.

But i am unknown about method="{1}".

"method" attribute invokes specific method but what does the parameter "{1}" indicate?

--- need help ---

thnx in advance

Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

Value of {1} will be replaced by the value passed through *.
Also please use code tags while posting the code samples. It will be easier to read the codes.

Krishna Madhava

Joined: Sep 21, 2007
Posts: 11

I also having the same doubt,

So, incase if the user didnt pass the actionname for the '*" parameter in the URL then what will be passed to method={1}.

Ex: http://localhost:8080/context/

here which method will be called..

Thanks in advance
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

Please ShowSomeEffort. What happened when you tried.
I agree. Here's the link:
subject: need help in wildcard mapping
jQuery in Action, 3rd edition