日期:2014-05-16  浏览次数:20439 次

struts2 Spring2.5 返回json
@Controller  //纳入Spring管理
@Namespace("/")  //相当于  <package .... namespace="/emp">
@ParentPackage("json-default") //相当于 extends="struts-default" 
public class LoginAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	@Action(value="login", 
		results={@Result(name="success", type="json")}
	)
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		return super.execute();
	}

	private String name;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}