Reputation: 481
I am trying to create an action with two methods (JSON action). I am calling them from JSP files. If I try to call an action value as 'medias' in my code, it simply run both the methods every time.
@Action(value="medias", results = {@Result(name="success",type="json")})
public String getMedias(){
System.out.println("IN METHOD CALL medias");
return SUCCESS;
}
@Action(value="allMediaTypes", results = {@Result(name="success",type="json")})
public String getAllMediaTypes(){
System.out.println("IN METHOD CALL allMediaTypes");
return SUCCESS;
}
Both method runs simultaneously, no matter which method is getting called from jsp, it runs both the methods.
Upvotes: 0
Views: 807
Reputation: 425398
Don't prefix your method names with get
- doing this has implications.
It's a good idea to name them the same as your action names for consistency, ie:
public String medias() {
...
}
public String allMediaTypes() {
...
}
Upvotes: 2