<script type="text/javascript" src="<%=serverName%>/js/jquery-1.10.2.js"></script>
<script type="text/javascript">
$("#butajax").click(function(){
var user = {
selectwho:$("#sel1").val(),
selectContext:$("#tex1").val(),
// birthday:$("#birthday").val()
};
$.ajax({
url:'CaseinfoSyscolumns.action',
data:user,
type:'post',
dataType:'text',
contentType:'application/x-www-form-urlencoded; charset=utf-8',
success:function(msg){
$("#main").empty();
$("#main").html(msg);
}
});
});
});
<package name="sele1" extends="MyInterceptor" namespace="/main">
<action name="CaseinfoSyscolumns" class="com.baishiji.action.caseinfo.CaseinfoSyscolumns" method="getColumns">
</action>
</package>
private String selectwho;// 那个下拉
private String selectContext;// 要查询的内容
/*
* 得到他的 所有字段
* (non-Javadoc)
* @see com.opensymphony.xwork2.ActionSupport#execute()
*/
public void getColumns() throws IOException {
System.out.println(selectwho+","+selectContext);
CaseInfoDao dao = new CaseInfoDao();
List<CaseInfo> listtemp= dao.searchMoHu(selectwho,selectContext);
// for (CaseInfo caseInfo : listtemp) {
// System.out.println(caseInfo);
// }
HttpServletResponse response = ServletActionContext.getResponse();
PrintWriter writer = response.getWriter();
response.setContentType("text/html;charset=utf-8");
writer.print(" <table>");
writer.print(" <thead>");
writer.print(" <tr>");
writer.print(" <th width='100'>序号</th>");