I am new to jquery and ajax. I want to call a particular method "logout" of action 'LoginAction' in Struts2. I am getting an error
There is no Action mapped for namespace / and action name logoutLoginAction.
My ajax code is:
function signout(){
$.ajax({
type: "POST",
assync:false,
url: "logoutLoginAction.action",
success: function(messageResponse) {
response=messageResponse;
alert(response);
}});
}
What you are trying to achieve is called Wildcard mapping.
In your case it should be something like:
If you will call
logoutLoginAction, logout will be used as{1}and then thelogout()method will be called and thelogout.jspfile will be returned.Alternatively, you can define an action for every method of your Java file, as described here.