- 浏览: 517052 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (278)
- java (41)
- 设计模式 (4)
- sql (10)
- webservice (2)
- spring (9)
- struts (6)
- struts2 (32)
- hibernate (27)
- Struts_hibernate_Spring整合 (4)
- Velocity (1)
- Servlet (9)
- JSP (6)
- javascript (19)
- jquery (10)
- ajax (4)
- html、xml (3)
- JDBC (2)
- JDK (6)
- mysql (2)
- oracle (11)
- SqlServer (1)
- DB2 (4)
- tool (7)
- linux (5)
- UML (1)
- eclipse (8)
- 执行文件 (1)
- 应用服务器 (4)
- 代码重构 (1)
- 日本語 (19)
- 交规 (1)
- office (9)
- firefox (1)
- net (1)
- 测试 (1)
- temp (6)
- 对日外包 (1)
- windows (1)
- 版本控制 (1)
- android (2)
- 项目管理 (1)
最新评论
function getXMLHttpRequest() { var xmlhttp; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") } catch (E) { xmlhttp=false } } @else xmlhttp=false @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");//new XMLHttpRequest(); } catch (e) { xmlhttp=false } } return xmlhttp; } function ajaxMethod(url,param){ myHttp = getXMLHttpRequest(); myHttp.open('post',url,false); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.send(); if(myHttp.readyState == 4 && myHttp.status==200){ var text = myHttp.responseText; return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格 }else{ return ""; } } function ajaxMethodPost(url,param){ myHttp = getXMLHttpRequest(); myHttp.open('post',url,false); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.send(param); //myHttp.readyState == 4 && myHttp.status==200 if(myHttp.readyState == 4 && myHttp.status==200){ var text = myHttp.responseText; return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格 }else{ return ""; } } /* * ajax 异步 */ var deptN ;//ajax 开关 function dataSel2(deptName,search,fromDate,toDate,enterStatus,curstate,jumpPage){ deptN = deptName; var divObj = document.getElementById(deptName); if(divObj.style.display == 'inline' && (jumpPage==null || jumpPage =="")){//加入了 ajax jumpPage的操作 divObj.style.display = 'none'; }else{ //jumpPage 为ajax页面提过分页功能,并且传给分页的页数 document.forms[0].dept1.value = deptName; document.forms[0].search1.value = search; document.forms[0].fromDate1.value = fromDate; document.forms[0].toDate1.value = toDate; document.forms[0].enterStatus1.value = enterStatus; document.forms[0].curstate1.value = curstate; var url = 'deptZccxAjax.jsp'; var param = ''; if(deptName.split("_").length >1){ deptName = ""; } var sql = this.getSql(deptName,search,fromDate,toDate,enterStatus,curstate); //alert(sql); sql = encodeURIComponent(encodeURIComponent(sql)); param = 'sql=' + sql; //jumpPage 为ajax页面提过分页功能,并且传给分页的页数 if(jumpPage != null && jumpPage !=""){ param += '&jumpPage=' + jumpPage; } myHttp = getXMLHttpRequest(); myHttp.open('post',url,true);//true 同步,false 异步 if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.onreadystatechange = ajaxRet; //异步必须用 回调 onreadystatechange ,后面的方法不能有括号 //同步,不必用回调函数,在send()方法后面直接用 if(myHttp.readyState == 4 && myHttp.status==200){}方法 myHttp.send(param); } } function ajaxRet(){ if(myHttp.readyState == 4 && myHttp.status==200){ var reVal = myHttp.responseText; if(reVal != ""){ var divObj = document.getElementById(deptN);//deptName var divObjs = document.getElementsByTagName('DIV'); for(var i = 0 ; i < divObjs.length ; i++){ var obj = divObjs[i]; if(obj.className == 'ajaxDiv' && obj.id != deptN){//deptName obj.style.display = 'none'; } } divObj.innerHTML=reVal; divObj.style.display = 'inline'; //alert(divObj.top); //debugger; window.document.body.scrollTop = this.FirstTopTr(deptN) - 130; } } } function FirstTopTr(id) { var m=document.all(id); var w=0 while(m.offsetParent) { w+=m.offsetTop; m=m.offsetParent; } return w; } /** * ajax 同步 */ function dataSel(deptName,search,fromDate,toDate){ var divObj = document.getElementById(deptName); if(divObj.style.display == 'inline'){ divObj.style.display = 'none'; }else{ var url = 'deptZccxAjax.jsp'; var param = ''; if(deptName.split("_").length >1){ deptName = ""; } var sql = this.getSql(deptName,search,fromDate,toDate); //alert(sql); sql = encodeURIComponent(encodeURIComponent(sql)); param = 'sql=' + sql; var reVal = ajaxMethodPost(url,param); //if(myHttp.readyState == 4 && myHttp.status==200){ //var reVal = myHttp.responseText; if(reVal != ""){ var divObjs = document.getElementsByTagName('DIV'); for(var i = 0 ; i < divObjs.length ; i++){ var obj = divObjs[i]; if(obj.className == 'ajaxDiv' && obj.id != deptName){ obj.style.display = 'none'; } } divObj.innerHTML=reVal; divObj.style.display = 'inline'; } //} } }
deptZccx.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK" contentType="text/html; charset=GBK"%> <%@page import="com.sysoft.baseform.process.util.ParseProperties"%> <%@page import="com.syoa.struts.form.deptzccx.DeptZccxForm"%> <%@page import="com.sysoft.baselib.PublicMethod"%> <%@page import="com.sysoft.baselib.Common"%> <%@page import="com.sysoft.baseform.process.util.StringUtil"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> <% String contextPath = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/"; DeptZccxForm deptZccxForm = (DeptZccxForm)request.getAttribute("deptZccxForm"); String search = deptZccxForm.getSearch(); String fromDate = deptZccxForm.getFromDate(); String toDate = deptZccxForm.getToDate(); //String selVal = deptZccxForm.getSelVal(); String enterStatus = deptZccxForm.getEnterStatus();//入账状态 String curstate = deptZccxForm.getCurstate();//当前状态(在用、在库、下线) %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html> <head> <html:base target="_self"/> <title>部门资产查询----------------------------------deptZccx.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <script type="text/javascript" src="<%=request.getContextPath() %>/js/newCalendar/popcalendar.js"></script> <%@include file="/stockExchange/include/cssAndJs.inc" %> <script type="text/javascript"> function showDetail(id,objclass , tabUrl){ //debugger; //'http://210.1.5.40/wbsjy/inbox/chkviewinfo.aspx?obj=GDZCZXX&info_id=90009892&isview=1&isreg=1' var dlgProp900 = "dialogWidth:1024px;" + "dialogHeight:1024px;" //+ (window.document.body.clientHeight) + "px;dialogLeft:((screen.width-800)/2)px;dialogTop:" + (window.screenTop) + "px;" + "center:yes;help:no;resizable:no;status:no;"; var url = ""; if(tabUrl != ""){ url = tabUrl; }else{ url = '<%=ParseProperties.getSysinfo("net.url",application.getRealPath("/"))%>/wbsjy/inbox/chkviewinfo.aspx?obj='+objclass+'&info_id='+id+'&isview=1&isreg=1'; } url += '&reload=no'; var openProp = 'scrollbars=0,top=0,left=0,height=' + (screen.availHeight - 30) + ',width=' + (screen.availWidth - 10) + ',resizable=1,scrollbars=1'; var returnVal = window.open(url,'wWindow',openProp);//showModalDialog } function showBaoBiao(){ var dlgProp900 = "dialogWidth:1024px;" + "dialogHeight:1024px;" //+ (window.document.body.clientHeight) + "px;dialogLeft:((screen.width-800)/2)px;dialogTop:" + (window.screenTop) + "px;" + "center:yes;help:no;resizable:no;status:no;"; // var url = '<%=ParseProperties.getSysinfo("net.moss.url",application.getRealPath("/"))%>/_layouts/erpnew/temp/capital.htm'; var url = '<%=ParseProperties.getSysinfo("ERP_MACHINE",application.getRealPath("/"))%>/zjs/capital.htm'; var openProp ="width:1024px;" + "height:1024px;" //+ (window.document.body.clientHeight) + "px;left:((screen.width-800)/2)px;top:" + (window.screenTop) + "px;" + "center:yes;help:no;resizable:no;status:no;"; var openprop1 = "top=0,left=0,width=" + (screen.availWidth - 10) + ",height=" + (screen.availHeight - 30)+ ",resizable=1,scrollbars=1"; var returnVal = window.open(url,'wWindow',openprop1);//showModalDialog } //跳转个人资产页面 function showGr(){ window.location.href = "grczcx.jsp"; } function sub(){ if(this.check_All()){ cDefaultSubmit(); document.forms[0].submit(); } } function check_All(){ var fromDate = document.forms[0].fromDate.value; var toDate = document.forms[0].toDate.value ; if(fromDate != "" && toDate != "" && fromDate > toDate){ alert("起始日期大于结束日期!"); return false; } return true; } </script> </head> <%-- select t1.*, t2.OBJCLASS, t2.NGRQ, t2.BT, t2.WH from ERP_AMS_MINFO t1, G_INFOS t2 where t1.INFO_ID = t2.ID select sum(t1.CAPSVALUE) as CAPSVALUE ,sum(t1.CNETWORTH) as CNETWORTH from ERP_AMS_MINFO t1, G_INFOS t2 where t1.INFO_ID = t2.ID and t1.DEPT = '办公室' select distinct t1.DEPT, (select sum(t3.CAPSVALUE) as CAPSVALUE from ERP_AMS_MINFO t3, G_INFOS t4 where t3.INFO_ID = t4.ID and t3.DEPT = t1.DEPT --and t3.INFO_ID =90037373 ) as ALLCAPSVALUE, (select sum(t5.CNETWORTH) as CNETWORTH from ERP_AMS_MINFO t5, G_INFOS t6 where t5.INFO_ID = t6.ID and t5.DEPT = t1.DEPT -- and t5.INFO_ID =90037373 ) as ALLCNETWORTH from ERP_AMS_MINFO t1, G_INFOS t2 where t1.INFO_ID = t2.ID --and t1.INFO_ID = 90037373 --%> <body style="background-color: white;"> <html:form action="/stockExchange/userSelfHelp/deptZccx" method="post"> <html:hidden property="action"/> <!-- 以下是ajax 分页用 --> <input type='hidden' name='ajaxJumpPage' value='<%=StringUtil.cleanString(request.getParameter("ajaxJumpPage")) %>' /> <input type='hidden' name='dept1' value='<%=StringUtil.cleanString(request.getParameter("dept1")) %>' /> <input type='hidden' name='search1' value='<%=StringUtil.cleanString(request.getParameter("search1")) %>' /> <input type='hidden' name='fromDate1' value='<%=StringUtil.cleanString(request.getParameter("fromDate1")) %>' /> <input type='hidden' name='toDate1' value='<%=StringUtil.cleanString(request.getParameter("toDate1")) %>' /> <input type='hidden' name='enterStatus1' value='<%=StringUtil.cleanString(request.getParameter("enterStatus1")) %>' /> <input type='hidden' name='curstate1' value='<%=StringUtil.cleanString(request.getParameter("curstate1")) %>' /> <%-- <input type='text' name="a" value="<%=request.getParameter("a") %>" /> --%> <div style="width: 100%;height: 1000px;"> <table style="width: 100%;" align="center"><!-- 850px --> <tr> <td align="left"> <div align="left" class="from_title" > 资产名称<!-- 3.23文档 部门资产查询 标题字段为:资产名称 --> </div> </td> </tr> </table> <br/> <table style="width: 100%" align="center" border="0"> <tr> <td nowrap="nowrap" colspan="2"> <B>关键字:</B> <html:text property="search" style='width: 380px;' onfocus="clearDefault(this);" onblur="resetDefault(this);"></html:text> </td> <td nowrap="nowrap"> <html:select property="enterStatus" name="deptZccxForm" > <html:optionsCollection property="enterStatusList" name="deptZccxForm"/> </html:select> </td> <td nowrap="nowrap"> <html:select property="curstate" name="deptZccxForm" > <html:optionsCollection property="curstateList" name="deptZccxForm"/> </html:select> </td> </tr> <tr> <td nowrap="nowrap"> <html:select property="selVal" name="deptZccxForm" > <html:optionsCollection property="selList" name="deptZccxForm"/> </html:select> </td> <td nowrap="nowrap"> 领用日期从 <html:text property="fromDate" style="width:80px;" readonly="true"></html:text> <img name="cwrqImg" src="../../Images/time.gif" style='cursor:hand' border='0' onclick="popUpCalendar(this, document.forms[0].fromDate, 'yyyy-mm-dd');"></img> 到 <html:text property="toDate" style="width:80px;" readonly="true"></html:text> <img name="cwrqImg1" src="../../Images/time.gif" style='cursor:hand' border='0' onclick="popUpCalendar(this, document.forms[0].toDate, 'yyyy-mm-dd');"></img> </td> <td nowrap="nowrap" colspan="2"> <input type="button" value="检索" class="XPButton_1" onclick="sub();"/> <input type="button" value="资产报表" onclick="showBaoBiao();" class="XPButton_1"> <input type="button" value="个人资产" class="XPButton_1" onclick="showGr();"/> </td> </tr> </table> <br/> <TABLE align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#EDEDED" class="table_boxfrom" style="width: 100%"> <logic:iterate id="iter" property="list" name="deptZccxForm"> <% Map<String,String> map = (Map)pageContext.getAttribute("iter"); String dept = map.get("DEPT"); String allCapsvalue=map.get("ALLCAPSVALUE"); String allCnetworth = map.get("ALLCNETWORTH"); String allDatas = map.get("ALLDATAS"); allCapsvalue = (allCapsvalue == null || "".equals(allCapsvalue))? "0" : allCapsvalue; allCnetworth = (allCnetworth == null || "".equals(allCnetworth))? "0" : allCnetworth; String showCapsvalue = " 资产原值合计:" + PublicMethod.doubleFormat(Double.parseDouble(allCapsvalue)) ; String showCnetworth = " 资产净值合计:" + PublicMethod.doubleFormat(Double.parseDouble(allCnetworth)); String showAlldata = " 总共有 " + allDatas + " 条记录"; String outP = dept+" " + showCapsvalue + showCnetworth + showAlldata; if(dept == null || dept.equals("")){ dept = "dept_" + Common.getGuid(); } %> <tr align="right" bgcolor="#FFFFFF"> <td align="left" height="28px;"> <div> <%-- dataSel('<%=dept %>','<%=search %>','<%=fromDate %>','<%=toDate %>'); --%> <a href="javascript:dataSel2('<%=dept %>','<%=search %>','<%=fromDate %>','<%=toDate %>','<%=enterStatus %>','<%=curstate %>');"> <%=outP %> </a> <a href="javascript:excelExport('<%=dept %>','<%=search %>','<%=fromDate %>','<%=toDate %>','<%=enterStatus %>','<%=curstate %>')">生成Excel</a> </div> <div id='<%=dept %>' class='ajaxDiv' style="display: none;"></div> </td> </tr> </logic:iterate> </table> <br><br><br> </div> </html:form> <script type="text/javascript"> //var myHttp; function getXMLHttpRequest() { var xmlhttp; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") } catch (E) { xmlhttp=false } } @else xmlhttp=false @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");//new XMLHttpRequest(); } catch (e) { xmlhttp=false } } return xmlhttp; } function ajaxMethod(url,param){ myHttp = getXMLHttpRequest(); myHttp.open('post',url,false); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.send(); if(myHttp.readyState == 4 && myHttp.status==200){ var text = myHttp.responseText; return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格 }else{ return ""; } } function ajaxMethodPost(url,param){ myHttp = getXMLHttpRequest(); myHttp.open('post',url,false); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.send(param); //myHttp.readyState == 4 && myHttp.status==200 if(myHttp.readyState == 4 && myHttp.status==200){ var text = myHttp.responseText; return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格 }else{ return ""; } } /* function ajaxM(deptName,search,fromDate,toDate){ myHttp = getXMLHttpRequest(); var text = ""; var url = 'deptZccxAjax.jsp'; var param = this.getSql(deptName,search,fromDate,toDate); myHttp.open('post',url,true); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.onreadystatechange = dataSel(deptName,search,fromDate,toDate); myHttp.send(param); } */ function excelExport(deptName,search,fromDate,toDate,enterStatus,curstate,jumpPage){ var sql = this.getSql(deptName,search,fromDate,toDate,enterStatus,curstate); sql = encodeURIComponent(encodeURIComponent(sql)); var url = 'deptZccxExcel.jsp'; //alert(deptName); //alert(encodeURIComponent(encodeURIComponent(deptName))); url += "?dept=" + encodeURIComponent(encodeURIComponent(deptName)); url += "&sql=" + sql; //alert(url); var openProp2 = 'scrollbars=0,top=0,left=0,height=200,width=600,resizable=1,scrollbars=1'; var returnVal = window.open(url,'_blank',openProp2); } /* * ajax 异步 */ var deptN ;//ajax 开关 function dataSel2(deptName,search,fromDate,toDate,enterStatus,curstate,jumpPage){ deptN = deptName; var divObj = document.getElementById(deptName); if(divObj.style.display == 'inline' && (jumpPage==null || jumpPage =="")){//加入了 ajax jumpPage的操作 divObj.style.display = 'none'; }else{ //jumpPage 为ajax页面提过分页功能,并且传给分页的页数 document.forms[0].dept1.value = deptName; document.forms[0].search1.value = search; document.forms[0].fromDate1.value = fromDate; document.forms[0].toDate1.value = toDate; document.forms[0].enterStatus1.value = enterStatus; document.forms[0].curstate1.value = curstate; var url = 'deptZccxAjax.jsp'; var param = ''; if(deptName.split("_").length >1){ deptName = ""; } var sql = this.getSql(deptName,search,fromDate,toDate,enterStatus,curstate); //alert(sql); sql = encodeURIComponent(encodeURIComponent(sql)); param = 'sql=' + sql; //jumpPage 为ajax页面提过分页功能,并且传给分页的页数 if(jumpPage != null && jumpPage !=""){ param += '&jumpPage=' + jumpPage; } myHttp = getXMLHttpRequest(); myHttp.open('post',url,true);//true 同步,false 异步 if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.onreadystatechange = ajaxRet; //异步必须用 回调 onreadystatechange ,后面的方法不能有括号 //同步,不必用回调函数,在send()方法后面直接用 if(myHttp.readyState == 4 && myHttp.status==200){}方法 myHttp.send(param); } } function ajaxRet(){ if(myHttp.readyState == 4 && myHttp.status==200){ var reVal = myHttp.responseText; if(reVal != ""){ var divObj = document.getElementById(deptN);//deptName var divObjs = document.getElementsByTagName('DIV'); for(var i = 0 ; i < divObjs.length ; i++){ var obj = divObjs[i]; if(obj.className == 'ajaxDiv' && obj.id != deptN){//deptName obj.style.display = 'none'; } } divObj.innerHTML=reVal; divObj.style.display = 'inline'; //alert(divObj.top); //debugger; window.document.body.scrollTop = this.FirstTopTr(deptN) - 130; } } } function FirstTopTr(id) { var m=document.all(id); var w=0 while(m.offsetParent) { w+=m.offsetTop; m=m.offsetParent; } return w; } /** * ajax 同步 */ function dataSel(deptName,search,fromDate,toDate){ var divObj = document.getElementById(deptName); if(divObj.style.display == 'inline'){ divObj.style.display = 'none'; }else{ var url = 'deptZccxAjax.jsp'; var param = ''; if(deptName.split("_").length >1){ deptName = ""; } var sql = this.getSql(deptName,search,fromDate,toDate); //alert(sql); sql = encodeURIComponent(encodeURIComponent(sql)); param = 'sql=' + sql; var reVal = ajaxMethodPost(url,param); //if(myHttp.readyState == 4 && myHttp.status==200){ //var reVal = myHttp.responseText; if(reVal != ""){ var divObjs = document.getElementsByTagName('DIV'); for(var i = 0 ; i < divObjs.length ; i++){ var obj = divObjs[i]; if(obj.className == 'ajaxDiv' && obj.id != deptName){ obj.style.display = 'none'; } } divObj.innerHTML=reVal; divObj.style.display = 'inline'; } //} } } function getSql(deptName,search,fromDate,toDate,enterStatus,curstate){ //把t.* 改成具体的t.INFO_ID,t.CTYPE,t.RUSER,t.RUSEDATE,T.DEPT,T.STOREPLACE,T.CAPSVALUE,T.CNETWORTH,T.CURSTATE var sql =" select t.INFO_ID,t.CTYPE,t.RUSER,t.RUSEDATE,T.DEPT,T.STOREPLACE,T.CAPSVALUE,T.CNETWORTH,T.CURSTATE,g.* ,t.status as ENTERSTATUS " + " from ERP_AMS_MINFO t, G_INFOS g " + " where t.INFO_ID = g.ID and g.DELETED > -1 " + " and t.DEPT = '"+deptName+"' "; if(enterStatus != ""){ sql += " and t.status = "+enterStatus+" "; } if(curstate != ""){ sql += " and t.CURSTATE = '"+curstate+"' "; } if(search != ""){ sql += " and (g.WH like '%" + search + "%'" + " or g.BT like '%" + search + "%' " + " or t.RUSER like '%" + search + "%' " + " or t.STOREPLACE like '%"+ search +"%' " + " or t.CTYPE like '%"+ search +"%' " + " or t.DEPT like '%"+ search +"%') "; } if(fromDate != "" && toDate != "" ){ sql += " and t.RUSEDATE between convert(datetime, '" + fromDate + "') " + " and convert(datetime, '" + toDate + " 23:59:59')"; }else if(fromDate != "" && toDate == "" ){ sql += " and t.RUSEDATE >= convert(datetime, '"+fromDate+"') "; }else if(fromDate = "" && toDate != "" ){ sql += " and t.RUSEDATE <= convert(datetime, '"+toDate+"') "; } return sql; } var defaultKeywords = "资产编号、资产名称、领用人、类别、领用部门、存放地点"; var textName = "search"; function clearDefault(el) {//清空 //if (el.defaultValue==el.value) el.value = ""; if(el.value == defaultKeywords ) { el.value = ""; el.style.color = ''; } } function resetDefault(el){// 重设 //if (el.value == '') el.value=el.defaultValue; if(el.value =='') { el.value = defaultKeywords; el.style.color = '#9D9D9D'; } } function cDefaultSubmit(){ var val = document.getElementById(textName).value; if(val == defaultKeywords){ document.getElementById(textName).value=''; } } window.document.body.onload = (function(){ var val = document.getElementById(textName).value; if(val == defaultKeywords){ document.getElementById(textName).style.color = '#9D9D9D'; }else if(val == ''){//加载页面时,值为空是 指定默认值 document.getElementById(textName).value = defaultKeywords; document.getElementById(textName).style.color = '#9D9D9D'; } }); //ajax分页 function Jumping(el){ try{cDefaultSubmit();}catch(e){}//关键字中除去默认值 document.all['ajaxJumpPage'].value = el.value;//document.all['jumpPage'].value; // alert(document.all['ajaxJumpPage'].value); //document.forms[0].submit(); //debugger; this.ajaxJP(); //return; } function gotoPage(pagenum){ document.all['ajaxJumpPage'].value = pagenum; try{cDefaultSubmit();}catch(e){} //document.forms[0].submit(); this.ajaxJP(); //return; } function ajaxJP(){ //用于 ajax 页面分页 var ajaxJumpPage = document.all['ajaxJumpPage'].value; //debugger; if(ajaxJumpPage !=null && ajaxJumpPage != ""){ deptN = ''; var deptName = document.forms[0].dept1.value ; var search = document.forms[0].search1.value; var fromDate = document.forms[0].fromDate1.value; var toDate = document.forms[0].toDate1.value; var enterStatus = document.forms[0].enterStatus1.value; var curstate = document.forms[0].curstate1.value; this.dataSel2(deptName,search,fromDate,toDate,enterStatus,curstate,ajaxJumpPage); //ajaxJumpPage = ''; } } </script> </body> </html:html>
deptZccxAjax.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK" contentType="text/html; charset=GBK"%><%@ page import="java.net.URLDecoder"%><%@ page import="com.sysoft.baseform.process.util.DataSet"%><%@ page import="com.sysoft.baselib.PublicMethod"%><%@ page import="com.sysoft.baselib.Common"%><% //String contextPath = request.getContextPath(); //String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/"; %><% String sql = request.getParameter("sql"); //System.out.println("ajax sql : " + sql); if(sql != null && !"".equals(sql)){ sql = URLDecoder.decode(sql,"UTF-8"); //System.out.println("ajax sql : " + sql); %> <TABLE border="0" cellpadding="0" cellspacing="1" bgcolor="#EDEDED" class="table_boxfrom" style="width: 90%"><!-- 850px --> <tr align="center" valign="bottom" class="tdpage_01"> <TD nowrap="nowrap" align="center">资产编号</TD> <TD nowrap="nowrap" align="center">资产名称</TD> <TD nowrap="nowrap" align="center">类别</TD> <TD nowrap="nowrap" align="center">存放地点</TD> <TD nowrap="nowrap" align="center">领用人</TD> <TD nowrap="nowrap" align="center">领用部门</TD> <TD nowrap="nowrap" align="center">领用日期</TD> <TD nowrap="nowrap" align="center">资产原值</TD> <TD nowrap="nowrap" align="center">资产净值</TD> <TD nowrap="nowrap" align="center">入账状态</TD> <td nowrap="nowrap" align="center">当前状态</td> </TR> <% DataSet ds = new DataSet(); System.out.println("\n deptAjax :\n " + sql + "\n"); //ds.queryNNVL(sql); String jumpPage = request.getParameter("jumpPage"); ds.rowsPerPage = 15; ds.queryByPageNNVL(sql, jumpPage); for(int i = 0; ds != null && i < ds.size(); i++){ String info_id = ds.getFieldString(i, "INFO_ID"); String objClass = ds.getFieldString(i, "OBJCLASS"); String zcbh = ds.getFieldString(i, "WH"); //资产编号 String zcmc = ds.getFieldString(i, "BT"); //资产名称 String zclx = ds.getFieldString(i, "CTYPE"); //资产类型 String djr = ds.getFieldString(i, "RUSER"); //领用人 String djrq = ds.getFieldString(i, "RUSEDATE");//领用日期 String dept = ds.getFieldString(i, "DEPT"); //所在部门 String cfdd = ds.getFieldString(i, "STOREPLACE");//存放地点 String zcyz = ds.getFieldString(i, "CAPSVALUE"); //资产原值 String zcjz = ds.getFieldString(i, "CNETWORTH"); //资产净值 String curstate = ds.getFieldString(i,"CURSTATE");//当前状态 String enterStatus = ds.getFieldString(i,"ENTERSTATUS");//入账状态 if(enterStatus.equals("0")){ enterStatus = "未入帐"; }else if(enterStatus.equals("1")){ enterStatus = "入帐中"; }else if(enterStatus.equals("2")){ enterStatus = "已入帐"; } //全局资产管理 全局资产查看 部门资产查看 //boolean roots = Common.isRole(request,"全局资产管理") ; int ii = 1; if(Common.isRole(request,"全局资产管理")){ ii=0; } String tabUrl = PublicMethod.getNetFormUrl(info_id,objClass,ii+"",application);//"0" %> <tr height="25px" bgcolor="#FFFFFF" > <TD> <div align="center" style="margin-left:10px;" style="cursor: hand" onclick="showDetail('<%=info_id %>', '<%=objClass %>' , '<%=tabUrl %>');"> <%=zcbh %> </div> </TD> <TD><div align="center" style="margin-left:10px;"><%=zcmc %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zclx %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=cfdd %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=djr %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=dept %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=djrq %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zcyz %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zcjz %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=enterStatus %> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=curstate %> </div></TD> </TR> <% } %> </TABLE> <table align="center" border="0" cellpadding="0" cellspacing="1" style="width: 850px"> <tr><td colspan="7" align="right"> <%if(ds != null && ds.maxPage!=1 && ds.size()!=0){ %> 每页 <span class='font_e'><%=ds.rowsPerPage%></span> 行 共 <span class='font_e'><%=ds.maxRowCount%></span> 行 当前是 <span class='font_e'><%=ds.curPage%>/ <%=ds.maxPage%></span> 页 <%if(ds.curPage==1){ out.print(" [首页][上一页]"); }else{ %> [<A HREF="javascript:gotoPage(1)"><span class="font_d" >首页</span></A>] [<A HREF="javascript:gotoPage(<%=ds.curPage-1%>)"><span class="font_d" >上一页</span></A>] <%}%> <%if(ds.curPage==ds.maxPage){ out.print("[下一页] [尾页]"); }else{ %> [<A HREF="javascript:gotoPage(<%=ds.curPage+1%>)"><span class="font_d" >下一页</span></A>] [<A HREF="javascript:gotoPage(<%=ds.maxPage%>)"><span class="font_d" >尾页</span></A>] <%}%> 转到第<SELECT name="jumpPage" onchange="Jumping(this)"> <% for(int i=1;i<=ds.maxPage;i++) { if (i== ds.curPage){ %> <OPTION selected="selected" value='<%=i%>'><%=i%></OPTION> <%}else{%> <OPTION value='<%=i%>'><%=i%></OPTION> <%}}%> </SELECT>页 <%}%> </td></tr> </table> <br/> <!-- <script type="text/javascript"> function Jumping(){ try{cDefaultSubmit();}catch(e){}//关键字中除去默认值 document.forms[0].submit(); return; } function gotoPage(pagenum){ document.all['jumpPage'].value = pagenum; try{cDefaultSubmit();}catch(e){} document.forms[0].submit(); return; } </script> --> <% } %>
deptZccxExcel.jsp
<%@ page contentType="application/msexcel; charset=GBK" %><%@ page import="java.net.URLDecoder"%><%@ page import="com.sysoft.baseform.process.util.DataSet"%><%@ page import="com.sysoft.baselib.PublicMethod"%><%@ page import="com.sysoft.baselib.Common"%> <%@page import="com.sysoft.baseform.process.util.StringUtil"%> <%@page import="org.apache.log4j.Logger"%><% //String contextPath = request.getContextPath(); //String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/"; %><% //Logger log = Logger.getLogger("部门资产EXCEL"); String deptName = StringUtil.cleanString(request .getParameter("dept")); System.out.println("\n deptAjax :\n " + deptName + "\n"); //log.debug(deptName); if (!deptName.equals("")) { deptName = URLDecoder.decode(deptName, "UTF-8"); //log.debug(deptName); } else { deptName = "部门资产"; } String filename = new String((deptName).getBytes("GBK"),"ISO-8859-1"); response.addHeader("Content-disposition", "inline; filename=" + filename + ".xls"); String sql = request.getParameter("sql"); //System.out.println("ajax sql : " + sql); if (sql != null && !"".equals(sql)) { sql = URLDecoder.decode(sql, "UTF-8"); //System.out.println("ajax sql : " + sql); %> <TABLE border="1" cellpadding="0" cellspacing="1" bgcolor="#EDEDED" class="table_boxfrom" style="width: 850px"> <tr align="center" valign="bottom" class="tdpage_01"> <TD align="center">资产编号</TD> <TD align="center">资产名称</TD> <TD align="center">类别</TD> <TD align="center">存放地点</TD> <TD align="center">领用人</TD> <TD align="center">领用部门</TD> <TD align="center">领用日期</TD> <TD align="center">资产原值</TD> <TD align="center">资产净值</TD> <TD align="center">入账状态</TD> <td align="center">当前状态</td> </TR> <% DataSet ds = new DataSet(); //System.out.println("\n deptAjax :\n " + sql + "\n"); //ds.queryNNVL(sql); //String jumpPage = request.getParameter("jumpPage"); //ds.rowsPerPage = 15; ds.queryNNVL(sql); for (int i = 0; ds != null && i < ds.size(); i++) { String info_id = ds.getFieldString(i, "INFO_ID"); String objClass = ds.getFieldString(i, "OBJCLASS"); String zcbh = ds.getFieldString(i, "WH"); //资产编号 String zcmc = ds.getFieldString(i, "BT"); //资产名称 String zclx = ds.getFieldString(i, "CTYPE"); //资产类型 String djr = ds.getFieldString(i, "RUSER"); //领用人 String djrq = ds.getFieldString(i, "RUSEDATE");//领用日期 String dept = ds.getFieldString(i, "DEPT"); //所在部门 String cfdd = ds.getFieldString(i, "STOREPLACE");//存放地点 String zcyz = ds.getFieldString(i, "CAPSVALUE"); //资产原值 String zcjz = ds.getFieldString(i, "CNETWORTH"); //资产净值 String curstate = ds.getFieldString(i, "CURSTATE");//当前状态 String enterStatus = ds.getFieldString(i, "ENTERSTATUS");//入账状态 if (enterStatus.equals("0")) { enterStatus = "未入帐"; } else if (enterStatus.equals("1")) { enterStatus = "入帐中"; } else if (enterStatus.equals("2")) { enterStatus = "已入帐"; } //全局资产管理 全局资产查看 部门资产查看 //boolean roots = Common.isRole(request,"全局资产管理") ; int ii = 1; if (Common.isRole(request, "全局资产管理")) { ii = 0; } String tabUrl = PublicMethod.getNetFormUrl(info_id, objClass, ii + "", application);//"0" %> <tr style="cursor: hand" height="25px" bgcolor="#FFFFFF" onclick="showDetail('<%=info_id%>', '<%=objClass%>' , '<%=tabUrl%>');"> <TD><div align="center" style="margin-left:10px;"><%=zcbh%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zcmc%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zclx%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=cfdd%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=djr%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=dept%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=djrq%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zcyz%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=zcjz%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=enterStatus%> </div></TD> <TD><div align="center" style="margin-left:10px;"><%=curstate%> </div></TD> </TR> <% } %> </TABLE> <% } %>
发表评论
文章已被作者锁定,不允许评论。
相关推荐
在这个"Ajax入门例子项目"中,我们将深入探讨Ajax的基础概念、工作原理以及如何创建简单的Ajax应用。 1. Ajax基础概念: - 异步:Ajax的主要特性是异步通信,意味着用户在请求发送后可以继续浏览网页,而无需等待...
**Ajax(Asynchronous JavaScript and XML)技术是一种在无需...这个压缩包文件中的"ajaxjs"可能包含了实现上述功能的JavaScript代码,通过学习和理解这段代码,你可以深入理解Ajax的工作原理及其在实际项目中的应用。
JSON易于阅读和编写,同时也易于机器解析和生成,与JavaScript对象结构相似,因此在Ajax中处理JSON数据非常方便。 5. **跨域问题**:默认情况下,Ajax请求遵循同源策略,只能向同一域名下发送。但可以通过CORS...
Ajax(Asynchronous JavaScript and XML)则是一种在无需刷新整个页面的情况下,能够更新部分网页的技术。在jQuery中,Ajax功能被封装得十分友好,使得开发者可以轻松地实现异步数据交换。 **一、jQuery中的Ajax...
总之,这个Ajax JSP例子是学习Web开发中异步交互的一个实例,通过实际操作,你可以更好地掌握Ajax技术和JSP的结合应用,从而提升网页的动态性和用户体验。在实际工作中,Ajax已经被广泛应用于各种Web应用,如实时...
1. **Ajax介绍**:Ajax(Asynchronous JavaScript and XML)是一种在不刷新整个页面的情况下与服务器交换数据并更新部分网页的技术。它通过创建XMLHttpRequest对象来实现异步通信。 2. **Ajax请求数据**:使用...
msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子msajax简单例子
在Ajax的核心中,主要涉及到以下几个关键组成部分: 1. **XMLHttpRequest对象**:这是Ajax的基础,它允许JavaScript在后台与服务器进行通信。创建XMLHttpRequest对象后,可以使用它来发送HTTP请求并接收响应。 2. ...
在Ajax的例子中,通常会涉及到以下几个关键步骤: 1. **创建XMLHttpRequest对象**:在JavaScript代码中,首先需要创建一个XMLHttpRequest对象,这是Ajax的基础。虽然名称中含有XML,但实际上它不仅可以处理XML,还...
这个小例子展示了Ajax的基本用法,实际开发中,我们可能还需要处理错误、添加请求头、发送POST数据等复杂情况。例如,使用POST方法发送数据时,我们需要在`xhr.send()`之前调用`xhr.setRequestHeader()`设置Content-...
在这里,我们将深入探讨基于jQuery的Ajax应用,以"jQuery+Ajax例子"为标题,结合项目描述和标签,我们来详细讲解这些技术。 1. **jQuery简介** jQuery由John Resig在2006年创建,旨在使JavaScript编程变得更加简单...
Ajax(Asynchronous JavaScript and XML)是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术。...在实际项目中,Ajax常用于实现无限滚动、实时聊天、表单验证等功能,是现代Web开发不可或缺的一部分。
然而,在这个例子中,我们将重点放在jQuery的AJAX函数上,因为它是跨平台的,并且更加灵活。 jQuery的AJAX函数`$.ajax()`是核心。它允许我们创建一个异步HTTP(GET或POST)请求,从而在不刷新整个页面的情况下获取...
在Ajax中,JavaScript起到关键作用。首先,我们需要创建一个XMLHttpRequest对象,它是所有Ajax操作的基础。接着,我们通过JavaScript来控制XMLHttpRequest对象的打开、发送请求以及接收响应。 **XMLHttpRequest对象...
在这个例子中,AJAX用于在后台与服务器通信,上传文件数据,而不会打断用户的操作或导致页面刷新,从而提高了用户体验。 HTML5的引入带来了许多新的API和元素,其中与文件上传相关的有File API和Drag and Drop API...
在IT行业中,jQuery是一个广泛使用的JavaScript库,它极大地简化了DOM操作、事件处理以及Ajax交互。本主题将深入探讨如何利用jQuery实现AJAX技术,通过给出的实际例子来增强理解。 AJAX(Asynchronous JavaScript ...
在IT领域,Ajax(Asynchronous JavaScript and XML)是一种在无需刷新整个网页的情况下,能够更新部分网页的技术。这个“简单ajax登录例子”是一个非常适合初学者理解Ajax基本原理和使用方法的教程。在这里,我们将...
AJAX(Asynchronous JavaScript and XML)是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术。这个"很简单的一个AJAX例子"的标题和描述表明,我们将会探讨一个基础的AJAX应用实例,它可能包含了一个...
在实际项目中,开发者可能会使用像jQuery、axios或fetch API等库来简化AJAX操作,因为它们提供了更友好的API和更好的错误处理。 在压缩包中的“Ajax练习”文件,可能包含了一些练习题或示例代码,供学习者动手实践...