Struts2基于注释的Action配置

时间:2013-12-18 16:53:24

标签: java configuration struts2 annotations struts2-convention-plugin

这个例外的原因是什么,它有什么问题?在此先感谢。

WARNING: No configuration found for the specified action: 'ActionAnnotation' in namespace: '/'. Form action defaulting to 'action' attribute's literal value.

HTML:

        <s:form action="ActionAnnotation" >            
            <s:submit  value="ActionAnnotation"/>
        </s:form>

行动:

@ResultPath(value="/")
@Result(name="success",location="differenactions.jsp")
public class ActionAnnotationAction extends ActionSupport{
    private String message;


    public String execute() {
        System.out.println("ActionAnnotation : Hello How are you execute() method got called.....");
        setMessage("ActionAnnotation : Hello How are you");
        return "success";

    }

1 个答案:

答案 0 :(得分:1)

需要以下注释

@Namespace("/")
@Action(value="ActionAnnotation", results=@Result(name="success", location="/differenactions.jsp"))
public class ActionAnnotationAction extends ActionSupport{