The action code:
@ParentPackage("basePackage")
@Namespace("/")
@Action(value = "userAction")
@AllowedMethods("test")
public class UserAction {
private static final String[] test = null;
private static Logger logger = Logger.getLogger(UserAction.class);
public void test() {
logger.info("进入action");
}
}
In the struts.xml configuration file:
<constant name="struts.strictMethodInvocation.methodRegex" value="([a-zA-Z]*)"/>
I want to visit
http://localhost:8080/sshe/userAction!Test.action
Now the error:
HTTP Status 404 - There is no Action mapped for namespace and action name [/] [userAction test] associated with context path [/sshe].
I wonder if there is any place to set up. How can I access this address?
You should place the annotation directly on the method. Because if you put it on the class the default method
execute()is used for the mapping.The action method should return a result, if you don't want to execute a result you should return
Action.NONE.If do you want to use SMI then you should add
execute()method to the action class. The above explains why do you need this method to map the action and the return result remains the same since the method execution still remains the action method. You cannot use action mapping to arbitrary execute any method in the action class.The action method is case sensitive, so you have to use URL