jsp中一个页面引入另一个页面的实现代码
本文导语: action代码片段 代码如下:public String execute() { String ret = super.execute(); if (RETURN_LIST.equals(ret)) { return list(); } else { return ret; } } public String list() {...
action代码片段
public String execute() {
String ret = super.execute();
if (RETURN_LIST.equals(ret)) {
return list();
} else {
return ret;
}
}
public String list() {
String show = this.getRequest().getParameter("show");
if ("show".equals(show)) {
return show();
}
deptid = getRequest().getParameter("deptid");
if (StringUtils.isNotBlank(deptid)) {
epVO.getEp().setDeptid(Long.valueOf(deptid));
epVO.setDeptid(deptid);
}
if (StringUtils.isNotBlank(deptname)) {
epVO.getDept().setDeptname(deptname);
}
if (StringUtils.isNotBlank(plateno)) {
epVO.setPlateno(plateno);
}
if (StringUtils.isBlank(deptid)) {
epVO.getEp().setDeptid(Long.parseLong("1"));
}
int count = epService.getEpCount(epVO);
PageInfor pageInfor = this.pageInit(this.getRequest(), count);
epVO.setRownum_(pageInfor.getRownum_());
epVO.setRownum(pageInfor.getRownum());
epVO.setOrderName(pageInfor.getOrderName());
List list = epService.getEps(epVO);
this.getRequest().setAttribute(Constants.QUERY_DATA, list);
this.getRequest().setAttribute(Constants.PAGE_INFO, pageInfor);
List editors = new ArrayList();
editors.add(new EditorExt("text", "deptname", "公司"));
editors.add(new EditorExt("text", "plateno", "车牌号"));
editors.add(new EditorExt("text", "deptid", "ID"));
this.getRequest().setAttribute("editor", editors);
List header = new ArrayList();
List header = new ArrayList();
header.add(new Header("index", "序号", "index", "2%"));//1
header.add(new Header("epVO.dept.deptname", "部门", null, "6%"));// 2 jQuery(function()中取普通的值 用下标取 下标是它出现的位置
header.add(new Header("epVO.ep.name", "车牌号", null, "5%"));//3
header.add(new Header("epVO.ep.epid", "内部编号", null, "5%"));//4
header.add(new Header("epVO.ep.eptype", "类型", null, "4%"));//5
header.add(new Header("epVO.ep.devid", "设备号", null, "8%"));
header.add(new Header("epVO.ep.devtype", "设备类型", null, "4%"));
header.add(new Header("epVO.ep.phone", "电话", null, "5%"));
header.add(new Header("epVO.ep.charge", "年服务费", null, "5%"));
header.add(new Header("epVO.ep.info", "备注", null, "15%"));
this.getRequest().setAttribute("header", header);
this.getRequest().setAttribute("header", header);
Map hidden = new LinkedHashMap();
hidden.put("epVO.ep.id", "车辆ID");
hidden.put("epVO.dept.deptid", "部门ID");//jQuery(function()中取隐藏域中的值
hidden.put("epVO.ep.name", "车牌号");//jQuery(function()中取隐藏域中的值
hidden.put("epVO.ep.eptype", "类型");
this.getRequest().setAttribute("hidden", hidden);
String flag = this.getRequest().getParameter("flag");
this.getRequest().setAttribute("flag", flag);
return RETURN_LIST;
}
jsp页面引用代码片段
车辆信息
//部门查询时用到的
$("#queryBtn").removeAttr('onclick').click(
function() {
var obj = document.forms['queryForm'];
obj.action = ''
+ '?deptid=' + document.getElementById('deptid').value;
obj.submit();
});
//打开时页面要传递的值
jQuery(function() {
var flag = '';
if (flag == "open") {
$("#dataTable tr").removeAttr("title").removeAttr("ondblclick");
jQuery(".all_border .hs tbody tr").attr("title", "双击选中");
jQuery(".all_border .hs tbody tr:gt(0)").removeAttr('ondblclick')
.dblclick(
function() {
//隐藏域中取的值 list()中取
var name = $(this).find("input[name='name']")
.val();
//var deptname = $(this).find("input[name='deptname']").val();
var deptid = $(this).find(
"input[name='deptid']").val();
//平常的值
var deptname = $(this).children().eq(2).text()
var info = $(this).children().eq(10).text()
.split(";")[0];
if (info == "") {
info = "暂无路线";
}
var arr = new Array();
arr[0] = name;
arr[1] = deptname;
arr[2] = deptid;
arr[3] = info;
returnValue = arr;
window.close();
});
}
});
$(document)
.ready(
function() {
var deptname = document.getElementById('deptname').value;
var deptid = document.getElementById('deptid').value;
var plateno = document.getElementById('plateno').value;
$("#queryTable")
.html("公司:车牌号:");
var tree = initDropDownTree('orgTree',
'');
setTextBoxTree('deptname', 'deptid', 'orgTree', tree);
});
jsp被引用js代码片段
//另一个页面
// 这个页面的id个数 是根据另一个页面传过来的决定的
function selPlateno(plateno,deptname,deptid,info)
{
var ret = openWin("listEp.action?method=list&flag=open", "900px", "500px");
if (ret != undefined) {
document.getElementById(plateno).value=ret[0];
document.getElementById(deptname).value=ret[1];
document.getElementById(deptid).value=ret[2];
document.getElementById(info).value=ret[3];
}
}
//加载图片显示另一个页面
$(document).ready(function(){
//
$("#plateno").after(" ");
});