struts2的annotation配置

struts2 的annotation配置

1.struts。xml

<struts>
 <!-- <constant name="struts.objectFactory" value="spring" /> -->
 <constant name="struts.devMode" value="true" />
 <constant name="struts.convention.result.path" value="/" />

 <package name="myname" extends="struts-default">

 </package>

</struts>

 

2.action配置

@ParentPackage("myname")

 

 @Action(value = "/psp/project/createOrEditProject", results = { @Result(name = "success", location = "createOrEditProject.jsp") })
 public String createOrEdit() {
  if (this.getProjectCode() != null) {
   project = projectService.getByProjectCode(this.getProjectCode());
  }
  return "success";
 }

你可能感兴趣的:(spring,jsp,xml,struts)