加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

SSH Action 中Ajax的调用

发布时间:2020-12-16 00:45:34 所属栏目:百科 来源:网络整理
导读: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.HttpServletRes

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; } }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读