@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");
}
}
Dans le fichier de configuration struts.xml
:Comment utiliser l'annotation Struts2.5 @AllowedMethods ('test') pour implémenter une méthode d'appel dynamique?
<constant name="struts.strictMethodInvocation.methodRegex" value="([a-zA-Z]*)"/>
Je veux visiter 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].!
Je me demande s'il y a un endroit à installer. Comment puis-je accéder à cette adresse?
Pourquoi avez-vous besoin DMI du tout? Votre méthode 'test' n'est pas adaptée à la méthode d'action. –