jsp获取数据 jsp直接获取后端数据 获取input选中的值 单选 没 checked属性

本文主要是介绍jsp获取数据 jsp直接获取后端数据 获取input选中的值 单选 没 checked属性,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

let str0='${showList}';
let str1=${showList};

然后可以通过JSON.parse() 转

获取input选中的值

				//goodsType 按类别    goods按货品var oneType= $("input[ name='criteria1' ] ").val();//count按数量  totalprice按费用var twoType = $("input[ name='criteria2' ] ").val();

获取的是 下面红框中的值 

<script language="javascript">function querytr(){var startDate = document.getElementById("startDate");var endDate = document.getElementById("endDate");if(startDate.value != "" && endDate.value!= "" && (startDate.value > endDate.value)){parent.win.generalAlert("起始日期不能大于终止日期");return false;}document.all.query.click();}function exptr(){var startDate = document.getElementById("startDate");var endDate = document.getElementById("endDate");if(startDate.value != "" && endDate.value!= "" && (startDate.value > endDate.value)){parent.win.generalAlert("起始日期不能大于终止日期");return false;}document.all.exp.click();}// function fc(startDate,endDate){// Ext.Ajax.request({// 	method : 'POST',// 	url: 'servlet/wareStockOutCountAnalyseChartServlet',// 	params:{startDate:startDate,endDate:endDate},//     success: function(request){// 				if(request.responseText != ""){// 					var data = request.responseText;// 					chart(data);// 				}// 			}// });// }// function chart(data){// if(document.forms[0].criteria1.value== "" || document.forms[0].criteria1.value== "goods"){// 	var chart = new FusionCharts('js/fc/Bar2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");// }else if(document.forms[0].criteria2.value== ""){// 	var chart = new FusionCharts('js/fc/Bar2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");// }else if(document.forms[0].criteria2.value== "count"){// 	var chart = new FusionCharts('js/fc/Bar2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");// }else{// 	var chart = new FusionCharts('js/fc/Pie2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");// }//// chart.addParam("wmode","Opaque");// chart.setDataXML(data);// chart.render('Chart');// }function fcPicture(){let title = "";let dataY = [];let dataX = [];let str0='${showList}';let showList = str0.replace(/[\\]/g,'/');// console.log(showList ,"出库情况统计");//goodsType 按类别    goods按货品var oneType= $("input[ name='criteria1' ] ").val();//count按数量  totalprice按费用var twoType = $("input[ name='criteria2' ] ").val();if(oneType === "goodsType"){//按类别 + 按数量;title = "货品分类出库数量统计(前十)";let arr = JSON.parse(showList)if(twoType === "count"){arr.forEach((item,index)=>{dataY.push(item[2]);dataX.push(item[3])})}else{//按类别 + 按费用  ---- 饼图bingPicture();return}}else{// 按货品 + 按数量;title = "货品出库数量统计(前十)";let arr = JSON.parse(showList)if(twoType === "count"){arr.forEach((item,index)=>{dataY.push(item[2]);dataX.push(item[7])})}else{//按货品 + 按费用title = "货品出库费用统计(前十)";arr.forEach((item,index)=>{dataY.push(item[2]);dataX.push(item[9])})}}// console.log(oneType,twoType,"111111111111111111")let chartDom = document.getElementById('Chart');let myChart = echarts.init(chartDom);let option = {backgroundColor: 'white',title: {text: title,left: 'center',top: "20",// padding: [10, 0, 0, 50],textStyle: {color: "#000",fontFamily: "Alibaba PuHuiTi",fontSize: 14,fontWeight: 600,// padding: [0, 0, 0, 35]},},tooltip: { show: false },grid: { left: 10, top: 50, bottom: 20, right: 80, containLabel: true },xAxis: {type: 'value',boundaryGap: false,// max: 20, // Math.ceil(max / 4) * 5 || 10axisLine: { show: true, lineStyle: { color: '#ccc' } },axisTick: { show: false },axisLabel: { color: '#999' },splitLine: { lineStyle: { color: ['#CEEDFF'], type: [5, 8], dashOffset: 3 } },min:0,max:dataX.length === 0 ? 1000 :null},yAxis: {type: 'category',data: dataY,axisLine: { show: true, lineStyle: { color: '#ccc' } },axisTick: { length: 3 },axisLabel: { fontSize: 14, color: '#666', margin: 16, padding: 0 },inverse: true,},series: [{name: '数量',type: 'bar',itemStyle: {color: '#52A8FF',color: function (params) {// 定义一个颜色集合let colorList = ['#52A8FF','#00B389','#FFA940','#FF5A57','#29EFC4','#F8AEA4','#FFC53D','#009982','#C099FC','#F5855F','#52A8FF','#00B389','#FFA940','#FF5A57','#29EFC4','#F8AEA4','#FFC53D','#009982','#C099FC','#F5855F',];// 对每个bar显示一种颜色return colorList[params.dataIndex];},},barMaxWidth: 20,label: { show: true, position: 'right', offset: [0, 2], fontSize: 16 },data: dataX,},],};option && myChart.setOption(option);}function bingPicture(){let str0='${showList}';let showList = str0.replace(/[\\]/g,'/');;// console.log(showList ,"按类别 + 按费用");let arr0 = JSON.parse(showList);let arr=[];let total =0;arr0.forEach((item,index)=>{let obj={};// console.log(item,"888888888888")obj.name= item[2];obj.value = item[4];arr.push(obj);total+=item[4]})// console.log(arr,"777777777777777777777")let  title="货品分类出库费用统计(合计:" + total.toFixed(2) + "元)";// let  title="货品分类出库费用统计";// let color = ['#ffc140', '#d151d8', 'red'];let option = {backgroundColor: 'white',// color: color,grid: {left: '5%',right: '5%',top: '20%',containLabel: true,},title: {text: title,show: true, // 是否显示标题,默认 true。padding: [10, 0, 15, 0],textStyle: {color: "#23527c",fontSize: 14,fontFamily: "Alibaba PuHuiTi",fontWeight: 600,},left: 'center',},tooltip: {show: true,trigger: 'item',//{a}(系列名),{b}(数据项名),{c}(数值),{d}(百分比)formatter: "{b} : {c} ({d}%)",backgroundColor: "rgba(1, 13, 19, 0.5)",borderWidth: 0,textStyle: {color: "rgba(212, 232, 254, 1)",// fontSize: fontChart(0.24),},// extraCssText: "z-index:2"},series: [{//   name: 'Access From',type: 'pie',radius: '50%',center: ['50%', '60%'],data: arr,label: {padding: [15,0,0,0],color: "#4E5969",fontSize: 14,formatter: "{b|{b}}: {d|{c}} 元\n",rich: {b: {fontSize: 14,color: "#4E5969"},d: {fontSize: 14,fontWeight: 500,// fontFamily: "DINAlternate-Bold, DINAlternate",color: "#4E5969"}}},emphasis: {itemStyle: {shadowBlur: 10,shadowOffsetX: 0,shadowColor: 'rgba(0, 0, 0, 0.5)'},}}]};let chartDom = document.getElementById('Chart');let myChart = echarts.init(chartDom);option && myChart.setOption(option);}function setCriteria(criteria,radioObj){if("goodsType" == criteria || "goods" == criteria){document.forms[0].criteria1.value = criteria;}else{document.forms[0].criteria2.value = criteria;}var arr = document.getElementsByName(radioObj.name);for(var i = 0;i<arr.length;i++){arr[i].value = "0";}radioObj.value = "1";}function initRadio(){if(document.forms[0].criteria1.value == 'goodsType'){document.getElementById('radio1').checked = "checked";}if(document.forms[0].criteria1.value == 'goods'){document.getElementById('radio2').checked = "checked";}if(document.forms[0].criteria2.value == 'count'){document.getElementById('radio3').checked = "checked";}if(document.forms[0].criteria2.value == 'totalprice'){document.getElementById('radio4').checked = "checked";}// fc()fcPicture()}</script><style>#Chart{width: 100%;height: 500px;}</style></head><bodyonload="initRadio();"><div class="container-fluid"><span class="container-title"><span id="title">您现在所在的位置:查询统计 &gt出库情况分析</span> </span><div class="continer-box"><div class="innerpage"><html:form action="wareStockOutCountAnalyse.do"enctype="multipart/form-data"><html:submit property="query" value="query" style="display:none" /><html:submit property="exp" value="exp" style="display:none" /><html:hidden property="criteria1" /><html:hidden property="criteria2" /><html:hidden property="pageType" /><div class="search-box"><span class="search-title">查询条件<a href="javascript:void(0);" class="close-up"></a></span><div class="seach-text clearfix"><div class="box clearfix"><span>条件:</span><div class="form-r"><input type="radio" id="radio1" name="groupName1" value="0"onclick="setCriteria('goodsType',this)" />按类别<input type="radio" id="radio2" name="groupName1" value="1"onclick="setCriteria('goods',this)" />按货品</div></div><div class="box clearfix"><span>条件:</span><div class="form-r"><input type="radio" id="radio3" name="groupName2" value="1"onclick="setCriteria('count',this)" />按数量<input type="radio" id="radio4" name="groupName2" value="0"onclick="setCriteria('totalprice',this)" />按费用</div></div><div class="box box-time clearfix"><span>出库日期:</span><div class="form-r"><div class="time-q"><div class="form-group"><div class="input-group date form_date" data-date=""data-date-format="" data-link-field="dtp_input2"data-link-format="yyyy-mm-dd"><html:text property="startDate" styleId="startDate" styleClass="form-control"readonly="true"  /><span class="input-group-addon"> <spanclass="glyphicon glyphicon-calendar"> <imgsrc="img_new/3-12_03.png"> </span> </span></div></div></div><span>~</span><div class="time-h"><div class="form-group"><div class="input-group date form_date" data-date=""data-date-format="" data-link-field="dtp_input2"data-link-format="yyyy-mm-dd"><html:text property="endDate" styleId="endDate" styleClass="form-control"readonly="true" /><span class="input-group-addon"> <spanclass="glyphicon glyphicon-calendar"> <imgsrc="img_new/3-12_03.png"> </span> </span></div></div></div></div></div><div class="box clearfix"><span>部门:</span><div class="form-r"><html:select property="depId" styleClass="selectpicker"><logic:notEmpty name="depms"><html:options collection="depms" property="id"labelProperty="name" /></logic:notEmpty></html:select></div></div><div class="btn-right"><a  class="btn btn-seach" href="#n" onClick="querytr();">查询</a></div></div></div><div id='Chart' align="center"></div><div class="result-table"><span class="table-title"><i>出库情况分析</i><div class="btn-right"><a class="btn btn-grey" href="#n" onClick="exptr();">导出</a></div></span><div class="table-box"><table width="100%" class="dg" border="0"><col class="dgl"></col><c:choose><c:when test="${fn:length(wareStockInList[0]) == 10}"><tr class="dgh"><th>货品编码</th><th>货品名称</th><th>规格型号</th><th>颜色</th><th>容量</th><th>品牌</th><th>出库总数量</th><th>单位</th><th>出库总价(元)</th></tr><logic:notEmpty name="wareStockInList"><logic:iterate id="wareStockIn" name="wareStockInList"indexId="rowID"><tr><td class="companyname">${wareStockIn[1]}</td><td class="companyname">${wareStockIn[2]}</td><td class="companyname">${wareStockIn[3]}</td><td class="companyname">${wareStockIn[4]}</td><td class="companyname">${wareStockIn[5]}</td><td class="companyname">${wareStockIn[6]}</td><td class=jine>${wareStockIn[7]}</td><td class="companyname">${wareStockIn[8]}</td><td class="jine"><fmt:formatNumber pattern="#,##0.00">${wareStockIn[9]}</fmt:formatNumber></td></tr></logic:iterate></logic:notEmpty></c:when><c:otherwise><tr class="dgh"><th>分类编号</th><th>分类名称</th><th>出库总数量</th><th>出库总价(元)</th></tr><logic:notEmpty name="wareStockInList"><logic:iterate id="wareStockIn" name="wareStockInList"indexId="rowID"><tr><td class="companyname">${wareStockIn[1]}</td><td class="companyname">${wareStockIn[2]}</td><td class="jine"">${wareStockIn[3]}</td><td class="jine"><fmt:formatNumber pattern="#,##0.00">${wareStockIn[4]}</fmt:formatNumber></td></tr></logic:iterate></logic:notEmpty></c:otherwise></c:choose><logic:empty name="wareStockInList"><tr><td style="padding: 0 5 0 5;" colspan="11" align="center">无记录!</td></tr></logic:empty></table></div></div><logic:notEmpty name="wareStockInList"><c:if test="${results_size!=0 && !(wareStockOutCountAnalyseForm.criteria1 eq 'goodsType')}"><c:set var="form">wareStockOutCountAnalyseForm</c:set><%@ include file="/common/page.jsp"%></c:if></logic:notEmpty></html:form></div></div></div><script type="text/javascript">$('.form_date').datetimepicker({language: 'zh-CN',weekStart: 1,todayBtn: 1,autoclose: 1,todayHighlight: 1,startView: 2,minView: 2,forceParse: 0});</script></body>
</html>

这篇关于jsp获取数据 jsp直接获取后端数据 获取input选中的值 单选 没 checked属性的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/292568

相关文章

Python版本信息获取方法详解与实战

《Python版本信息获取方法详解与实战》在Python开发中,获取Python版本号是调试、兼容性检查和版本控制的重要基础操作,本文详细介绍了如何使用sys和platform模块获取Python的主... 目录1. python版本号获取基础2. 使用sys模块获取版本信息2.1 sys模块概述2.1.1

Linux下利用select实现串口数据读取过程

《Linux下利用select实现串口数据读取过程》文章介绍Linux中使用select、poll或epoll实现串口数据读取,通过I/O多路复用机制在数据到达时触发读取,避免持续轮询,示例代码展示设... 目录示例代码(使用select实现)代码解释总结在 linux 系统里,我们可以借助 select、

mybatis直接执行完整sql及踩坑解决

《mybatis直接执行完整sql及踩坑解决》MyBatis可通过select标签执行动态SQL,DQL用ListLinkedHashMap接收结果,DML用int处理,注意防御SQL注入,优先使用#... 目录myBATiFBNZQs直接执行完整sql及踩坑select语句采用count、insert、u

Java发送SNMP至交换机获取交换机状态实现方式

《Java发送SNMP至交换机获取交换机状态实现方式》文章介绍使用SNMP4J库(2.7.0)通过RCF1213-MIB协议获取交换机单/多路状态,需开启SNMP支持,重点对比SNMPv1、v2c、v... 目录交换机协议SNMP库获取交换机单路状态获取交换机多路状态总结交换机协议这里使用的交换机协议为常

vue监听属性watch的用法及使用场景详解

《vue监听属性watch的用法及使用场景详解》watch是vue中常用的监听器,它主要用于侦听数据的变化,在数据发生变化的时候执行一些操作,:本文主要介绍vue监听属性watch的用法及使用场景... 目录1. 监听属性 watch2. 常规用法3. 监听对象和route变化4. 使用场景附Watch 的

MyBatis/MyBatis-Plus同事务循环调用存储过程获取主键重复问题分析及解决

《MyBatis/MyBatis-Plus同事务循环调用存储过程获取主键重复问题分析及解决》MyBatis默认开启一级缓存,同一事务中循环调用查询方法时会重复使用缓存数据,导致获取的序列主键值均为1,... 目录问题原因解决办法如果是存储过程总结问题myBATis有如下代码获取序列作为主键IdMappe

C#使用iText获取PDF的trailer数据的代码示例

《C#使用iText获取PDF的trailer数据的代码示例》开发程序debug的时候,看到了PDF有个trailer数据,挺有意思,于是考虑用代码把它读出来,那么就用到我们常用的iText框架了,所... 目录引言iText 核心概念C# 代码示例步骤 1: 确保已安装 iText步骤 2: C# 代码程

Pandas处理缺失数据的方式汇总

《Pandas处理缺失数据的方式汇总》许多教程中的数据与现实世界中的数据有很大不同,现实世界中的数据很少是干净且同质的,本文我们将讨论处理缺失数据的一些常规注意事项,了解Pandas如何表示缺失数据,... 目录缺失数据约定的权衡Pandas 中的缺失数据None 作为哨兵值NaN:缺失的数值数据Panda

C++中处理文本数据char与string的终极对比指南

《C++中处理文本数据char与string的终极对比指南》在C++编程中char和string是两种用于处理字符数据的类型,但它们在使用方式和功能上有显著的不同,:本文主要介绍C++中处理文本数... 目录1. 基本定义与本质2. 内存管理3. 操作与功能4. 性能特点5. 使用场景6. 相互转换核心区别

Spring Boot中获取IOC容器的多种方式

《SpringBoot中获取IOC容器的多种方式》本文主要介绍了SpringBoot中获取IOC容器的多种方式,包括直接注入、实现ApplicationContextAware接口、通过Spring... 目录1. 直接注入ApplicationContext2. 实现ApplicationContextA