SSH Action 中Ajax的调用

前端之家收集整理的这篇文章主要介绍了SSH Action 中Ajax的调用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

package com.hd.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.hibernate.criterion.DetachedCriteria;

import com.hd.pojo.Menu;
import com.hd.service.MenuService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class MenuAction extends ActionSupport implements ServletRequestAware,ServletResponseAware,ModelDriven<Menu> {
private static final long serialVersionUID = 1L;
private Menu menu=new Menu();
private HttpServletRequest request;
private HttpServletResponse response;
private MenuService menuService;
private List<Menu> list;
private String json;
private PrintWriter out;

/**
* @return
*/
public String execute() {
return SUCCESS;
}

public void find(){

json="123123";
out.print(json);
out.flush();
out.close();
}
public void setServletRequest(HttpServletRequest request) {
this.request=request;
}
//http://www.Juming.com/Csdn/dx/?i=51905897849]7632&s=2930374226c3defc2a80ad7f52f977ed

public void setServletResponse(HttpServletResponse response) {
this.response=response;
try {
this.response.setContentType("text/html;charset=UTF-8");
out=response.getWriter();
} catch (IOException e) {
e.printStackTrace();
}

}

public Menu getModel() {
return menu;
}

public MenuService getMenuService() {
return menuService;
}

public void setMenuService(MenuService menuService) {
this.menuService = menuService;
}

public List<Menu> getList() {
return list;
}

public void setList(List<Menu> list) {
this.list = list;
}

public String getJson() {
return json;
}

public void setJson(String json) { this.json = json; } }

猜你在找的Ajax相关文章