批量保存高级用法
jsp页面:jh_edit_content.jsp
<%
...
@ page contentType="text/html; charset=utf-8" language="java"
%>
< link rel ="stylesheet" type ="text/css" href ="../templates/js_css/templates_kind.css" media ="screen" />
< script language ="javascript" src ="../templates/js_css/templates_kind.js" type ="text/javascript" ></ script >
< script language ="javascript" src ="../community/js_css/qyjh.js" type ="text/javascript" ></ script >
< jsp:useBean id ="BLoad_kind" class ="myclass.sysmanager.bargain.BargainLoad" scope ="page" />
<% ...
//----------------------------- 新建计划 -------------------------------
String tem_bh = CB.clearNull(request.getParameter("bh"),"6");
ParProperty ppro_jh = new ParProperty();
RetProperty rpro_jh = new RetProperty();
ppro_jh.setJhbh(tem_bh);
rpro_jh = load.getOne(ppro_jh);
String ls_jhmc = rpro_jh.getJhmc();
String ls_je = rpro_jh.getJe();
String ls_sm = rpro_jh.getSm();
Vector vec_jh = rpro_jh.getVec();
%>
< form name ="FORM_JH" id ="FORM_JH" action ="./jh_manager.jsp" method ="post" >
< table width ="98%" align ="center" cellspacing ="1" cellpadding ="3" class ="new_table" >
< tr >
< td class ="tab_head tab_new" >< b >< font size ="4" > 修改契约计划 </ font ></ b ></ td >
</ tr >
< tr >
< td class ="tab_content" >
< br />
< table width ="98%" align ="center" cellspacing ="0" cellpadding ="0" >
< tr >
< td width ="7%" align ="center" ></ td >
< td width ="70%" >
名称:
< input type ="text" style ="width:75%;" name ="Form_jh_mc" id ="Form_jh_mc" value ="<%=ls_jhmc%>" />
</ td >
< td width ="23%" ></ td >
</ tr >
< tr >
< td width ="7%" align ="center" ></ td >
< td width ="70%" >
金额:
< input type ="text" style ="width:75%;" name ="Form_jh_je" id ="Form_jh_je" value ="<%=ls_je%>" />
</ td >
</ tr >
< tr >
< td width ="7%" align ="center" ></ td >
< td width ="70%" >
说明:
< textarea style ="width:75%;" name ="Form_jh_sm" id ="Form_jh_sm" > <% = ls_sm %> </ textarea >
</ td >
</ tr >
< tr >
< td ></ td >
< td >
< input type ="hidden" name ="Form_jh_bh" id ="Form_jh_bh" value ="<%=tem_bh%>" />
< input type ="hidden" name ="Form_action" id ="Form_action" value ="save" />
< input type ="hidden" name ="Form_jh_xlbh" id ="Form_jh_xlbh" value ="" />
</ td >
</ tr >
</ table >
< br />
</ td >
</ tr >
</ table >
</ form >
< br />
<% ... //----------------------------- 已选的小类 开始 ------------------------------- %>
< table width ="98%" align ="center" cellspacing ="1" cellpadding ="3" class ="i_table" >
< tr >
< td class ="tab_head" > 已选的小类 </ td >
</ tr >
< tr >
< td class ="tab_content" align ="center" >
<% ...
if(vec_jh.size()>0){
for(int i=0;i<vec_jh.size();i++){
RetProperty temp_jh_rpro = (RetProperty)vec_jh.elementAt(i);
String temp_jh_bh = temp_jh_rpro.getXlbh();
String temp_jh_mc = temp_jh_rpro.getXlmc();
String temp_jh_sm = temp_jh_rpro.getSm();
%>
< input name ="choosesmallkind_<%=temp_jh_bh%>" id ="choosesmallkind_<%=temp_jh_bh%>" type ="checkbox" checked ="checked" value ="1" onchange ="addSmallkind('<%=temp_jh_bh%>')" /> <% = temp_jh_mc %>
<% ...
}
}else{
%>
< br /> 请在下面选取小类 < br />< br />
<% ...
}
%>
</ td >
</ tr >
</ table >
< br />
<% ... //----------------------------- 未选的小类 开始 ------------------------------- %>
< table width ="98%" align ="center" cellspacing ="0" cellpadding ="0" class ="i_table" >
< tr >
< td class ="tab_head td_right" width ="40%" > 契约大类 </ td >
< td class ="tab_head" width ="60%" > 契约小类 </ td >
</ tr >
< tr >
<% ...
Load load_kind = (Load)BLoad_kind;
ParProperty ppro_kind = new ParProperty();
RetProperty rpro_kind = new RetProperty();
ppro_kind.setPageNum(1);
ppro_kind.setENum(1000); //每页显示的条数
ppro_kind.setDlbh("");
Vector vec_qy = load_kind.getList(ppro_kind);
if(vec_qy!=null && vec_qy.size()>0){
%>
< td class ="tab_content" align ="center" >
<% ...
for(int i=0;i<vec_qy.size();i++){
rpro_kind = (RetProperty)vec_qy.elementAt(i);
String temp_jh_bh = rpro_kind.getDlbh();
String temp_jh_mc = rpro_kind.getDlmc();
String temp_jh_sm = rpro_kind.getSm();
%>
< table cellpadding ="1" cellspacing ="4" border ="0" width ="100%" id ="ymct_tab_<%=temp_jh_bh%>" onmouseover ="mouse_event_changeclass(event)" onmouseout ="mouse_event_changeclass(event)" onclick ="Class_onclick(this); Show_smallkind('<%=temp_jh_bh%>');" class ="tab_onmouseout" >
< tr >
< td > <% = i + 1 %> . <% = temp_jh_mc %>
< div id ="DIV_smallkind_<%=temp_jh_bh%>" style ="display:none;" ></ div >
</ td >
</ tr >
</ table >
<% ...
}
}
%>
</ td >
< td class ="tab_content" >
< div id ="Display_Smallkind" ></ div >
</ td >
</ tr >
< tr >< td colspan ="2" class ="tab_content" >< br /></ td ></ tr >
</ table >
< br />
< div align ="center" >
< input type ="button" value ="保 存" onclick ="$('FORM_JH').submit();" />
< input type ="button" value ="删 除" onclick ="Delete_jh('<%=tem_bh%>');" />
< input type ="button" value ="撤销并返回" onclick ="Goback_jh();" />
</ div >
< link rel ="stylesheet" type ="text/css" href ="../templates/js_css/templates_kind.css" media ="screen" />
< script language ="javascript" src ="../templates/js_css/templates_kind.js" type ="text/javascript" ></ script >
< script language ="javascript" src ="../community/js_css/qyjh.js" type ="text/javascript" ></ script >
< jsp:useBean id ="BLoad_kind" class ="myclass.sysmanager.bargain.BargainLoad" scope ="page" />
<% ...
//----------------------------- 新建计划 -------------------------------
String tem_bh = CB.clearNull(request.getParameter("bh"),"6");
ParProperty ppro_jh = new ParProperty();
RetProperty rpro_jh = new RetProperty();
ppro_jh.setJhbh(tem_bh);
rpro_jh = load.getOne(ppro_jh);
String ls_jhmc = rpro_jh.getJhmc();
String ls_je = rpro_jh.getJe();
String ls_sm = rpro_jh.getSm();
Vector vec_jh = rpro_jh.getVec();
%>
< form name ="FORM_JH" id ="FORM_JH" action ="./jh_manager.jsp" method ="post" >
< table width ="98%" align ="center" cellspacing ="1" cellpadding ="3" class ="new_table" >
< tr >
< td class ="tab_head tab_new" >< b >< font size ="4" > 修改契约计划 </ font ></ b ></ td >
</ tr >
< tr >
< td class ="tab_content" >
< br />
< table width ="98%" align ="center" cellspacing ="0" cellpadding ="0" >
< tr >
< td width ="7%" align ="center" ></ td >
< td width ="70%" >
名称:
< input type ="text" style ="width:75%;" name ="Form_jh_mc" id ="Form_jh_mc" value ="<%=ls_jhmc%>" />
</ td >
< td width ="23%" ></ td >
</ tr >
< tr >
< td width ="7%" align ="center" ></ td >
< td width ="70%" >
金额:
< input type ="text" style ="width:75%;" name ="Form_jh_je" id ="Form_jh_je" value ="<%=ls_je%>" />
</ td >
</ tr >
< tr >
< td width ="7%" align ="center" ></ td >
< td width ="70%" >
说明:
< textarea style ="width:75%;" name ="Form_jh_sm" id ="Form_jh_sm" > <% = ls_sm %> </ textarea >
</ td >
</ tr >
< tr >
< td ></ td >
< td >
< input type ="hidden" name ="Form_jh_bh" id ="Form_jh_bh" value ="<%=tem_bh%>" />
< input type ="hidden" name ="Form_action" id ="Form_action" value ="save" />
< input type ="hidden" name ="Form_jh_xlbh" id ="Form_jh_xlbh" value ="" />
</ td >
</ tr >
</ table >
< br />
</ td >
</ tr >
</ table >
</ form >
< br />
<% ... //----------------------------- 已选的小类 开始 ------------------------------- %>
< table width ="98%" align ="center" cellspacing ="1" cellpadding ="3" class ="i_table" >
< tr >
< td class ="tab_head" > 已选的小类 </ td >
</ tr >
< tr >
< td class ="tab_content" align ="center" >
<% ...
if(vec_jh.size()>0){
for(int i=0;i<vec_jh.size();i++){
RetProperty temp_jh_rpro = (RetProperty)vec_jh.elementAt(i);
String temp_jh_bh = temp_jh_rpro.getXlbh();
String temp_jh_mc = temp_jh_rpro.getXlmc();
String temp_jh_sm = temp_jh_rpro.getSm();
%>
< input name ="choosesmallkind_<%=temp_jh_bh%>" id ="choosesmallkind_<%=temp_jh_bh%>" type ="checkbox" checked ="checked" value ="1" onchange ="addSmallkind('<%=temp_jh_bh%>')" /> <% = temp_jh_mc %>
<% ...
}
}else{
%>
< br /> 请在下面选取小类 < br />< br />
<% ...
}
%>
</ td >
</ tr >
</ table >
< br />
<% ... //----------------------------- 未选的小类 开始 ------------------------------- %>
< table width ="98%" align ="center" cellspacing ="0" cellpadding ="0" class ="i_table" >
< tr >
< td class ="tab_head td_right" width ="40%" > 契约大类 </ td >
< td class ="tab_head" width ="60%" > 契约小类 </ td >
</ tr >
< tr >
<% ...
Load load_kind = (Load)BLoad_kind;
ParProperty ppro_kind = new ParProperty();
RetProperty rpro_kind = new RetProperty();
ppro_kind.setPageNum(1);
ppro_kind.setENum(1000); //每页显示的条数
ppro_kind.setDlbh("");
Vector vec_qy = load_kind.getList(ppro_kind);
if(vec_qy!=null && vec_qy.size()>0){
%>
< td class ="tab_content" align ="center" >
<% ...
for(int i=0;i<vec_qy.size();i++){
rpro_kind = (RetProperty)vec_qy.elementAt(i);
String temp_jh_bh = rpro_kind.getDlbh();
String temp_jh_mc = rpro_kind.getDlmc();
String temp_jh_sm = rpro_kind.getSm();
%>
< table cellpadding ="1" cellspacing ="4" border ="0" width ="100%" id ="ymct_tab_<%=temp_jh_bh%>" onmouseover ="mouse_event_changeclass(event)" onmouseout ="mouse_event_changeclass(event)" onclick ="Class_onclick(this); Show_smallkind('<%=temp_jh_bh%>');" class ="tab_onmouseout" >
< tr >
< td > <% = i + 1 %> . <% = temp_jh_mc %>
< div id ="DIV_smallkind_<%=temp_jh_bh%>" style ="display:none;" ></ div >
</ td >
</ tr >
</ table >
<% ...
}
}
%>
</ td >
< td class ="tab_content" >
< div id ="Display_Smallkind" ></ div >
</ td >
</ tr >
< tr >< td colspan ="2" class ="tab_content" >< br /></ td ></ tr >
</ table >
< br />
< div align ="center" >
< input type ="button" value ="保 存" onclick ="$('FORM_JH').submit();" />
< input type ="button" value ="删 除" onclick ="Delete_jh('<%=tem_bh%>');" />
< input type ="button" value ="撤销并返回" onclick ="Goback_jh();" />
</ div >
数据操作页面:jh_manager.jsp
<%
...
@ page contentType="text/html; charset=utf-8" language="java"
%>
<% ... @ page import="myclass.pro.ParProperty" %>
<% ... @ page import="myclass.pro.RetProperty" %>
<% ... @ page import="myclass.pro.MesProperty" %>
<% ... @ page import="myclass.impl.Save" %>
<% ... @ page import="java.util.Vector" %>
<% ... @ include file="../common/com_config.jsp" %>
<% ...
/*
#########################################################################
注意: 以下代码为模板代码,除了 "可修改代码部分"可以按需要修改外,其他不能随意修改。
#########################################################################
*/
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
< jsp:useBean id ="BSave" class ="myclass.sysmanager.bargain.BargainPlanSave" scope ="page" />
<% ...
Save save = (Save)BSave;
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
String gs_jh_num = CB.clearNull(request.getParameter("Form_jh_bh"));
String gs_jh_action = CB.clearNull(request.getParameter("Form_action"));
String gs_jh_name = CB.setcn(CB.clearNull(request.getParameter("Form_jh_mc")));
String gs_jh_je = CB.setcn(CB.clearNull(request.getParameter("Form_jh_je")));
String gs_jh_sm = CB.setcn(CB.clearNull(request.getParameter("Form_jh_sm")));
String gs_jh_xlbh = CB.setcn(CB.clearNull(request.getParameter("Form_jh_xlbh")));
// String gs_smallkind_size = CB.clearNull(request.getParameter("Form_son_size_"+gs_jh_num),"0");
/************************************************************************
* 新增大类 开始 *
************************************************************************/
if(gs_jh_action.equals("insert")){
MesProperty mpro = new MesProperty();
ParProperty ppro = new ParProperty();
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if(gs_jh_name.equals("")){
%>
< script language ="javascript" type ="text/javascript" > ...
alert("请输入名称!");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
}else{
ppro.setJhmc(gs_jh_name);
ppro.setJe(gs_jh_je);
ppro.setSm(gs_jh_sm);
ppro.setJdr("ison");
mpro = save.insertData(ppro);
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=mpro.isFlag()%>");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
}
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/************************************************************************
* 保存kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("save") && !gs_jh_num.equals("")){
MesProperty mpro = new MesProperty();
ParProperty ppro = new ParProperty();
Vector vec_smallKind = new Vector();
if(!gs_jh_xlbh.equals("")){
String[] smallkind_array = (gs_jh_xlbh.replaceAll("#","")).split(",");
ParProperty ppro_small = new ParProperty();
for(int i=0;i<smallkind_array.length;i++){
ppro_small.setXlbh(smallkind_array[i]);
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=ppro_small.getXlbh()%>");
</ script >
<% ...
vec_smallKind.add(ppro_small);
}
}
ppro.setJhbh(gs_jh_num);
ppro.setJhmc(gs_jh_name);
ppro.setJe(gs_jh_je);
ppro.setSm(gs_jh_sm);
ppro.setVec(vec_smallKind);
mpro = save.updateData(ppro);
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=mpro.isFlag()%>");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
/************************************************************************
* 删除kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("delete")){
MesProperty mpro = new MesProperty();
ParProperty ppro = new ParProperty();
ppro.setJhbh(gs_jh_num);
mpro = save.deleteData(ppro);
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=mpro.isFlag()%>");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/************************************************************************
* 编辑kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("edit")){
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
< script language ="javascript" type ="text/javascript" > ...
</ script >
<% ...
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/************************************************************************
* 下拉框kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("selectdata")){
%>
<% ...
}
%>
<% ... @ page import="myclass.pro.ParProperty" %>
<% ... @ page import="myclass.pro.RetProperty" %>
<% ... @ page import="myclass.pro.MesProperty" %>
<% ... @ page import="myclass.impl.Save" %>
<% ... @ page import="java.util.Vector" %>
<% ... @ include file="../common/com_config.jsp" %>
<% ...
/*
#########################################################################
注意: 以下代码为模板代码,除了 "可修改代码部分"可以按需要修改外,其他不能随意修改。
#########################################################################
*/
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
< jsp:useBean id ="BSave" class ="myclass.sysmanager.bargain.BargainPlanSave" scope ="page" />
<% ...
Save save = (Save)BSave;
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
String gs_jh_num = CB.clearNull(request.getParameter("Form_jh_bh"));
String gs_jh_action = CB.clearNull(request.getParameter("Form_action"));
String gs_jh_name = CB.setcn(CB.clearNull(request.getParameter("Form_jh_mc")));
String gs_jh_je = CB.setcn(CB.clearNull(request.getParameter("Form_jh_je")));
String gs_jh_sm = CB.setcn(CB.clearNull(request.getParameter("Form_jh_sm")));
String gs_jh_xlbh = CB.setcn(CB.clearNull(request.getParameter("Form_jh_xlbh")));
// String gs_smallkind_size = CB.clearNull(request.getParameter("Form_son_size_"+gs_jh_num),"0");
/************************************************************************
* 新增大类 开始 *
************************************************************************/
if(gs_jh_action.equals("insert")){
MesProperty mpro = new MesProperty();
ParProperty ppro = new ParProperty();
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if(gs_jh_name.equals("")){
%>
< script language ="javascript" type ="text/javascript" > ...
alert("请输入名称!");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
}else{
ppro.setJhmc(gs_jh_name);
ppro.setJe(gs_jh_je);
ppro.setSm(gs_jh_sm);
ppro.setJdr("ison");
mpro = save.insertData(ppro);
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=mpro.isFlag()%>");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
}
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/************************************************************************
* 保存kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("save") && !gs_jh_num.equals("")){
MesProperty mpro = new MesProperty();
ParProperty ppro = new ParProperty();
Vector vec_smallKind = new Vector();
if(!gs_jh_xlbh.equals("")){
String[] smallkind_array = (gs_jh_xlbh.replaceAll("#","")).split(",");
ParProperty ppro_small = new ParProperty();
for(int i=0;i<smallkind_array.length;i++){
ppro_small.setXlbh(smallkind_array[i]);
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=ppro_small.getXlbh()%>");
</ script >
<% ...
vec_smallKind.add(ppro_small);
}
}
ppro.setJhbh(gs_jh_num);
ppro.setJhmc(gs_jh_name);
ppro.setJe(gs_jh_je);
ppro.setSm(gs_jh_sm);
ppro.setVec(vec_smallKind);
mpro = save.updateData(ppro);
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=mpro.isFlag()%>");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
/************************************************************************
* 删除kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("delete")){
MesProperty mpro = new MesProperty();
ParProperty ppro = new ParProperty();
ppro.setJhbh(gs_jh_num);
mpro = save.deleteData(ppro);
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
< script language ="javascript" type ="text/javascript" > ...
alert("<%=mpro.isFlag()%>");
window.location.href="../community/index.jsp?cfc=2&csc=2000&lx=1&do=show";
</ script >
<% ...
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/************************************************************************
* 编辑kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("edit")){
// 可修改代码部分 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
< script language ="javascript" type ="text/javascript" > ...
</ script >
<% ...
// 可修改代码部分 结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/************************************************************************
* 下拉框kind 开始 *
************************************************************************/
}else if(gs_jh_action.equals("selectdata")){
%>
<% ...
}
%>
ajax读取数据代码:qyjh_manager.jsp
<%
...
String ls_bigkind_num = CB.clearNull(request.getParameter("bnum"));
ParProperty ppro = new ParProperty();
RetProperty rpro = new RetProperty();
ppro.setPageNum(1);
ppro.setENum(1000); //每页显示的条数
ppro.setDlbh(ls_bigkind_num);
Load load = (Load)BLoad;
Vector vec_qy = load.getList(ppro);
if(vec_qy!=null && vec_qy.size()>0){
for(int i=0;i<vec_qy.size();i++){
rpro = (RetProperty)vec_qy.elementAt(i);
String temp_jh_bh = rpro.getXlbh();
String temp_jh_mc = rpro.getXlmc();
String temp_jh_sm = rpro.getSm();
%>
< input name ="choosesmallkind_<%=temp_jh_bh%>" id ="choosesmallkind_<%=temp_jh_bh%>" type ="checkbox" value ="1" onchange ="addSmallkind('<%=temp_jh_bh%>')" /> <% = temp_jh_mc %>
<% ...
}
}else{
out.print("该契约大类中没有小类数据~");
}
%>
< script language ="javascript" > ...
$("Display_Smallkind").innerHTML = $("DIV_smallkind_<%=ls_bigkind_num%>").innerHTML;
</ script >
String ls_bigkind_num = CB.clearNull(request.getParameter("bnum"));
ParProperty ppro = new ParProperty();
RetProperty rpro = new RetProperty();
ppro.setPageNum(1);
ppro.setENum(1000); //每页显示的条数
ppro.setDlbh(ls_bigkind_num);
Load load = (Load)BLoad;
Vector vec_qy = load.getList(ppro);
if(vec_qy!=null && vec_qy.size()>0){
for(int i=0;i<vec_qy.size();i++){
rpro = (RetProperty)vec_qy.elementAt(i);
String temp_jh_bh = rpro.getXlbh();
String temp_jh_mc = rpro.getXlmc();
String temp_jh_sm = rpro.getSm();
%>
< input name ="choosesmallkind_<%=temp_jh_bh%>" id ="choosesmallkind_<%=temp_jh_bh%>" type ="checkbox" value ="1" onchange ="addSmallkind('<%=temp_jh_bh%>')" /> <% = temp_jh_mc %>
<% ...
}
}else{
out.print("该契约大类中没有小类数据~");
}
%>
< script language ="javascript" > ...
$("Display_Smallkind").innerHTML = $("DIV_smallkind_<%=ls_bigkind_num%>").innerHTML;
</ script >
js脚本核心代码:
function
Delete_jh()
...
{
if(confirm("是否删除该记录?"))...{
var Form = $("FORM_JH");
$("Form_action").value = "delete";
Form.submit();
}
}
function Show_smallkind(bignum) ... {
var obj_smallkind = $("DIV_smallkind_"+bignum);
if(obj_smallkind.innerHTML.length < 5)...{
var url = "../community/qyjh_manager.jsp";
var pars = "";
pars = ajaxaddpars_var("Form_action",pars,"kind");
pars = ajaxaddpars_var("bnum",pars,bignum);
mynormalAjax(url,pars,"DIV_smallkind_"+bignum);
}else...{
$("Display_Smallkind").innerHTML = obj_smallkind.innerHTML;
}
}
function addSmallkind(check_xlbh) ... {
var temp_xl = $F("Form_jh_xlbh");
var checkbox_obj = $("choosesmallkind_"+check_xlbh);
checkbox_obj.checked = !checkbox_obj.checked;
var temp_checknum = "#"+check_xlbh+"#";
if(checkbox_obj.checked && temp_xl.indexOf(temp_checknum)<0)...{
if(temp_xl=="")...{
$("Form_jh_xlbh").value = temp_checknum;
}else...{
$("Form_jh_xlbh").value = temp_xl + "," + temp_checknum;
}
}else if(checkbox_obj.checked==false && temp_xl.indexOf(temp_checknum)>=0)...{
temp_xl = temp_xl.replace(new RegExp(","+temp_checknum),"");
temp_xl = temp_xl.replace(new RegExp(temp_checknum+","),"");
temp_xl = temp_xl.replace(new RegExp(temp_checknum),"");
$("Form_jh_xlbh").value = temp_xl;
}
//alert($F("Form_jh_xlbh"));
return;
}
if(confirm("是否删除该记录?"))...{
var Form = $("FORM_JH");
$("Form_action").value = "delete";
Form.submit();
}
}
function Show_smallkind(bignum) ... {
var obj_smallkind = $("DIV_smallkind_"+bignum);
if(obj_smallkind.innerHTML.length < 5)...{
var url = "../community/qyjh_manager.jsp";
var pars = "";
pars = ajaxaddpars_var("Form_action",pars,"kind");
pars = ajaxaddpars_var("bnum",pars,bignum);
mynormalAjax(url,pars,"DIV_smallkind_"+bignum);
}else...{
$("Display_Smallkind").innerHTML = obj_smallkind.innerHTML;
}
}
function addSmallkind(check_xlbh) ... {
var temp_xl = $F("Form_jh_xlbh");
var checkbox_obj = $("choosesmallkind_"+check_xlbh);
checkbox_obj.checked = !checkbox_obj.checked;
var temp_checknum = "#"+check_xlbh+"#";
if(checkbox_obj.checked && temp_xl.indexOf(temp_checknum)<0)...{
if(temp_xl=="")...{
$("Form_jh_xlbh").value = temp_checknum;
}else...{
$("Form_jh_xlbh").value = temp_xl + "," + temp_checknum;
}
}else if(checkbox_obj.checked==false && temp_xl.indexOf(temp_checknum)>=0)...{
temp_xl = temp_xl.replace(new RegExp(","+temp_checknum),"");
temp_xl = temp_xl.replace(new RegExp(temp_checknum+","),"");
temp_xl = temp_xl.replace(new RegExp(temp_checknum),"");
$("Form_jh_xlbh").value = temp_xl;
}
//alert($F("Form_jh_xlbh"));
return;
}
java方法核心代码:BargainPlanSave.jave
//
--------------修改计划=-----------
public MesProperty updatePlan(ParProperty ppro) ... {
MesProperty mpro = new MesProperty();
if(ppro.getJhmc().equals(""))...{
mpro.setFlag(false);
mpro.setMessage("计划名称不能为空!");
}else...{
try...{
ExtQyjhbDAO qyjhbdao=(ExtQyjhbDAO)ub.getBean("ExtQyjhbDAO");
Qyjhb qyjhb =(Qyjhb)qyjhbdao.findByJhbh(ppro.getJhbh()).get(0);
qyjhb.setJhmc(ppro.getJhmc());
qyjhb.setJe(ppro.getJe());
qyjhb.setSm(ppro.getSm());
if(qyjhb.getJybz()!=null && !qyjhb.getJybz().equals(""))...{
qyjhb.setJybz(qyjhb.getJybz());
}
qyjhbdao.getHibernateTemplate().update(qyjhb);
//修改关联的契约小类
updateQyxl(ppro);
mpro.setFlag(true);
mpro.setMessage("保存数据成功!");
}catch(Exception e)...{
mpro.setFlag(false);
mpro.setMessage("保存数据出错!");
e.printStackTrace();
}
}
return mpro;
}
// 修改契约小类
public void updateQyxl(ParProperty ppro) ... {
Vector vec = ppro.getVec();
ExtQyglbDAO extQyglbDAO = (ExtQyglbDAO) ub.getBean("ExtQyglbDAO");
if(vec!=null)...{
List list = extQyglbDAO.getHibernateTemplate().find("from Qyglb where jhbh='"+ppro.getJhbh()+"'");
if(list.size()>0)...{
extQyglbDAO.getHibernateTemplate().deleteAll(list); //删除已有的计划
}
for(int i=0;i<vec.size();i++)...{
ParProperty ppro2 = (ParProperty) vec.elementAt(i);//.get(i);
Qyglb qyglb = new Qyglb();
qyglb.setJhbh(ppro.getJhbh());
qyglb.setXlbh(ppro2.getXlbh());
//System.out.println("xlbh:"+ppro2.getXlbh());
qyglb.setJybz("0");
extQyglbDAO.save(qyglb);
}
}
}
// --------------删除计划=-----------
public MesProperty deletePlan(ParProperty ppro) ... {
MesProperty mpro = new MesProperty();
try...{
ExtQyjhbDAO qyjhbdao=(ExtQyjhbDAO)ub.getBean("ExtQyjhbDAO");
Qyjhb qyjhb=(Qyjhb)qyjhbdao.findByJhbh(ppro.getJhbh()).get(0);
qyjhb.setJybz("1");
qyjhbdao.getHibernateTemplate().update(qyjhb);
mpro.setFlag(true);
mpro.setMessage("删除数据成功!");
}catch(Exception e)...{
mpro.setFlag(false);
mpro.setMessage("删除数据出错!");
e.printStackTrace();
}
return mpro;
}
public MesProperty updatePlan(ParProperty ppro) ... {
MesProperty mpro = new MesProperty();
if(ppro.getJhmc().equals(""))...{
mpro.setFlag(false);
mpro.setMessage("计划名称不能为空!");
}else...{
try...{
ExtQyjhbDAO qyjhbdao=(ExtQyjhbDAO)ub.getBean("ExtQyjhbDAO");
Qyjhb qyjhb =(Qyjhb)qyjhbdao.findByJhbh(ppro.getJhbh()).get(0);
qyjhb.setJhmc(ppro.getJhmc());
qyjhb.setJe(ppro.getJe());
qyjhb.setSm(ppro.getSm());
if(qyjhb.getJybz()!=null && !qyjhb.getJybz().equals(""))...{
qyjhb.setJybz(qyjhb.getJybz());
}
qyjhbdao.getHibernateTemplate().update(qyjhb);
//修改关联的契约小类
updateQyxl(ppro);
mpro.setFlag(true);
mpro.setMessage("保存数据成功!");
}catch(Exception e)...{
mpro.setFlag(false);
mpro.setMessage("保存数据出错!");
e.printStackTrace();
}
}
return mpro;
}
// 修改契约小类
public void updateQyxl(ParProperty ppro) ... {
Vector vec = ppro.getVec();
ExtQyglbDAO extQyglbDAO = (ExtQyglbDAO) ub.getBean("ExtQyglbDAO");
if(vec!=null)...{
List list = extQyglbDAO.getHibernateTemplate().find("from Qyglb where jhbh='"+ppro.getJhbh()+"'");
if(list.size()>0)...{
extQyglbDAO.getHibernateTemplate().deleteAll(list); //删除已有的计划
}
for(int i=0;i<vec.size();i++)...{
ParProperty ppro2 = (ParProperty) vec.elementAt(i);//.get(i);
Qyglb qyglb = new Qyglb();
qyglb.setJhbh(ppro.getJhbh());
qyglb.setXlbh(ppro2.getXlbh());
//System.out.println("xlbh:"+ppro2.getXlbh());
qyglb.setJybz("0");
extQyglbDAO.save(qyglb);
}
}
}
// --------------删除计划=-----------
public MesProperty deletePlan(ParProperty ppro) ... {
MesProperty mpro = new MesProperty();
try...{
ExtQyjhbDAO qyjhbdao=(ExtQyjhbDAO)ub.getBean("ExtQyjhbDAO");
Qyjhb qyjhb=(Qyjhb)qyjhbdao.findByJhbh(ppro.getJhbh()).get(0);
qyjhb.setJybz("1");
qyjhbdao.getHibernateTemplate().update(qyjhb);
mpro.setFlag(true);
mpro.setMessage("删除数据成功!");
}catch(Exception e)...{
mpro.setFlag(false);
mpro.setMessage("删除数据出错!");
e.printStackTrace();
}
return mpro;
}