日期:2014-05-17  浏览次数:20903 次

help!大神快来,小弟我又遇到问题了。ssh+easyui中的ajax从jsp向后台传值
先上码
package com.ly.action;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONObject;
import com.ly.model.Teacher;
import com.ly.service.TeacherService;
import com.opensymphony.xwork2.ActionSupport;

public class JsonAction extends ActionSupport {

/**
 * 
 */
private static final long serialVersionUID = 1L;
private String ttName;
private String ttSex;
private String ttWork;
private int ttId;
private JSONObject easyJson;
private TeacherService teacherService;
private HttpServletRequest request;

public String bbb() {

System.out.println( "Name"+getTtName());
String str = request.getParameter(ttName);
List<Teacher> teachers = teacherService.finds(str);
System.out.println("finds" + teachers);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("total", teachers.size());
map.put("rows", teachers);
easyJson = JSONObject.fromObject(map);
return SUCCESS;
}

public String getTtName() {
return ttName;
}

public void setTtName(String ttName) {
this.ttName = ttName;
}

public String getTtSex() {
return ttSex;
}

public void setTtSex(String ttSex) {
this.ttSex = ttSex;
}

public String getTtWork() {
return ttWork;
}

public void setTtWork(String ttWork) {
this.ttWork = ttWork;
}

public int getTtId() {
return ttId;
}

public void setTtId(int ttId) {
this.ttId = ttId;
}

public JSONObject getEasyJson() {
return easyJson;
}

public void setEasyJson(JSONObject easyJson) {
this.easyJson = easyJson;
}


public TeacherService getTeacherService() {
return teacherService;
}

public void setTeacherService(TeacherService teacherService) {
this.teacherService = teacherService;
}

}


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查找-删除老师信息</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="js/easyui-lang-zh_CN.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="css/easyui.css">
<link rel="stylesheet" type="text/css" href="css/common.css">

 </head