日期:2014-05-17 浏览次数:20660 次
public class GetStaffInfoAction extends ActionSupport{
@Autowired
private StaffService staffServiceImpl;
private String username;
public void setUsername(String usernmae) {
this.username = username;
}
private String result;
public String getResult() {
return result;
}
@Override
public String execute(){
Staff staff=staffServiceImpl.getStaffInfo(username);
result=JSONObject.fromObject(staff).toString();
return "str_result";
}
}
public class GetStaffInfoAction extends ActionSupport{
@Autowired
private StaffService staffServiceImpl;
private String username;
public void setUsername(String username) {
this.username = username;
}
private JSONObject json;
public JSONObject getJson() {
return json;
}
@Override
public String execute(){
Staff staff=staffServiceImpl.getStaffInfo(username);
json=JSONObject.fromObject(staff);
return "json_result";
}
}
<global-results>
<result name="str_result" type="json">
<param name="root">result</param>
</result>
<result name="is_success" type="json">
<param name="root">success</param>
</result>
<result name="json_result" type="json">
<param name="root">json</param>
</result>
<result type="exception">/error.jsp</result>
</global-results>