Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help in wildcard mapping

 
rajiv shrestha
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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;
}

@Override
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>
</action>

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
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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/User.do

here which method will be called..

Thanks in advance
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please ShowSomeEffort. What happened when you tried.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic