jsp c:foreach 获取 list size

情况是这样的

后台有一个list 里面的对象个数 小于 等于 10

前台 获取 这个 list 的size,然后 在那个数的基础上 循环 到 10 ,循环体输出 

 

/c:forEach

报错:
The function size must be used with a prefix when a default namespace is not specified

说是不能解析那个方法,只能解析属性(网上说的)

求解决,那个 begin 里该怎么写

ASDGXCV
刘恒 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> 然后: ${fn:length(list)}
接近 6 年之前 回复

2个回答

1:你的写法不对,应该是begin = "${c_list.size()}"
2:${}这个叫做el表达式,这里面是不能执行java.util.List 的size()方法的

所以你后台request.setAttribute("c_list_size",c_list.size());
然后jsp使用begin = "${c_list_size}"

ASDGXCV
刘恒 谢谢, <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> ${fn:length(list)} 是我想要的
接近 6 年之前 回复
lorewolf311
tianchao_ 或者: 首先: <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> 然后: ${fn:length(list)}
接近 6 年之前 回复

${fn:length(item)}
fn:length(item)
返回参数item中包含元素的数量。参数Item类型是数组、collection或者String。如果是String类型,返回值是String中的字符数。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
jsp值传递报空问题,值传递不出去
``` <c:if test="${list.size()!=0}"> <c:forEach var="a" items="${list}"> <tr> <td style="width:20px">${a.url}</td> <td style="width:30px"> <input type="text" name="giftMessage" id="${a}.giftMessage" class="input-medium" value="${a.giftMessage}" /> </td> <td style="width:20px"> <a href="##.do?giftMessage=${a.giftMessage}"></a> </td> </tr> </c:forEach> </c:if> ``` 怎么样获取每行giftMessage的值,每次href时获取到的giftMessage都为空
怎么将一个jsp页面中没在表单里的一个参数传递到controller的方法上?
前台有个动态的导航栏,当点击导航栏的某个导航链接时,要用${pageContext.request.contextPath }/admin/select.action这个action去调用controller里的方法去执行查询操作,但查询操作需要前台 value=“${dep.user_department}”里的值作为参数,要怎么传过来? ``` <div class="dropdown" style=" height:30px;float: left; background-color:#2785eb;margin-left: 85px;border-radius:6px; "> <a class="dropdown-toggle" data-toggle="dropdown" href="#" style="text-decoration: none; color: white; font-size: 22px;"> 展开导航 <span class="caret"></span> </a> <ul class="dropdown-menu"> <c:forEach items="${dep_list}" var="dep"> <li><a href="${pageContext.request.contextPath }/admin/select.action"> <c:out value="${dep.user_department}"/><p> </a></li> </c:forEach> </ul> </div> ```
利用SERVLET跳转到JSP页面时显示乱码
单独打开SERVLET或者JSP,网页显示全部正常,在SERVLET里输出数据也显示正常,可是一转到JSP就全部乱码了。不仅是数据,只要是JSP里的中文就都成了? ``` package SERVLET; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import JDBC.S; import JDBC.SDao; @WebServlet("/ShowSServlet") public class ShowSServlet extends HttpServlet { private static final long serialVersionUID = 1L; public ShowSServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ").append(request.getContextPath()); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); String currentpage=request.getParameter("currentpage"); if(null==currentpage || "".equals(currentpage)){ currentpage="1"; } List<S> list=SDao.selectPage(Integer.parseInt(currentpage)); int totalcount=SDao.selectS().size(); int row=5; int totalpage=(totalcount%row==0)?(totalcount/row):(totalcount/row+1); for(S l:list){ System.out.println(l.getSname()); } request.setAttribute("currentpage", currentpage); request.setAttribute("totalcount", totalcount); request.setAttribute("row", row); request.setAttribute("totalpage", totalpage); request.setAttribute("list", list); request.getRequestDispatcher("ShowS.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } ``` ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> <html> <head> <!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> --> <title>信息一览</title> <style> table { border:thin solid black; border-collapse:collapse; width:60%; text-align:center; } th { border:thin solid black; } td { border:thin solid black; } </style> <script type="text/javascript"> function gotos(page){ location.href="ShowSServlet?currentpage="+page; } function gotod(sno){ location.href="DeleteSServlet?sno="+sno; } </script> </head> <body> <table align="center" > <tr> <th>学号</th> <th>姓名</th> <th>年龄</th> <th>院系</th> <th>操作</th> </tr> <c:forEach var="l" items="${list }"> <tr> <td>${l.sno }</td> <td>${l.sname }</td> <td>${l.age }</td> <td>${l.depart }</td> <td><a href="javascript:gotod(${l.sno })">删除</a></td> </tr> </c:forEach> </table> <center> <c:choose> <c:when test="${currentpage==1 }">首页&nbsp&nbsp上一页</c:when> <c:otherwise> <a href="javascript:gotos(1)">首页</a> <a href="javascript:gotos(${currentpage-1 })">上一页</a> </c:otherwise> </c:choose> <c:choose> <c:when test="${currentpage==totalpage }">下一页&nbsp&nbsp末页</c:when> <c:otherwise> <a href="javascript:gotos(${currentpage+1 })">下一页</a> <a href="javascript:gotos(${totalpage })">末页</a> </c:otherwise> </c:choose></br> 共有${totalcount }条记录,每页显示${row }条记录,当前为第${currentpage }页 </center> </body> </html> ``` ![图片说明](https://img-ask.csdn.net/upload/201612/30/1483063322_263678.png) ![图片说明](https://img-ask.csdn.net/upload/201612/30/1483063332_740186.png) ![图片说明](https://img-ask.csdn.net/upload/201612/30/1483063340_428375.png)
ssm中Controller跳转到jsp中,不能显示参数值问题
这是spring的配置: ``` <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀(如果最后一个还是表示文件夹,则最后的斜杠不要漏了) 使用JSP--> <!-- 默认的视图解析器 在上边的解析错误时使用 (默认使用html)- --> <bean id="defaultViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!--设置JSP文件的目录位置--> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> ``` 以下是我的jsp代码: ``` <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head> <title>ssm ${test}</title> </head> <body> <table width="100%" border=1> <tr> <td>商品名称</td> <td>商品价格</td> <td>商品描述</td> </tr> <c:forEach var="item" items="${itemList}"> <tr> <td>${item.name}</td> <td>${item.price}</td> <td>${item.detail}</td> </tr> </c:forEach> </table> </body> </html> ``` controller代码: ``` @RequestMapping("/findAllItem") public ModelAndView showItem(HttpSession session){ List<Item> itemList=itemService.findAllItem(); for(int i=0;i<itemList.size();i++){ Item item=itemList.get(i); System.out.println("Item:[ id= "+item.getId()+" | name= "+item.getName()+" | price= "+item.getPrice()+" | detail= "+item.getDetail()+" ]"); } session.setAttribute("aa","success"); //创建ModelAndView的对象 ModelAndView mv=new ModelAndView(); mv.setViewName("index"); mv.addObject("test","测试"); mv.addObject("itemList",itemList); return mv; } ``` 项目运行后可以正常跳转到对应的jsp,但是页面没有值,如图 ![图片说明](https://img-ask.csdn.net/upload/201710/12/1507821054_327718.png) 请问,这是什么原因????
在一个jsp页面中,点击一个按钮,弹出另一个jsp页面
add.jsp:![图片说明](https://img-ask.csdn.net/upload/201507/23/1437636861_239649.jpg) select.jsp:![图片说明](https://img-ask.csdn.net/upload/201507/23/1437636901_138782.jpg) 如图,共有两个jsp页面,一个add.jsp select.jsp,在add.jsp上面有一个请选择按钮,点击请选择按钮后,弹出select.jsp页面,这个页面上是从数据库中遍历的企业,选中一条数据,点击确认,select.jsp页面关闭,并将结果带到add.jsp请选择前面的文本框里面。现在两个jsp页面我已经做好了,那么应该如何才能够得到想要的结果,action层是如何实现的?拜求解决。 好吧,继续昨天的问题: ![add.jsp](https://img-ask.csdn.net/upload/201507/24/1437720016_514705.jpg) ![select.jsp](https://img-ask.csdn.net/upload/201507/24/1437720015_192489.jpg) 应该如何将所选择的值带回到add.jsp推荐企业后的文本框中。 (add.jsp源码:<script type="text/javascript"> function closeYmtPage() { window.history.go(-1); } function findztype() { var idstr = $("#fwdl").val(); $.post("fw.do?action=findzType",{idstr:idstr},function(data){ var types=eval('(' + data + ')'); var typelist = types.typesList; $("#fwxl").empty(); $("#fwxl").append('<option value="">请选择</option>'); $.each(typelist, function (i, item) { var str ='<option value="'+item.id+'" title="'+item.name+'">'+item.name+'</option>'; $("#fwxl").append(str); }); }); } //推荐企业按钮 function openwindow(){ window.showModalDialog("/jxw/xq.do?action=showTjList",window, "status:no;scroll:yes; dialogWidth:400px;dialogHeight:400px"); } function addxm(flag){ $("#fbState").val(flag); var xqName =$("#xqName").val(); if(xqName =="") { alert("需求名称不能为空!"); return; } if($("#fwdl").val()=="" || $("#fwXl").val()==""){ alert("服务类别不能为空"); return; } $("#addForm").ajaxSubmit({ beforeSubmit : function() { $("#saveBtn").attr("disabled", true); }, success : function(data) { var start = data.indexOf(">"); if (start != -1) { var end = data.indexOf("<",start+1); if (end != -1) { data = data.substring(start+1, end); } } if (data == "ok") { alert("添加需求成功"); window.location.href='<c:url value="cartweb.do?action=loadFwxqPage&pageNo=1"/>'; } if (data == "error") { alert("添加需求失败"); } $("#saveBtn").attr("disabled", false); }, complete : function() { $("#saveBtn").attr("disabled", false); }, error : function() { $("#saveBtn").attr("disabled", false); alert("请求错误"); } }); } function checkfkfs(){ var fkfs=$("#fkfs").val(); if(fkfs=="2") { document.getElementById("price").disabled="disabled"; }else{ $("#price").removeAttr("disabled"); } } function addxqlc() { window.parent.document.getElementById("btnxqOk").click(); } </script> </head> <body> <div class="main_nav"> <div class="lb_nav" id="current_pageDiv" style="width: 100%"> <div class="lb_nav_tu">添加需求</div> <a href="javascript:void(0)" onclick="addxqlc()" style="float:right;font-size:16px;font-style:oblique;padding-right:20px">操作说明</a> </div> <form id="addForm" action="<c:url value='/xq.do?action=doAddxq'/>" method="post" id="addForm" name="addForm"> <input type="hidden" id="fbfs" name="fbfs" value="1" /> <table cellpadding="0" cellspacing="0" class="cx_table"> <tr> <th><b>*</b>需求名称:</th> <td height="25" align="left" bgcolor="#FFFFFF" colspan="3"><input type="text" id="xqName" name="xqName" value="" maxlength="50" /></td> </tr> <tr> <th><b>*</b>付款方式:</th> <td height="25" align="left" bgcolor="#FFFFFF"><select id="fkfs" name="fkfs" onchange="checkfkfs()"> <option value="1">具体价格</option> <option value="2">面议</option> </select></td> <th><b>*</b>预算价格(元):</th> <td height="25" align="left" bgcolor="#FFFFFF"><input type="text" id="price" name="price" value="" onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /> </td> </tr> <tr> <th><b>*</b>服务所属大类:</th> <td height="25" align="left" bgcolor="#FFFFFF"><select name="fwdl" id="fwdl" class="select_field" onchange="findztype()"> <c:forEach items="${fwdl}" var="domain"> <option value="${domain.id }" title="${domain.name }"> ${domain.name }</option> </c:forEach> </select></td> <th><b>*</b>服务所属小类:</th> <td height="25" align="left" colspan="3" bgcolor="#FFFFFF"><select name="fwxl" id="fwxl" class="select_field"> <c:forEach items="${fwxl}" var="domain"> <option value="${domain.id }" title="${domain.name }"> ${domain.name }</option> </c:forEach> </select></td> </tr> <tr> <th><b>*</b>需求内容:</th> <td height="25" align="left" colspan="3" bgcolor="#FFFFFF"><script type="text/plain" id="myEditor" name="contents"></script> <script type="text/javascript"> var Editor= new UE.ui.Editor({initialFrameWidth:'600',initialFrameHeight:'200',toolbars:[['fullscreen', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'directionalityltr', 'directionalityrtl', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|', 'insertimage', 'emotion', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe','pagebreak', 'template', 'background', '|', 'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|', 'print', 'preview', 'searchreplace', 'help']] ,elementPathEnabled : false}); Editor.render('myEditor'); </script></td> </tr> <tr> <th><b>*</b>推荐企业:</th> <td height="25" align="left" bgcolor="#FFFFFF" colspan="3"><textarea readonly="readonly" class="cl_textarea_small" name="xqName" id="xqName" width="100"></textarea> <input type=button name=inputboxbt value=请选择 onclick="openwindow();"></td> </tr> </table> <div class="btn_nav_dk"> <input type="hidden" value="" id="fbState" name="fbState" /> <input type="button" value="保 存" id="saveBtn" class="btn_bg" onclick="addxm('1');" /> <input type="reset" value="重 置" class="btn_bg" /> <input type="button" value="返 回" class="btn_bg" onclick="closeYmtPage();" /> </div> </form> </div> </body>) (select.jsp源码:<script type="text/javascript"> function bconfirm(){ dialogArguments.addNameform.inboxname.value=document.form1.inboxname.value; dialogArguments.opensub(); window.close(); } function bcancel(){ window.close(); } //将值传给text文本框 function result(form) { var a = document.getElementById("inboxname"); a.value = ""; for (var i = 0; i < form.elements.length; i++) { var e = form.elements[i]; if (e.name == "ifCheck" && e.checked == true) { a.value = a.value + e.value + "," } } } </script> </head> <body> <div class="content clr fl"> <div class="posit"> <h2> <ul> <li>当前位置:</li> <li>添加需求->推荐企业选择-<span>&gt;</span></li> </ul> </h2> </div> <div class="main"> <!--检索区域开始 -- <!--检索区域结束 --> <!--按钮区域开始 --> <div class="btm_list"> <h3>请选择企业:</h3> <div class="op_btn"></div> <!--按钮区域结束 --> <div class="form"> <form method=post name=form action=" /xq.do?action=doAddxq"> <input id="inboxname" type="hidden" name="inboxname" value="" /> <!-- <textarea readonly="readonly" class="cl_textarea_small" name="inboxname" id="inboxname" type="hidden" value=""></textarea><p>--> <input type=button name=inputboxbt value=确定 onclick="bconfirm();"> <input type=button name=inputboxbs value=关闭 onclick="bcancel();"> <table> <tr> <th style="width: 5%;"><input type="checkbox" onclick="checkOrCancel(this);" class="textCursor" /> </th> <th>序号</th> <th>企业名称</th> </tr> <c:forEach items="${domain}" var="domain1" varStatus="status"> <tr <c:if test="${status.count%2 == 0 }">class="grid_dark"</c:if> <c:if test="${status.count%2 == 1 }">class="grid_dark"</c:if> id="${domain1.id }"> <td><input type="checkbox" value="${domain1.id }" name="ifCheck" style="cursor: pointer;" id="ifCheck" onClick="result(this.form)" /> <input id="qymc.id" type="hidden" name="qymc.id" value="" /></td> <td>${status.count }</td> <td>${domain1.qymc }</td> </tr> </c:forEach> </table> </form> </div> </div> </div> </div> </body>)
如何用jsp点击链接实现文本下载 txt文件总是打开下载不了。。。
``` public class Filetran extends HttpServlet { @Id @GeneratedValue private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/plain;charset=UTF-8"); implAllAction i = new implAllAction(); List<Resource> list = i.selectfileapp(); if (list.size()!=0) { request.setAttribute("file", list); request.getRequestDispatcher("/Download.jsp").forward(request, response); } } } h3>以下是所有文档</h3> <h3>可随意点击下载:</h3> <c:forEach items="${file}" var="fi"> <a href="<%=basePath %>/upload/${fi.url}" target="_blank">${fi.url}</a><br><br> ```
servlet进行修改操作,jsp页面传值list不知道该怎么做
<form action="delete.do" method="get"> <table border="1" cellspacing="0" cellpadding="0" width="100%" style="align:center;"> <tr bgcolor="ff9900" style="font-weight:bold;"> <th >操作</th> <th>ID</th><th>姓名</th><th>性别</th><th>学历</th><th>生日</th><th>籍贯</th><th>登录密码</th><th>工资</th></tr> <%//循环显示数据 ArrayList<User> list=(ArrayList)session.getAttribute("list"); System.out.print(list.size()); // 取request里面的对象队列 //判断长度是否为0,即空 if(list.size()!=0){ //根据长度循环 for(int i=0;i<list.size();i++){ User use1 =new User(); //新建对象use1 use1 = list.get(i); //每循环一次后取到的list值将此时的值保存到对象里 %> <tr> <td><input type="checkbox" value=<%=use1.getId() %> name="test" > </td> <td><%=use1.getId() %></td> <td><%=use1.getName() %></td> <td><%=use1.getSex() %></td> <td><%=use1.getWorking()%></td> <td><%=use1.getBirth()%></td> <td><%=use1.getBorth()%></td> <td><%=use1.getLoginpass()%></td> <td><%=use1.getSalary()%></td> </tr> <% System.out.print(use1);%> <% } } else{ %><tr><td colspan="6">数据库中没有数据!</td></tr><% }%> </table> </form> <input type="button" name="test" onclick="takeId()" value="删除"> <input type="button" name="test" onclick="updateId()" value="修改"> <input type="button" onclick="window.location.href='user.jsp'" value="增加"> <input type="button" onclick="window.location.href='login.jsp'" value="退出"> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <form action="add.do" method="get" > <h4>修改用户</h4> <c:forEach items="${list}" var="list"> 用户名ID: <input type="text" name="AB" value="${id}"/><br/> 登录密码: <input type="text" name="loginpass" value="${list.loginpass}"/></input><br/> 确认密码: <input type="text" name="loginpass" ></input><br/> 性别:<input type="radio" name="sex">男 <input type="radio" name="sex">女 <br> 用户姓名:<input type="text" name="username" value="${list.username}"><br> 出生日期: <input type="text" name="birth" value="${list.birth}"/></input><br/> 工 资 : <input type ="text" name="salary" value="${list.salary}"/><br> <select id="working" > <option >学历:</option> <option >大专</option> <option >本科</option> <option >硕士</option> <option >博士</option> </select><br> <select name=" borth"> <option selected>籍贯:</option> <option >南京</option> <option >芜湖</option> </select><br> </c:forEach> <input type="submit" value="保存修改" > </form> <!-- form表单的作用能将多条信息整合起来进行传送。 submit是一个提交按钮,与button不同的是,submit会提交表单。 而button是单纯的一个按钮--> </body> </html>
springmvc的model返回值jsp为何取不到这个值
最近,在写一段用户的代码,要求使用springmvc, RowMapper,jdbcTemplate的技术,我的代码段如下: jsp页面 users.jsp ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <table> <c:if test="${not empty userlist}"> <c:forEach var="s" items="${userlist}" varStatus="status"> <thead> <tr><td>用户姓名</td><td>用户密码</td></tr> </thead> <tbody> <tr><td>${s.user_name}</td><td>${s.user_pwd}</td></tr> </tbody> </c:forEach> </c:if> </table> </body> </html> ``` HelloController.java ``` @RequestMapping("/howareyou.do") public String getUserbyUserId(Model model,HttpServletRequest req){ Long userid=(long) Integer.parseInt(req.getParameter("user_id")); List<User> users = userService.findAllByUserId(userid); model.addAttribute("userlist",users); return "users"; } ``` UserServiceImplement.java ``` @Override public List<User> findAllByUserId(Long user_id) { // TODO Auto-generated method stub String sql = "select * from user where user_id = ?"; Object[] params = new Object[] {user_id}; BeanPropertyRowMapper<User> UserRowMapper = new BeanPropertyRowMapper<User>(User.class); List<User> users = null; /** * 使用接口实现类 */ users = jdbcTemplate.query(sql, params, UserRowMapper); /** * 使用匿名内部类 * 如果UserRowMapper类只使用一次,单独为其创建一个类多余,可以使用匿名类 * 省略了书写一个实现类 */ users = jdbcTemplate.query(sql, params, new RowMapper<User>() { public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); /*user.setUser_id(Long.parseLong(String.valueOf(rs.getInt("user_id"))));*/ user.setUser_name(rs.getString(3)); user.setUser_pwd(rs.getString(2)); System.out.println("user_name is"+user.getUser_name()); System.out.println("user_pwd is"+user.getUser_pwd()); System.out.println("user_id is"+user.getUser_id()); return user; } }); return (users != null && users.size() > 0) ? users : null; } ``` 我用断点进入,发现在serviceImplement层,users是有值的,分别取到一个用户user的username和user_pwd的2个属性,可是到了jsp层,为何出现的是com.frame.model.User@123456的输出结果?而且,页面没有输出值。请教,应该如何写才好?谢谢!
ssm pageheleper 模糊查询语句出错
@RequestMapping("mohu") public String mohuchaxun(@RequestParam(value="pn",defaultValue="1")Integer pn,Model model,books bk){ //从第一条开始 每页查询五条数据 PageHelper.startPage(pn, 3); List<books> users = userService.mohu(bk); System.out.println("测试集合有没有获取到数据"+bk.getBookuser()); System.out.println("大小"+users.size()); //将用户信息放入PageInfo对象里 PageInfo page1 = new PageInfo(users,7); model.addAttribute("pageInfo2", page1); return "mohu"; } -----------------------------------------------------------------controller <select id="mohu" parameterType="books" resultType="books"> select * from books where bookuser LIKE '%' #{bookuser} '%' </select> -------------------------------------------------------------------dao.xml <c:forEach items="${pageInfo2.list }" var="user"> <tr> <td>${user.bid}</td> <td>${user.bookuser }</td> <td>${user.booktype }</td> <td><img src="${user.bookimg}" width="200" height="100" ></td> <!-- <td><img src="${user.bookimg}" width="200" height="300" ></td> --> <!-- <td><a class="edit">编辑</a> <a class="delete">删除</a></td> --> </tr> </c:forEach> </table> </div> </div> <hr style="height:1px;border:none;border-top:1px solid #ccc;" /> <!-- 分页导航栏 --> <!-- 分页信息 --> <div class="row"> <!-- 分页文字信息,其中分页信息都封装在pageInfo中 --> <div class="col-md-6"> 当前第:${pageInfo2.pageNum}页,总共:${pageInfo2.pages}页,总共:${pageInfo2.total}条记录 </div> <!-- 分页条 --> <div class="col-md-6"> <nav aria-label="Page navigation"> <ul class="hvtulli" style="list-style-type:none"> <li><a href="${path}/user/mohu?pn=1">首页</a></li> <c:if test="${pageInfo2.hasPreviousPage }"> <li> <a href="${path}/user/mohu?pn=${pageInfo2.pageNum-1}" aria-label="Previous"> <span aria-hidden="true">上一页</span> </a> </li> </c:if> <c:forEach items="${pageInfo2.navigatepageNums }" var="page_Num"> <c:if test="${page_Num == pageInfo2.pageNum }"> <li class="active"><a href="#">${ page_Num}</a></li> </c:if> <c:if test="${page_Num != pageInfo2.pageNum }"> <li><a href="${path}/user/mohu?pn=${ page_Num}">${ page_Num}</a></li> </c:if> </c:forEach> <c:if test="${pageInfo2.hasNextPage }"><a href="${path}/user/mohu?pn=${pageInfo2.pageNum+1}" aria-label="Next">下一页 </a> </c:if> <a href="${path}/user/mohu?pn=${pageInfo2.pages}">末页</a> -----------------------------------------------------------jsp 普通的查询这样都可以做到。 但是这个模糊查询,点击首页或者末页就会报错, Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null '%') tmp_count' at line 2 ### The error may exist in com/ssm/dao/Userdao.xml ### The error may involve com.ssm.dao.Userdao.mohu-Inline ### The error occurred while setting parameters ### SQL: select count(0) from (select * from books where bookuser LIKE '%' ? '%') tmp_count 知道是sql的错误, 请大神帮我看看怎么办。 我是初学者。
springMVC后台的值无法通过ModelAndView的addObject传到前台
我将studentList放入request作用域中jsp可以访问,为什么通过ModelAndView的addObject方法放入后,前台就无法访问。 后台方法: @RequestMapping("/studentList") public ModelAndView studentList(HttpServletRequest request) throws Exception{ ModelAndView mav = new ModelAndView("studentList"); // List<Student> studentList = iStudentService.queryAllStudent(); // System.out.println(studentList.size()); // request.setAttribute("studentList", studentList); mav.addObject("studentList", iStudentService.queryAllStudent()); mav.addObject("xx", "xx"); // mav.addObject("studentList",studentList); return mav; } 前台代码 <body> ${xx} <table border="1"> <tr> <td>id</td><td>name</td><td>birthday</td><td>creatTime</td> </tr> <c:forEach items="${studentList}" var="student"> <tr> <td>${student.id}</td> <td>${student.name}</td> <td>${student.birthday}</td> <td>${student.createTime}</td> </tr> </c:forEach> </table> </body>
(急~~~!)EL表达式怎么取动态作用域变量
一个action文件: [code="java"] package com.struts; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForward; import org.apache.struts.action.Action; import java.util.*; import com.dao.*; import com.bean.*; public class detailsAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { detailsForm detailsForm = (detailsForm) form; String type = request.getParameter("type");//执行类型 String id = request.getParameter("infoid");//取得的参数变化 String typediv = "";//根据这个值确定一个页面显示的内容 if (type.equals("indexnotice")) {//显示所点击的公告信息 //调用方法返回结果List List notPGroups = DAO_ParentGroups.doSelectParentGroups (" and Pg_Topic=(select Ct_Id from Topic where Ct_Name='产品中心')"); List notInfo = DAO_DetailsInfo.doSelectDetailsInfo(" and di_Id=" + id);//显示点击的产品详细信息 for (int i=0; i<notPGroups.size(); i++){ int j = i + 1; Vo_ParentGroups pgroups = (Vo_ParentGroups)notPGroups.get(i);//类型转换为一个数据Bean类 int diId = pgroups.getPgId();//取得Bean的一个编号 List subGroups = DAO_Groups.doSelectGroups(" and Cg_Parent=" + diId);//根据Id查找 request.setAttribute("subgroups"+j,subGroups);//动态的设置作用域 } request.setAttribute("notgroupslist",notPGroups); request.setAttribute("notinfo",notInfo); typediv = "indextopic"; } if (type.equals("indexsovle")) {//显示所点击的解决方案 typediv = "indexsovle"; } if (type.equals("indexnews")) {//显示所点击的新闻信息 typediv = "indexnews"; } if (type.equals("indexproduct")) {//显示所点击的产品信息 typediv = "indexproduct"; } if (type.equals("indexsuccase")) {//显示所点击的成功案例 typediv = "indexsuccase"; } request.setAttribute("typediv",typediv); return mapping.findForward("topic"); } } [/code] 一个JSP文件: [code="html"] <%@ page contentType="text/html; charset=GB2312" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <table> <tr> <td width='205' height="500" valign="top" background="image/index_bg.jpg"> <P style="MARGIN-TOP: -5px; MARGIN-BOTTOM: 6px; WORD-SPACING: 0px; LINE-HEIGHT: 150%" align=center>&nbsp;</P> <div id="PARENT"> <ul id="nav"> <c:choose> <c:when test="${requestScope.notgroupslist!=null}"> <c:forEach var="parentgroups" items="${requestScope.notgroupslist}" varStatus="gnum"> <li> <a href="#" onclick="DoMenu('ChildMenu1')"> <font class="fontcolor">${parentgroups.pgName}</font> </a> <!--在这里怎么取得action动态设置的作用域--> <c:if test="${requestScope.subgroups[gnum.count]!=null}"> <ul id="ChildMenu1" class="collapsed"> <c:forEach var="subgroups" items="${requestScope.subgroups[gnum.count]}"> <li> <a href="#" target="_blank"> <font class="fontcolor">${gnum.count}</font> </a> </li> </c:forEach> </ul> </c:if> </li> </c:forEach> </c:when> <c:otherwise> 暂无分类! </c:otherwise> </c:choose> </ul> </div> <P style="MARGIN-TOP: -5px; MARGIN-BOTTOM: 6px; WORD-SPACING: 0px; LINE-HEIGHT: 150%" align=center>&nbsp;</P> </td> </tr> </table> [/code] 请教各位大侠~!在JSP中怎么取得在action中动态设置的request作用域变量~!急啊~!
jsp页面的数据导出到excel (jsp页面里已从数据库里取出了数据放到了List里面)
这是jsp页面的代码,已取出了userList,就是不会打印到excel ........................................ <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <c:set var="stx" value="${pageContext.request.contextPath }"></c:set> <% response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); %> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>通讯录列表</title> <link rel="stylesheet" href="${stx }/css/reset.css"> <link rel="stylesheet" href="${stx }/css/index.css?version=20160519001"> </head> <body> <div class="container"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align=left style="padding: 0 10px;"><br> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr class="route"> <th>当前位置:</th> <td>人力资源&nbsp;>&nbsp;</td> <td>考勤管理&nbsp;>&nbsp;</td> <td><a href="${stx }/oa/user/toTxl" >通讯录管理</a>&nbsp;>&nbsp;</td> <td>通讯录列表</td> </tr> </table></td> </tr> </table> <br> <div align="center"> <form id="report" name="report" method="POST" action="${stx }/oa/user/getTxlList"> <input type="hidden" id="deptId1" name="deptId1" value="${param.deptId1 }"> <input type="hidden" id="deptId2" name="deptId2" value="${param.deptId2 }"> <input type="hidden" id="userName" name="userName" value="${param.userName }"> <input type="hidden" id="userCode" name="userCode" value="${param.userCode }"> <input type="hidden" id="sex" name="sex" value="${param.sex }"> <input type="hidden" id="dutyName" name="dutyName" value="${param.dutyName }"> <input type="hidden" id="status" name="status" value="${param.status }"> <input type="hidden" id="oaStatus" name="oaStatus" value="${param.oaStatus }"> <input type="hidden" id="joinDateBegin" name="joinDateBegin" value="${param.joinDateBegin }"> <input type="hidden" id="joinDateEnd" name="joinDateEnd" value="${param.joinDateEnd }"> <input type="hidden" id="refereeDeptId1" name="refereeDeptId1" value="${param.refereeDeptId1 }"> <input type="hidden" id="refereeDeptId2" name="refereeDeptId2" value="${param.refereeDeptId2 }"> <input type="hidden" id="refereeId" name="refereeId" value="${param.refereeId }"> <input type="hidden" id="refereeDeptName1" name="refereeDeptName1" value="${param.refereeDeptName1 }"> <input type="hidden" id="refereeDeptName2" name="refereeDeptName2" value="${param.refereeDeptName2 }"> <input type="hidden" id="mobile" name="mobile" value="${param.mobile }"> <input type="hidden" id="currPageNum" name="currPageNum" value="${page.currPageNum }"> <input type="hidden" id="orderColumn" name="orderColumn" value="${page.orderColumn }"> <input type="hidden" id="orderMode" name="orderMode" value="${page.orderMode }"> <input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize }"> <input type="hidden" id="total" name="total" value="${page.totalPageCount }"> </form> <table border="0" cellpadding="0" width="1000px" cellspacing="0"> <tbody> <tr> <td style="text-align:left;">&nbsp; 共${page.totalCount }条记录&nbsp;&nbsp;&nbsp;&nbsp;</td> <td align="right" width="200">共 <font color="red">${page.totalPageCount }</font> 页&nbsp;&nbsp;当前第 <font color="red">${page.currPageNum } </font>页&nbsp;&nbsp; </td> <td width="70">转到<input size="3" class="skip" id="go" onKeyDown="return go_onkeydown('report')">页 </td> <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%"> <tr> <td align="center" class="right_btn first"><img src="${stx }/images/back.png" width="13" height="8"></td> </tr> </table></td> <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%""> <tr> <td align="center" class="right_btn prev"><img src="${stx }/images/pre.png" width="7" height="9"></td> </tr> </table></td> <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%"> <tr> <td align="center" class="right_btn next"><img src="${stx }/images/next.png" width="7" height="9"></td> </tr> </table></td> <td width="30px"><table cellpadding="0" cellspacing="0" style="cursor: pointer; height: 22px; width: 100%" > <tr> <td align="center" class="right_btn last"><img src="${stx }/images/forward.png" width="13" height="8"></td> </tr> </table></td> </tr> </tbody> </table> <table class="outside_table maintain_list" cellspacing="1" cellpadding="0" style="width: 1000px; border:0px;"> <tr> <th id="user_name_col" class="title_bg order" style="min-width: 70px; width: 70px;" nowrap="nowrap">姓名</th> <th id="user_code_col" class="title_bg order" style="min-width: 60px; width: 60px;" nowrap="nowrap">编号</th> <th id="fk_dept_id_col" class="title_bg order" nowrap="nowrap">部门</th> <th id="duty_col" class="title_bg order" style="min-width: 60px; width: 60px;" nowrap="nowrap">职务</th> <!-- <th class="title_bg" style="min-width: 50px; width: 50px;" nowrap="nowrap">等级</th> --> <th id="join_date_col" class="title_bg order" style="min-width: 80px; width: 80px;" nowrap="nowrap">入司日期</th> <th id="sex_col" class="title_bg order" style="min-width: 60px; width: 60px;" nowrap="nowrap">性别</th> <th id="status_col" class="title_bg order" style="min-width: 80px; width: 80px;" nowrap="nowrap">系统状态</th> <th id="oa_status_col" class="title_bg order" style="min-width: 80px; width: 80px;" nowrap="nowrap">岗位状态</th> <th class="title_bg" style="min-width: 50px; width: 50px;" nowrap="nowrap">详细</th> </tr> <c:if test="${not empty userList }"> <c:forEach items="${userList }" var="user" varStatus="s"> <c:if test="${(s.index)%2==1 }"> <tr class="even"> </c:if> <c:if test="${(s.index)%2==0 }"> <tr class="odd"> </c:if> <td>${user.userName }</td> <td>${user.userCode }</td> <td>${user.dept.nameAll }</td> <td>${user.duty }</td> <!-- <td>${user.dutyLevel }</td> --> <td>${user.joinDate }</td> <td>${user.sex }</td> <td>${user.oaStatus }</td> <td>${user.status }</td> <td><a class="btn" href="${stx }/oa/user/getTxlDetail?userId=${user.userId }">详细</a></td> </tr> </c:forEach> </c:if> <c:if test="${empty userList }"> <tr> <th colspan="10" class="bg_textcont">无相关信息</th> </tr> </c:if> </table> </div> </div> <script src="${stx }/js/jquery-1.12.0.min.js"></script> <script src="${stx }/js/orderlist.js"></script> </body> </html>
win7系统报错getOutputStream() has already been called for this response.但是xp系统没问题...
<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>    最近这个问题搞的很头疼,debug过了,action中执行到return "SUCCESS"就报出错误堆栈了,所以应该是jsp文件写的有问题,JSP文件中根本就没有发现getOutputStream(),引入的文件中也没有</p> <p>    而且更奇怪的是,在我开发的机器上和经理的电脑上都报这个错误,但是在业务的员工的电脑上没出现这个错误,所以推测是代码的某些部分可能存在不兼容的问题,因为我的电脑和经理的电脑是win7的系统,业务的员工的电脑是XP的系统,然后再测试人员的电脑上面进xp的虚拟机也不会报这样的问题</p> <p>    但是实在看不出来代码存在什么样的问题,百度了N条记录,说是加入2行代码的什么的,但是JSP文件中压根就没有getOutputStream()的语句存在.</p> <p>     贴上几段代码吧,希望大神能帮忙分析下问题:</p> <p>     首先是错误堆栈(win7系统):</p> <p>    </p> <pre name="code" class="java">2013-1-24 16:26:02 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet default threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter(Response.java:601) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196) at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:157) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118) at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:326) at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:342) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspx_meth_c_005fotherwise_005f1(integrative_jsp.java:1180) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspx_meth_c_005fchoose_005f1(integrative_jsp.java:1119) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspx_meth_c_005fforEach_005f1(integrative_jsp.java:1079) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspService(integrative_jsp.java:362) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:594) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505) at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:141) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:343) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:161) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.mangocity.ds.framework.common.controller.ActionInfoInterceptor.intercept(ActionInfoInterceptor.java:55) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Thread.java:619) </pre> <p> action的代码,请求到的方法:</p> <p>   </p> <pre name="code" class="java">/** * 2008-05-06 V2.6.0 SR029 常锐 导出配送单信息 * * @return * @throws Exception */ public String exportExcelDeliveryBill() throws Exception { init(); List&lt;String&gt; unitIdList = new ArrayList&lt;String&gt;(); List&lt;String&gt; centerIdList = new ArrayList&lt;String&gt;(); // 判断是否有权限 if (null != getSystemType().getUnitList() &amp;&amp; 0 &lt; getSystemType().getUnitList().size() &amp;&amp; null != getSystemType().getCenterList() &amp;&amp; 0 &lt; getSystemType().getCenterList().size()) { for (int i = 0; i &lt; getSystemType().getUnitList().size(); i++) { unitIdList.add(((DeliveryUnit) getSystemType().getUnitList().get(i)).getId()); } for (int i = 0; i &lt; getSystemType().getCenterList().size(); i++) { centerIdList.add(((DeliveryCenter) getSystemType().getCenterList().get(i)).getId()); } showOther = ((IntegrativeService) getDBService()).getDeliveryBillList(getParams(), getPage(), unitIdList, centerIdList); } showDeliveryList = "yes"; HttpServletResponse response = super.getHttpServletResponse(); response.reset(); response.setContentType("application/vnd.ms-excel");// "application/msexcel" response.setCharacterEncoding("GBK"); response.setHeader("Content-disposition", "attachment;filename=配送单综合查询.xsl"); OutputStream outStrean = response.getOutputStream(); // 获取addressList List addressList = this.getSystemType().getAreaAddressList(); HSSFWorkbook demoWorkBook = ((IntegrativeService) getDBService()).exportExcelDeliveryBill( getParams(), unitIdList, centerIdList, addressList); demoWorkBook.write(outStrean); outStrean.flush(); outStrean.close(); return SUCCESS; }</pre> <p> </p> <p>返回到的JSP页面(发出请求的也是这个页面):</p> <p>   </p> <pre name="code" class="java">&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook" %&gt; &lt;%@ page import="com.opensymphony.xwork2.util.*" %&gt; &lt;%@ include file="/jsp/common/commonheader.jsp"%&gt; &lt;script src="&lt;%=webPath%&gt;/js/query.js"&gt;&lt;/script&gt; &lt;script src="&lt;%=webPath%&gt;/js/operate.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function exportExcel() { if(checkQueryForm()) { queryform.action ="IntegrativeAction_exportExcelDeliveryBill.do"; queryform.submit(); } else return false; } function submitForm(){ if(checkQueryForm()) { queryform.action ="IntegrativeAction_queryByDeliveryBill.do"; queryform.submit(); } else return false; } function checkQueryForm() { if(!validate_form(queryform))return false; if(!checkDeliveryDate("billcreatedatebegin","billcreatedateend")){ return false; } if(!checkDeliveryDate("deliverydatebegin","deliverydateend")){ return false; } if(!checkDeliveryDate("deliveryendbegin","deliveryendend")){ return false; } var deliveryCD = queryform.elements["params.deliveryCD"].value; var orderCD = queryform.elements["params.orderCD"].value; var billcreatedatebegin = document.getElementById("billcreatedatebegin").value; var deliverydatebegin = document.getElementById("deliverydatebegin").value; var deliveryendbegin = document.getElementById("deliveryendbegin").value; var billcreatedateend = document.getElementById("billcreatedateend").value; var deliverydateend = document.getElementById("deliverydateend").value; var deliveryendend = document.getElementById("deliveryendend").value; var deliveryCenter = document.getElementById("deliveryCenter").value; if(deliveryCD=="" &amp;&amp; orderCD==""){ if(deliveryCenter==""){ alert("请使用以下三种方式中的一种进行查询:\n\n1.配送中心+配送单创建时间\n2.配送中心+预约配送时间\n3.配送中心+配送完成时间"); return false; } if(billcreatedatebegin=="" &amp;&amp; deliverydatebegin=="" &amp;&amp; deliveryendbegin=="") { alert("请使用以下三种方式中的一种进行查询:\n\n1.配送中心+配送单创建时间或\n2.配送中心+预约配送时间或\n3.配送中心+配送完成时间"); return false; } } if(better_time(billcreatedatebegin,billcreatedateend)&gt;180){ alert(document.getElementById("billcreatedateend").title+"不应超过六个月!"); return false; } if(better_time(deliverydatebegin,deliverydateend)&gt;180){ alert(document.getElementById("deliverydateend").title+"不应超过六个月!"); return false; } if(better_time(deliveryendbegin,deliveryendend)&gt;180){ alert(document.getElementById("deliveryendend").title+"不应超过六个月!"); return false; } return true; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="queryform" action="IntegrativeAction_queryByDeliveryBill.do" method="post"&gt; &lt;table width="20%" border="0" cellpadding="3" cellspacing="0"&gt; &lt;tr&gt; &lt;td height="18" &gt;&lt;strong&gt;&lt;img src="&lt;%=webPath%&gt;/images/arrow.gif" width="9" height="9"&gt; 综合查询&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width="100%" class="table_bg" align="center" border="0" cellpadding="1" cellspacing="0"&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="hidden" id="showother" value="${showOther}" /&gt; &lt;input type="hidden" id="showotherinfo" value="yesorno" /&gt; &lt;input type="hidden" id="showdeliverylist" value="${showDeliveryList }" /&gt; &lt;input type="hidden" id="urgencyCopy" value="${params.urgency }" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td height="18"&gt;&lt;img src="&lt;%=webPath%&gt;/images/a2.gif" width="9" height="9"&gt; &lt;a href="#" onClick="javascript:playTableDelivery('deliverTbl')"&gt; &lt;font color="#FF9933"&gt;配送单信息&lt;/font&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;table width="100%" class="table_bg" align="center" border="0" cellpadding="1" cellspacing="0" style="display:block" id="deliverTbl"&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;配送单编号&lt;/td&gt; &lt;td width="32%"&gt;&lt;input type="text" name="params.deliveryCD" value="${params.deliveryCD}" maxlength="50"&gt;&lt;/td&gt; &lt;td width="18%"&gt;订单编号&lt;/td&gt; &lt;td width="35%"&gt;&lt;input type="text" name="params.orderCD" value="${params.orderCD}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;订单来源&lt;/td&gt; &lt;td width="32%"&gt;&lt;select id="billResouceOne" name="params.billResouce"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="billResouce" items="${systemType.billResouce}"&gt; &lt;c:choose&gt; &lt;c:when test="${billResouce.value == params.billResouce}"&gt; &lt;option value="${billResouce.value}" selected&gt;${billResouce.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${billResouce.value}"&gt;${billResouce.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;配送方式&lt;/td&gt; &lt;td&gt;&lt;select name="params.deliveryType"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="deliveryType" items="${systemType.deliveryType}"&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryType.value == params.deliveryType}"&gt; &lt;option value="${deliveryType.value}" selected&gt;${deliveryType.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${deliveryType.value}"&gt;${deliveryType.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送中心&lt;/td&gt; &lt;td&gt;&lt;select name="params.centerCD" id="deliveryCenter"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;配送单位&lt;/td&gt; &lt;td&gt;&lt;select name="params.deliveryUnitCD" id="deliveryUnit"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送任务状态&lt;/td&gt; &lt;td&gt;&lt;select name="params.deliveryState"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="deliveryStateTwo" items="${systemType.deliveryState}"&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryStateTwo.value == params.deliveryState}"&gt; &lt;option value="${deliveryStateTwo.value}" selected&gt;${deliveryStateTwo.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${deliveryStateTwo.value}"&gt;${deliveryStateTwo.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;收款任务状态&lt;/td&gt; &lt;td&gt;&lt;select name="params.gatheringState"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="deliveryState" items="${systemType.deliveryState}"&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryState.value == params.gatheringState}"&gt; &lt;option value="${deliveryState.value}" selected&gt;${deliveryState.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${deliveryState.value}"&gt;${deliveryState.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送员姓名&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.delivererName" value="${params.delivererName}" maxlength="50"&gt;&lt;/td&gt; &lt;td&gt;收件人&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.addresseeName" value="${params.addresseeName}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送接票时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="deliveryconnect" name="params.deliveryConnect" value="${params.deliveryConnect }" size="15"&gt; &lt;a href="javascript:showCalendar('deliveryconnect',false,'deliveryconnect')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;收件人联系电话&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.addresseePhone" value="${params.addresseePhone}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;会员编号&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.memberName" value="${params.memberName}" maxlength="50"&gt;&lt;/td&gt; &lt;td&gt;收件人手机号&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.addresseeMobile" value="${params.addresseeMobile}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;第三方收件人&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.linkman" value="${params.linkman}" maxlength="50"&gt;&lt;/td&gt; &lt;td&gt;第三方收件人联系电话&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.linkmanPhone" value="${params.linkmanPhone}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送单创建时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" size="10" id="billcreatedatebegin" name="params.billCreateDateBegin" value="${params.billCreateDateBegin }" dataType="date"&gt; &lt;a href="javascript:showCalendar('billcreatedatebegin',false,'billcreatedatebegin','billcreatedateend','billcreatedateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt; &lt;input type="text" size="10" id="billcreatedateend" name="params.billCreateDateEnd" value="${params.billCreateDateEnd }" title="配送单创建时间" dataType="date"&gt; &lt;a href="javascript:showCalendar('billcreatedateend',false,'billcreatedateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;预约配送时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" size="10" id="deliverydatebegin" name="params.deliveryDateBegin" value="${params.deliveryDateBegin}" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliverydatebegin',false,'deliverydatebegin','deliverydateend','deliverydateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt; &lt;input type="text" size="10" id="deliverydateend" name="params.deliveryDateEnd" value="${params.deliveryDateEnd }" title="预约配送时间" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliverydateend',false,'deliverydateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;紧急程度&lt;/td&gt; &lt;td&gt;&lt;select id="urgencyOne" name="params.urgency"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="urgency" items="${systemType.urgencyType}"&gt; &lt;c:choose&gt; &lt;c:when test="${urgency.value == params.urgency}"&gt; &lt;option value="${urgency.value}" selected&gt;${urgency.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${urgency.value}"&gt;${urgency.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;配送完成时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" size="10" id="deliveryendbegin" name="params.deliveryEndBegin" value="${params.deliveryEndBegin}" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliveryendbegin',false,'deliveryendbegin','deliveryendend','deliveryendend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt; &lt;input type="text" size="10" id="deliveryendend" name="params.deliveryEndEnd" value="${params.deliveryEndEnd }" title="配送完成时间" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliveryendend',false,'deliveryendend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;配送地址&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.deliveryAddress" value="${params.deliveryAddress}" maxlength="100"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td height="18" colspan="4" valign="middle"&gt;&lt;img src="&lt;%=webPath%&gt;/images/a2.gif" width="9" height="9"&gt; &lt;a href="#" onClick="javascript:playTableOther('otherTbl')"&gt; &lt;font color="#FF9933"&gt;其他信息&lt;/font&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;table width="100%" class="table_bg " align="center" border="0" cellpadding="1" cellspacing="0" style="display:none" id="otherTbl"&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;异常问题大类&lt;/td&gt; &lt;td&gt;&lt;select name="params.questionBigCode" id="billProblemBigType"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;td width="15%"&gt;异常问题小类&lt;/td&gt; &lt;td&gt;&lt;select name="params.questionSmallCode" id="billProblemSmallType" style="display:inline;width:340"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;问题处理&lt;/td&gt; &lt;td width="35%"&gt;&lt;input type="text" name="params.processMethod" value="${params.processMethod }"&gt;&lt;/td&gt; &lt;td&gt;建单原因&lt;/td&gt; &lt;td colspan="3"&gt;&lt;input type="text" name="params.createBillCause" value="${params.createBillCause }"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td align="right" colspan="4"&gt; &lt;input type="button" class="btn" value="导 出 EXCEL" style="width:100px" onClick="exportExcel();"&gt; &amp;nbsp; &lt;input type="submit" class="btn" value="查 询" onClick="return submitForm();"&gt; &amp;nbsp; &lt;input type="button" class="btn" value="重 置" onClick="javascript:clearForm('queryform');"&gt; &amp;nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width="20%" border="0" cellpadding="3" cellspacing="0"&gt; &lt;tr&gt; &lt;td height="18" &gt;&lt;strong&gt;&lt;img src="&lt;%=webPath%&gt;/images/arrow.gif" width="9" height="9"&gt; 结果列表&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width="100%" class="table_bg" align="center" border="1" cellpadding="1" cellspacing="0" id="orderlist"&gt; &lt;tr align="center" class="sub_bg"&gt; &lt;td width="1%"&gt;紧急度&lt;/td&gt; &lt;td width="10%"&gt;订单编号&lt;br&gt;订单类型&lt;/td&gt; &lt;td width="11%"&gt;配送单编号&lt;br&gt;配送单创建时间&lt;/td&gt; &lt;td width="8%"&gt;会员类型&lt;br&gt;VIP级别&lt;/td&gt; &lt;td width="6%"&gt;配送单位&lt;/td&gt; &lt;td width="9%"&gt;配送方式&lt;br&gt;任务类型&lt;/td&gt; &lt;td width="8%"&gt;配送城市&lt;br&gt;/城区&lt;/td&gt; &lt;td width="10%"&gt;配送地址&lt;/td&gt; &lt;td width="10%"&gt;配送时间&lt;/td&gt; &lt;td width="8%"&gt;配送员姓名&lt;br&gt;联系电话&lt;/td&gt; &lt;td width="7%"&gt;截余时间&lt;/td&gt; &lt;td width="6%"&gt;配送任务状态&lt;/td&gt; &lt;td width="6%"&gt;收款任务状态&lt;/td&gt; &lt;/tr&gt; &lt;c:forEach var="deliveryBill" items="${page.pageList}"&gt; &lt;tr align="center" class="row_bg"&gt; &lt;td&gt;&lt;c:forEach var="t" items="${systemType.urgencyType}"&gt; &lt;c:if test="${deliveryBill[0].urgency == t.value}"&gt; &lt;c:if test="${t.label == '紧急'}"&gt; &lt;img src="${webPath}/images/dot_11.gif"&gt;&lt;/c:if&gt; &lt;c:if test="${t.label == '非常紧急'}"&gt; &lt;img src="${webPath}/images/dot_12.gif"&gt;&lt;/c:if&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;${deliveryBill[0].orderCD}&lt;br&gt; &lt;c:forEach var="b" items="${systemType.billResouce}"&gt; &lt;c:if test="${deliveryBill[0].billResouce == b.value}"&gt; ${b.label} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;&lt;a href="#" onClick="viewDetailForQuery('${deliveryBill[0].id}','9')"&gt;${deliveryBill[0].deliveryCD}&lt;/a&gt;&lt;br&gt;${deliveryBill[0].entityCreateDate} ${fn:substring(deliveryBill[0].entityCreateTime, 0, 5)}&lt;/td&gt; &lt;td&gt; &lt;c:forEach var="memberType" items="${systemType.memberType}"&gt; &lt;c:if test="${memberType.value eq deliveryBill[0].memberLevel}"&gt; ${memberType.label} &lt;/c:if&gt; &lt;/c:forEach&gt;&lt;br&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryBill[0].vipType eq '1'}"&gt; &lt;font class="redone"&gt;*&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '2'}"&gt; &lt;font class="redone"&gt;**&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '3'}"&gt; &lt;font class="redone"&gt;***&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '4'}"&gt; &lt;font class="redone"&gt;****&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '5'}"&gt; &lt;font class="redone"&gt;*****&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '6'}"&gt; &lt;font class="redone"&gt;******&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '7'}"&gt; &lt;!--img src="&lt;%=request.getContextPath()%&gt;/images/star7.gif"&gt;--&gt; &lt;/c:when&gt; &lt;/c:choose&gt; &lt;/td&gt; &lt;td&gt;${deliveryBill[2]}&lt;/td&gt; &lt;td&gt;&lt;c:forEach var="t" items="${systemType.deliveryType}"&gt; &lt;c:if test="${deliveryBill[0].deliveryType == t.value}"&gt; ${t.label} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;br&gt; &lt;c:forEach var="t" items="${systemType.taskType}"&gt; &lt;c:if test="${deliveryBill[1] == t.value}"&gt;${t.label}&lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;&lt;c:forEach var="deliveryCityID" items="${systemType.areaAddressList}"&gt; &lt;c:if test="${deliveryBill[0].deliveryCityID == deliveryCityID.code}"&gt; ${deliveryCityID.name} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;br&gt;&lt;c:forEach var="areaItem" items="${systemType.areaAddressList}"&gt; &lt;c:if test="${areaItem.code eq deliveryBill[0].deliveryZoneID &amp;&amp; areaItem.type eq '4' &amp;&amp; areaItem.fatherCode eq deliveryBill[0].deliveryCityID}"&gt; ${areaItem.name} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td title="${deliveryBill[0].deliveryAddress}"&gt; ${fn:substring(deliveryBill[0].deliveryAddress, 0, 12)} &lt;/td&gt; &lt;td&gt;${deliveryBill[0].deliveryDate}&lt;br&gt; ${fn:substring(deliveryBill[0].dsBeginTime, 0, 5)}-${fn:substring(deliveryBill[0].dsEndTime, 0, 5)}&lt;/td&gt; &lt;td&gt;${deliveryBill[3]}&lt;br&gt;${deliveryBill[4]}&lt;/td&gt; &lt;td id="${deliveryBill[0].id}~${deliveryBill[1]}"&gt;&lt;c:choose&gt; &lt;c:when test="${deliveryBill[0].deliveryState == 8 || (deliveryBill[0].deliveryState == 0 &amp;&amp; deliveryBill[0].gatheringState == 8 )}"&gt; 已完成 &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].deliveryState == 13 || deliveryBill[0].gatheringState == 13}"&gt; 已取消 &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;script type="text/javascript"&gt; getDiffTime('${deliveryBill[0].id}~${deliveryBill[1]}', '${deliveryBill[0].deliveryDate}', '${deliveryBill[0].dsBeginTime}'); &lt;/script&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/td&gt; &lt;td&gt;&lt;c:forEach var="ds" items="${systemType.deliveryState}"&gt; &lt;c:if test="${deliveryBill[0].deliveryState == ds.value}"&gt;${ds.label}&lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;&lt;c:forEach var="ds" items="${systemType.deliveryState}"&gt; &lt;c:if test="${deliveryBill[0].gatheringState == ds.value}"&gt;${ds.label}&lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;tr height="30"&gt; &lt;td colspan="15" align="right"&gt;&lt;c:set value="queryform" var="form_name" scope="request" /&gt; &lt;jsp:include page="/jsp/common/page2.jsp" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;%@ include file="/jsp/common/commontail.jsp"%&gt; &lt;/body&gt; &lt;script&gt; init(); &lt;/script&gt; &lt;/html&gt; &lt;script language="javascript"&gt; var liandong=new CLASS_LIANDONG_YAO(array) liandong.firstSelectChange("根目录","deliveryCenter","${params.centerCD}"); liandong.subSelectChange("deliveryCenter","deliveryUnit","${params.deliveryUnitCD}"); &lt;/script&gt; &lt;script type="text/javascript"&gt; var array=new Array(); &lt;c:set scope="page" var="problemTypeBigSize" value="0"/&gt; &lt;c:set scope="page" var="problemTypeSmallSize" value="0"/&gt; &lt;c:forEach var="billProblemBigType" items="${systemType.billProblemTypeList}" &gt; &lt;c:if test="${billProblemBigType.classlevel==1}" &gt; array[&lt;c:out value='${problemTypeBigSize}'/&gt;]=new Array(); array[&lt;c:out value='${problemTypeBigSize}'/&gt;][0]="&lt;c:out value='${billProblemBigType.code}'/&gt;"; array[&lt;c:out value='${problemTypeBigSize}'/&gt;][1]="根目录"; array[&lt;c:out value='${problemTypeBigSize}'/&gt;][2]="&lt;c:out value='${billProblemBigType.questionDepict}'/&gt;"; &lt;c:set scope="page" var="problemTypeBigSize" value="${problemTypeBigSize+1}"/&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;c:forEach var="billProblemSmallType" items="${systemType.billProblemTypeList}" &gt; &lt;c:if test="${billProblemSmallType.classlevel==2}" &gt; array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;]=new Array(); array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;][0]="&lt;c:out value='${billProblemSmallType.code}'/&gt;"; array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;][1]="&lt;c:out value='${billProblemSmallType.problemType.code}'/&gt;"; array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;][2]="&lt;c:out value='${billProblemSmallType.questionDepict}'/&gt;"; &lt;c:set scope="page" var="problemTypeSmallSize" value="${problemTypeSmallSize+1}"/&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; var liandong=new CLASS_LIANDONG_YAO(array) liandong.firstSelectChange("根目录","billProblemBigType","${params.questionBigCode}"); liandong.subSelectChange("billProblemBigType","billProblemSmallType","${params.questionSmallCode}"); &lt;/script&gt; </pre> <p> </p> <p>感激不尽</p> </div>
mybatis在使用foreach进行List集合查询时,出现sql映射很多问号,不是乱码,就是多了很多问号
近日,在编写Spring Mvc的时候,出现一个特别怪的事情,我正常使用 <select id="findListWithIdsString" resultType="OrderProduct" parameterType="java.util.List"> SELECT <include refid="orderProductOwnColumns"/> a.del_flag AS "delFlag" FROM tbl_order_product a <where> a.del_flag = '0' AND a.id in ('XXXXX','XXXX') </where> </select> 这个是没问题的,但是,当我改为从java传至List的时候,就出问题了,xml代码: <select id="findListWithIdsString" resultType="OrderProduct" parameterType="java.util.List"> SELECT <include refid="orderProductOwnColumns"/> a.del_flag AS "delFlag" FROM tbl_order_product a <where> a.del_flag = '0' <choose> <when test="inComingIds != null and inComingIds.size()>0"> AND a.id in <foreach collection="inComingIds" item="item" index="index" open="(" close=")" separator="," >                  #{item}              </foreach> </when> <otherwise> AND a.id='0' </otherwise> </choose> </where> </select> 然后我的前java端代码是: List<String> idList=new ArrayList<>();//传入的List String opIds=mp.getRelatedOrderProductIds();//前端获取的String Collections.addAll(idList,StringUtils.split(opIds, ","));//转化为List OrderProduct opForSearch=new OrderProduct(); opForSearch.setInComingIds(idList); orderProductService.findListWithIdsString(opForSearch); 数据库配置如下: ?useUnicode=true&characterEncoding=utf-8 出错信息: 2019-05-01 15:28:43,034 DEBUG [modules.sys.dao.OrderProductDao.findListWithIdsString] - ==> Preparing: SELECT a.id AS "id", a.order_id AS "order.id", a.actual_flow_id AS "actualFlowId", a.category_id AS "companyCategory.id", a.parent_order_product_id as "parentOrderProductId", a.price AS "price", a.amount AS "amount", a.product_name AS "productName", a.a_product_name AS "aProductName", a.product_description AS "productDescription", a.delivery_time AS "deliveryTime", a.rate AS "rate", a.is_a_confirm AS "isAConfirm", a.confirm_userid AS "confirmUserid", a.A_confirm_time AS "aConfirmTime", a.order_product_type AS "orderProductType", a.inner_delivery_time AS "innerDeliveryTime", a.companyB_priority AS "companyBPriority", a.companyA_priority AS "companyAPriority", a.order_product_status AS "orderProductStatus", a.product_sn AS "productSn", a.a_product_sn AS "aProductSn", a.source AS "source", a.A_company_id AS "aCompany.id", a.B_company_id AS "bCompany.id", a.take_materiel_status AS "takeMaterielStatus", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", "ORDER_PRODUCT" AS "resourceType", a.remarks AS "remarks", a.down_order_status AS "downOrderStatus", a.batch_number AS "batchNumber", a.closure AS "closure", a.closure_money AS "closureMoney", a.del_flag AS "delFlag" FROM tbl_order_product a WHERE a.del_flag = '0' AND a.id in ( ???????????? ??? ? ???????? ??? , ???????????? ??? ? ???????? ??? ) 2019-05-01 15:28:43,034 DEBUG [modules.sys.dao.OrderProductDao.findListWithIdsString] - ==> Parameters: 54eca8e0409a4f5b81919ecbf7b85d44(String), 4fda20df078945aeaae3960f265795c1(String) 2019-05-01 15:28:43,094 ERROR [500.jsp] - ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ### The error may exist in D:\apache-tomcat-8.0.53-ft\webapps\blanink-web\WEB-INF\classes\mappings\modules\sys\OrderProductDao.xml ### The error may involve com.blanink.business.modules.sys.dao.OrderProductDao.findListWithIdsString-Inline ### The error occurred while setting parameters ### SQL: SELECT a.id AS "id", a.order_id AS "order.id", a.actual_flow_id AS "actualFlowId", a.category_id AS "companyCategory.id", a.parent_order_product_id as "parentOrderProductId", a.price AS "price", a.amount AS "amount", a.product_name AS "productName", a.a_product_name AS "aProductName", a.product_description AS "productDescription", a.delivery_time AS "deliveryTime", a.rate AS "rate", a.is_a_confirm AS "isAConfirm", a.confirm_userid AS "confirmUserid", a.A_confirm_time AS "aConfirmTime", a.order_product_type AS "orderProductType", a.inner_delivery_time AS "innerDeliveryTime", a.companyB_priority AS "companyBPriority", a.companyA_priority AS "companyAPriority", a.order_product_status AS "orderProductStatus", a.product_sn AS "productSn", a.a_product_sn AS "aProductSn", a.source AS "source", a.A_company_id AS "aCompany.id", a.B_company_id AS "bCompany.id", a.take_materiel_status AS "takeMaterielStatus", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", "ORDER_PRODUCT" AS "resourceType", a.remarks AS "remarks", a.down_order_status AS "downOrderStatus", a.batch_number AS "batchNumber", a.closure AS "closure", a.closure_money AS "closureMoney", a.del_flalag AS "delFlag" FROM tbl_order_product a WHERE a.del_flag = '0' AND a.id in ( ???????????? ??? ? ???????? ??? , ???????????? ??? ? ???????? ??? ) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ### The error may exist in D:\apache-tomcat-8.0.53-ft\webapps\blanink-web\WEB-INF\classes\mappings\modules\sys\OrderProductDao.xml ### The error may involve com.blanink.business.modules.sys.dao.OrderProductDao.findListWithIdsString-Inline ### The error occurred while setting parameters ### SQL: SELECT a.id AS "id", a.order_id AS "order.id", a.actual_flow_id AS "actualFlowId", a.category_id AS "companyCategory.id", a.parent_order_product_id as "parentOrderProductId", a.price AS "price", a.amount AS "amount", a.product_name AS "productName", a.a_product_name AS "aProductName", a.product_description AS "productDescription", a.delivery_time AS "deliveryTime", a.rate AS "rate", a.is_a_confirm AS "isAConfirm", a.confirm_userid AS "confirmUserid", a.A_confirm_time AS "aConfirmTime", a.order_product_type AS "orderProductType", a.inner_delivery_time AS "innerDeliveryTime", a.companyB_priority AS "companyBPriority", a.companyA_priority AS "companyAPriority", a.order_product_status AS "orderProductStatus", a.product_sn AS "productSn", a.a_product_sn AS "aProductSn", a.source AS "source", a.A_company_id AS "aCompany.id", a.B_company_id AS "bCompany.id", a.take_materiel_status AS "takeMaterielStatus", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", "ORDER_PRODUCT" AS "resourceType", a.remarks AS "remarks", a.down_order_status AS "downOrderStatus", a.batch_number AS "batchNumber", a.closure AS "closure", a.closure_money AS "closureMoney", a.del_flag AS "delFlag", a.del_flag AS "delFlag" FROM tbl_order_product a WHERE a.del_flag = '0' AND a.id in ( ???????????? ??? ? ???????? ??? , ???????????? ??? ? ???????? ??? ) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399) at com.sun.proxy.$Proxy27.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:205) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
mybatis在使用foreach进行List集合查询时,sql映射时多余问号,网上没有类似问题,求大神指教
近日,在编写Spring Mvc的时候,出现一个特别怪的事情,我正常使用 ``` <select id="findListWithIdsString" resultType="OrderProduct" parameterType="java.util.List"> SELECT <include refid="orderProductOwnColumns"/> a.del_flag AS "delFlag" FROM tbl_order_product a <where> a.del_flag = '0' AND a.id in ('XXXXX','XXXX') </where> </select> ``` 以上这个这个是** 没问题的**,但是,当我改为从java**传值List**的时候,就出问题了,xml代码: ``` <select id="findListWithIdsString" resultType="OrderProduct" parameterType="java.util.List"> SELECT <include refid="orderProductOwnColumns"/> a.del_flag AS "delFlag" FROM tbl_order_product a <where> a.del_flag = '0' <choose> <when test="inComingIds != null and inComingIds.size()>0"> AND a.id in <foreach collection="inComingIds" item="item" index="index" open="(" close=")" separator="," >                  #{item}              </foreach> </when> <otherwise> AND a.id='0' </otherwise> </choose> </where> </select> ``` 然后我的前java端代码是: ``` List<String> idList=new ArrayList<>();//传入的List String opIds=mp.getRelatedOrderProductIds();//前端获取的String Collections.addAll(idList,StringUtils.split(opIds, ","));//转化为List OrderProduct opForSearch=new OrderProduct(); opForSearch.setInComingIds(idList); orderProductService.findListWithIdsString(opForSearch); ``` 数据库配置如下: ``` ?useUnicode=true&characterEncoding=utf-8 ``` 出错信息: ``` 2019-05-01 15:28:43,034 DEBUG [modules.sys.dao.OrderProductDao.findListWithIdsString] - ==> Preparing: SELECT a.id AS "id", a.order_id AS "order.id", a.actual_flow_id AS "actualFlowId", a.category_id AS "companyCategory.id", a.parent_order_product_id as "parentOrderProductId", a.price AS "price", a.amount AS "amount", a.product_name AS "productName", a.a_product_name AS "aProductName", a.product_description AS "productDescription", a.delivery_time AS "deliveryTime", a.rate AS "rate", a.is_a_confirm AS "isAConfirm", a.confirm_userid AS "confirmUserid", a.A_confirm_time AS "aConfirmTime", a.order_product_type AS "orderProductType", a.inner_delivery_time AS "innerDeliveryTime", a.companyB_priority AS "companyBPriority", a.companyA_priority AS "companyAPriority", a.order_product_status AS "orderProductStatus", a.product_sn AS "productSn", a.a_product_sn AS "aProductSn", a.source AS "source", a.A_company_id AS "aCompany.id", a.B_company_id AS "bCompany.id", a.take_materiel_status AS "takeMaterielStatus", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", "ORDER_PRODUCT" AS "resourceType", a.remarks AS "remarks", a.down_order_status AS "downOrderStatus", a.batch_number AS "batchNumber", a.closure AS "closure", a.closure_money AS "closureMoney", a.del_flag AS "delFlag" FROM tbl_order_product a WHERE a.del_flag = '0' AND a.id in ( ???????????? ??? ? ???????? ??? , ???????????? ??? ? ???????? ??? ) 2019-05-01 15:28:43,034 DEBUG [modules.sys.dao.OrderProductDao.findListWithIdsString] - ==> Parameters: 54eca8e0409a4f5b81919ecbf7b85d44(String), 4fda20df078945aeaae3960f265795c1(String) 2019-05-01 15:28:43,094 ERROR [500.jsp] - ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ### The error may exist in D:\apache-tomcat-8.0.53-ft\webapps\blanink-web\WEB-INF\classes\mappings\modules\sys\OrderProductDao.xml ### The error may involve com.blanink.business.modules.sys.dao.OrderProductDao.findListWithIdsString-Inline ### The error occurred while setting parameters ### SQL: SELECT a.id AS "id", a.order_id AS "order.id", a.actual_flow_id AS "actualFlowId", a.category_id AS "companyCategory.id", a.parent_order_product_id as "parentOrderProductId", a.price AS "price", a.amount AS "amount", a.product_name AS "productName", a.a_product_name AS "aProductName", a.product_description AS "productDescription", a.delivery_time AS "deliveryTime", a.rate AS "rate", a.is_a_confirm AS "isAConfirm", a.confirm_userid AS "confirmUserid", a.A_confirm_time AS "aConfirmTime", a.order_product_type AS "orderProductType", a.inner_delivery_time AS "innerDeliveryTime", a.companyB_priority AS "companyBPriority", a.companyA_priority AS "companyAPriority", a.order_product_status AS "orderProductStatus", a.product_sn AS "productSn", a.a_product_sn AS "aProductSn", a.source AS "source", a.A_company_id AS "aCompany.id", a.B_company_id AS "bCompany.id", a.take_materiel_status AS "takeMaterielStatus", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", "ORDER_PRODUCT" AS "resourceType", a.remarks AS "remarks", a.down_order_status AS "downOrderStatus", a.batch_number AS "batchNumber", a.closure AS "closure", a.closure_money AS "closureMoney", a.del_flalag AS "delFlag" FROM tbl_order_product a WHERE a.del_flag = '0' AND a.id in ( ???????????? ??? ? ???????? ??? , ???????????? ??? ? ???????? ??? ) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ### The error may exist in D:\apache-tomcat-8.0.53-ft\webapps\blanink-web\WEB-INF\classes\mappings\modules\sys\OrderProductDao.xml ### The error may involve com.blanink.business.modules.sys.dao.OrderProductDao.findListWithIdsString-Inline ### The error occurred while setting parameters ### SQL: SELECT a.id AS "id", a.order_id AS "order.id", a.actual_flow_id AS "actualFlowId", a.category_id AS "companyCategory.id", a.parent_order_product_id as "parentOrderProductId", a.price AS "price", a.amount AS "amount", a.product_name AS "productName", a.a_product_name AS "aProductName", a.product_description AS "productDescription", a.delivery_time AS "deliveryTime", a.rate AS "rate", a.is_a_confirm AS "isAConfirm", a.confirm_userid AS "confirmUserid", a.A_confirm_time AS "aConfirmTime", a.order_product_type AS "orderProductType", a.inner_delivery_time AS "innerDeliveryTime", a.companyB_priority AS "companyBPriority", a.companyA_priority AS "companyAPriority", a.order_product_status AS "orderProductStatus", a.product_sn AS "productSn", a.a_product_sn AS "aProductSn", a.source AS "source", a.A_company_id AS "aCompany.id", a.B_company_id AS "bCompany.id", a.take_materiel_status AS "takeMaterielStatus", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", "ORDER_PRODUCT" AS "resourceType", a.remarks AS "remarks", a.down_order_status AS "downOrderStatus", a.batch_number AS "batchNumber", a.closure AS "closure", a.closure_money AS "closureMoney", a.del_flag AS "delFlag", a.del_flag AS "delFlag" FROM tbl_order_product a WHERE a.del_flag = '0' AND a.id in ( ???????????? ??? ? ???????? ??? , ???????????? ??? ? ???????? ??? ) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??? '54eca8e0409a4f5b81919ecbf7b85d44' ???????? ??? , ?????' at line 47 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399) at com.sun.proxy.$Proxy27.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:205) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63) ```
page-taglib分页问题
想做个分页,用page-taglib怎么没反应,大家帮忙看下 [size=large][color=red]online waiting...................[/color][/size] 页面: <pg:pager url="databank.do" index="half-full" maxPageItems="10" maxIndexPages="5" isOffset="<%=false%>" export="pageOffset,currentPageNumber=pageNumber" scope="request"> <pg:param name="op" value="queryAll"/> <c:forEach items="${databankList}" var="databank"> <pg:item> ${databank.employee.empName} </pg:item> </c:forEach> </pg:pager> action: public ActionForward queryAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int pagIndex = 1; int pagNum = 20; List<Databank> databankList = this.databankBiz.findDataBankByPage(pagIndex, pagNum); System.out.println("-------------"+databankList.size()); request.setAttribute("databankList", databankList); return mapping.findForward("pagination"); } struts-config.xml: <action path="/databank" type="org.springframework.web.struts.DelegatingActionProxy" name="databankInfo" scope="request" parameter="op"> <forward name="pagination" path="/testPage.jsp"/> </action> spring: <bean name="/databank" class="org.onlineoa.www.web.actions.DataBankAction"> <property name="databankBiz" ref="databankBiz"/> </bean> 为什么会没反应呢??????? 连调用action都没调用到。。。。。到底怎么回事
求助:哪位大神帮我实现下点击修改按钮弹出弹框并且里面自动获取值
我用的是hibernate+springMvc+maven实现的demo想要点击首页列表显示的数据后面的修改按钮可以弹出一个弹框,弹框力量有input文本框 ,弹框出现的时候里面自动有要修改的那一条数据的值 页面: ``` <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html> <html lang="en" class="no-js"> <head> <base href="<%=basePath%>" /> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Sidebar Transitions</title> <meta name="description" content="Sidebar Transitions: Transition effects for off-canvas views" /> <meta name="keywords" content="transition, off-canvas, navigation, effect, 3d, css3, smooth" /> <link rel="stylesheet" type="text/css" href="static/test/css/normalize.css" /> <link rel="stylesheet" type="text/css" href="static/test/css/demo.css" /> <!-- 样式 --> <link rel="stylesheet" type="text/css" href="static/test/css/component.css" /> <link rel="stylesheet" href="static/css/pintuer.css" /> <link rel="stylesheet" href="static/css/admin.css"> <link rel="stylesheet" href="static/css/main.css" type="text/css" /> <script src="static/test/js/modernizr.custom.js"></script> <style> #pop { width: 300px; height: 400px; border: solid 1px #000; position: fixed; left: 50%; top: 50%; margin-left: -150px; margin-top: -200px; border: solid 1px #000; border-radius: 5px; background: #fff; display: none; z-index: 22 } #lightbox { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; filter: alpha(opacity = 50); opacity: .5; display: none } </style> </head> <body id="7" style="background-image: url('static/images/bj3.jpg');"> <div id="st-container" class="st-container"> <!-- example menus these menus will be on top of the push wrapper --> <nav class="st-menu st-effect-11" id="menu-11"> <h2 class="icon icon-lab">Column</h2> <ul> <li><a class="icon icon-group (alias)" href="mian">首页</a></li> <li><a class="icon icon-plus" href="add">增加</a></li> <li><a class="icon icon-edit (alias)" href="#">修改</a></li> <li><a class="icon icon-thumb-tack" href="#">待定</a></li> <li><a class="icon icon-wrench" href="#">测试</a></li> </ul> </nav> <!-- content push wrapper --> <div class="st-pusher" id="5"> <div class="st-content" id="4"> <!-- this is the wrapper for the content --> <div class="st-content-inner" id="3"> <header class="codrops-header"> <h1 style="color: #48a770"> ChenHonest Administrate <span>User information management case</span> </h1> </header> <div class="main clearfix" id="2"> <div id="st-trigger-effects" class="column" style="padding-left: 0px; padding-right: 18px;"> <form action="vague" method="post"> <div class="form-group"> <div class="field"> <div class="input-group"> <span class="addbtn"> <button type="button" class="button bg-green-light icon-search"></button> </span> <input id="vague" type="text" class="input" name="name" size="50" placeholder="用户名关键词" /><span class="addbtn"> <button type="submit" class="button bg-green-light">搜索</button> </span> </div> </div> </div> </form> <br> <table class="table table-hover" style="line-height: 35px; color: #48a770;"> <tr> <th width="400">用户名</th> <th width="600">昵称</th> <th width="200">年龄</th> <th width="1000">操作</th> </tr> <c:if test="${empty list}"> <tr style="height: 340px;"> <td align="center" colspan=4><h3>未找到内容</h3></td> </tr> </c:if> <c:forEach var="item" items="${list}"> <tr id="content"> <th width="400"><a href="con?id=${item.id}">${item.name }</a></th> <th width="600"><a href="upd?id=${item.id}">${item.nice_name }</a></th> <th width="200"><a href="upd?id=${item.id}">${item.age }</a></th> <th width="1000"><a class="button border-dot button-little" href="delete?id=${item.id}" onclick="return confirm('确认删除?')">删除</a> <a class="button border-dot button-little" href="#" onclick="return PopLayer(this)">修改</a></th> </tr> </c:forEach> </table> <br> <div> <ul class="pagination border-mix" style="width: 441px; padding-right: 120px;"> <li class="disabled"><a href="#">«</a></li> <li><a href="#">1</a></li> <li class="active"><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">»</a></li> </ul> </div> <br> <button data-effect="st-effect-11">更多功能</button> </div> <div class="column" style="color: #48a770"> <p>显示内容</p> <p>Here is some inspiration for showing them in style using CSS transitions.</p> <a href="test" class="button border-dot">测试</a> </div> </div> </div> </div> </div> </div> <script src="static/test/js/classie.js"></script> <script src="static/test/js/sidebarEffects.js"></script> <div id="lightbox"></div> <div id="pop"> <form> <table width="100%" border="0" cellpadding="5" cellspacing="5"> <tr> <td colspan="2">修改用户</td> </tr> <tr> <td align="right">用户名:</td> <td><input type="text" name="name" /></td> </tr> <tr> <td align="right">昵 称:</td> <td><input type="text" name="nickname" /></td> </tr> <tr> <td align="right">年 龄:</td> <td><input type="text" name="age" /></td> </tr> <tr> <td colspan="2" align="right"><input type="button" value="保存" /> <input type="button" value="关闭" onclick="PopLayer()" /></td> </tr> </table> </form> </div> <script> var pop = document.getElementById('pop'), popf = pop .getElementsByTagName('form')[0], lightbox = document .getElementById('lightbox') function PopLayer(obj) { lightbox.style.display = pop.style.display = obj ? 'block' : 'none'; if (obj) {//点击修改 var tr = obj.parentNode.parentNode popf.name.value = tr.cells[0].innerHTML popf.nickname.value = tr.cells[1].innerHTML popf.age.value = tr.cells[2].innerHTML } return false } </script> </body> </html> ``` dao层 ``` /* * @(#) usersDaoImpl.java 2015年12月9日 * * Copyright (c) 2015,RongHui Technology. All Rights Reserved. * WWW.RHTECH.NET CONFIDENTIAL */ package com.ronghui.dao; import java.util.List; import javax.annotation.Resource; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.stereotype.Repository; import com.ronghui.model.User; @Repository("usersDao") public class usersDaoImpl implements usersDao { // extends BaseDaoImpl<UserEntity, Integer> @Resource protected SessionFactory sessionFactory; public Session getSession() { return sessionFactory.getCurrentSession(); } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } //显示 @Override public List<User> listInfo() { // TODO Auto-generated method stub String hql="from User"; Query query=(Query)this.getSession().createQuery(hql); List<User> list=query.list(); return list; } public void update(User user){ String hql="update User set age=? ,nice_name=? ,name=?, pwd=?,content=? where id=?"; Query query=this.getSession().createQuery(hql); query.setInteger(0, user.getAge()); query.setString(1, user.getNice_name()); query.setString(2, user.getName()); query.setString(3, user.getPwd()); query.setString(4, user.getPwd()); query.setInteger(5, user.getId()); query.executeUpdate(); } } ``` service层没什么我就不放了 controller ``` /** * */ package com.ronghui.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.ronghui.model.User; import com.ronghui.service.usersService; @Controller public class UserController { @Resource private usersService usersService; private String name; // list显示 @RequestMapping(value = "/mian", method = RequestMethod.GET) public String userlogin(ModelMap model) { List list = usersService.listInfo(); model.addAttribute("list", list); return "mian"; } @RequestMapping("update") public String update(int id, String name, String nice_name, String pwd, int age,String content) { User user = new User(); user.setId(id); user.setName(name); user.setNice_name(nice_name); user.setAge(age); user.setPwd(pwd); user.setContent(content); usersService.update(user); return "redirect:mian"; } } ``` 修改的方法都是可以实现的 就差大神们帮我加个点击就有弹框 类似下面图片的 样式不重要 只要能实现就可以了 拜托各位大神0.0 ![图片说明](https://img-ask.csdn.net/upload/201512/17/1450318143_309578.png) ![图片说明](https://img-ask.csdn.net/upload/201512/17/1450329569_6383.png)
struts2 在action中用List 来接收 checkbox的值,为什么是null?(附上代码和成功的测试程序)
<p>先上传自己写的一个测试程序,是OK的,没有什么问题,action中可以获得checkbox的值: <br><br>index.jsp: </p> <p><br>   &lt;form action="regist_regist.action" method="post"&gt; <br>       &lt;input type="checkbox" name="hobbys" value="篮球"/&gt; <br>       &lt;input type="checkbox" name="hobbys" value="足球"/&gt; <br>       &lt;input type="submit" value="注册"&gt; <br>   &lt;/form&gt;</p> <p> </p> <p>RegistAction.java:</p> <p> </p> <p>public String regist() {<br>  for(int i=0;i&lt;hobbys.size();i++) {<br>   System.out.println(hobbys.get(i));<br>  }<br>  return SUCCESS;<br> }</p> <p> public List getHobbys() {<br>  return hobbys;<br> }</p> <p> public void setHobbys(List hobbys) {<br>  this.hobbys = hobbys;<br> }</p> <p> </p> <p> </p> <p>但是自己要改动的一个项目中采用同样的办法就行不通了.....代码如下:</p> <p> </p> <p>jsp中:</p> <p>通过&lt;c:foreach&gt; 输出了2个:</p> <p>&lt;c:if test="${printLog.printDisuseSign==1}"&gt;<br>        &lt;input type="checkbox" name="printDisuseSign" value="${printLog.printCD}" /&gt;<br>&lt;/c:if&gt;</p> <p> </p> <p>action中:</p> <p> </p> <p>private List printDisuseSign;</p> <p> </p> <p>public List getPrintDisuseSign() {<br>  return printDisuseSign;<br> }</p> <p> </p> <p>public void setPrintDisuseSign(List printDisuseSign) {<br>  this.printDisuseSign = printDisuseSign;<br> }</p> <p>public String printDisuse() {</p> <p>.........</p> <p>    for(int i=0;i&lt;printDisuseSign.size();i++) {<br>          System.out.println(printDisuseSign.get(i));<br>    }</p> <p>........</p> <p>}</p> <p> </p> <p>然后就在for循环中报了个nullporinterException.....有木有大神指点下</p> <p> </p>
提交不了信息???怎么解决
填写完信息点保存没有反应,如果不填信息点保存能够弹出警告,数据库连接没有问题,能够删除学生,添加学生的页面代码如下: ``` <html> <head> <title>${CompanyName}--${ProjectName}</title> <%@ include file="/commons/meta.jsp" %> <script src="script/client_validate.js"></script> <script type="text/javascript"> function addItem() { if (trim(document.getElementById("code").value) == "") { alert("学号不能为空!"); document.getElementById("code").focus(); return; } if (trim(document.getElementById("name").value) == "") { alert("姓名不能为空!"); document.getElementById("name").focus(); return; } if (trim(document.getElementById("sex").value) == "") { alert("性别不能为空!"); document.getElementById("sex").focus(); return; } with (document.getElementById("studentForm")) { method = "post"; action = "student.do?p=save&pageNo=${studentForm.pageNo}"; submit(); } } function goBack() { window.self.location = "student.do?p=list&pageNo=${studentForm.pageNo}"; } </script> </head> <body> <div id="content"> <TABLE cellSpacing="1" cellPadding="2" width="30%" align="center" border="0"> <TBODY> <tr> <td width="522" class="p1" height="25" nowrap><img src="images/mark_arrow_03.gif" width="14" height="14">&nbsp;<b>学生管理&gt;&gt;增加学生</b></td> </tr> </TBODY> </TABLE> <hr width="30%"> <%@ include file="/commons/messages.jsp" %> <form name="studentForm" id="studentForm"> <input type="hidden" name="id" value="${student.id }"> <TABLE class=small cellSpacing="1" cellPadding="2" width="30%" align="center" bgColor="#000000" border="0"> <TBODY> <TR> <TD class=TableLabel width="35%">学号:</TD> <TD class=TableData><input id="code" name="code" size="24" value="${student.code }" class="BigInput" /></TD> </TR> <TR> <TD class=TableLabel>姓名:</TD> <TD class=TableData><input id="name" name="name" size="24" value="${student.name }" class="BigInput" /></TD> </TR> <TR> <TD class=TableLabel>入学时间:</TD> <TD class=TableData><input id="enrollDate" name="enrollDate" size="24" value="${student.enrollDate }" class="BigInput" /></TD> </TR> <TR> <TD class=TableLabel>出生年月:</TD> <TD class=TableData><input id="birthday" name="birthday" size="24" value="${student.birthday }" class="BigInput" /></TD> </TR> <TR> <TD class=TableLabel>性别:</TD> <TD class=TableData> <input type="radio" name="sex" value="男" checked>男 <input type="radio" name="sex" value="女" >女 </TD> </TR> <TR> <TD class=TableLabel width="35%">班级:</TD> <TD class=TableData> <select name="teamId" class="select1" id="teamId"> <option value="" >--请选择--</option> <c:forEach items="${drp:getTeamList()}" var="item" > <c:set var="select" value=""/> <c:if test="${ item.id eq student.team.id }"> <c:set var="select" value="selected"/> </c:if> <option value="${item.id}" ${ select }>${item.name}</option> </c:forEach> </select> </TD> </TR> <TR> <TD class=TableButton colspan=2 align=center> <input type="button" value="保存" class="BigButton" onclick="addItem()"> <input type="button" value="返回" class="BigButton" onClick="goBack()"> </TD> </TR> </TBODY> </TABLE> </form> </div> </body> </html> ![图片说明](https://img-ask.csdn.net/upload/201612/13/1481633807_364722.png) ```
动态规划入门到熟悉,看不懂来打我啊
持续更新。。。。。。 2.1斐波那契系列问题 2.2矩阵系列问题 2.3跳跃系列问题 3.1 01背包 3.2 完全背包 3.3多重背包 3.4 一些变形选讲 2.1斐波那契系列问题 在数学上,斐波纳契数列以如下被以递归的方法定义:F(0)=0,F(1)=1, F(n)=F(n-1)+F(n-2)(n&gt;=2,n∈N*)根据定义,前十项为1, 1, 2, 3...
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
对计算机专业来说学历真的重要吗?
我本科学校是渣渣二本,研究生学校是985,现在毕业五年,校招笔试、面试,社招面试参加了两年了,就我个人的经历来说下这个问题。 这篇文章很长,但绝对是精华,相信我,读完以后,你会知道学历不好的解决方案,记得帮我点赞哦。 先说结论,无论赞不赞同,它本质就是这样:对于技术类工作而言,学历五年以内非常重要,但有办法弥补。五年以后,不重要。 目录: 张雪峰讲述的事实 我看到的事实 为什么会这样 ...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
防劝退!数据结构和算法难理解?可视化动画带你轻松透彻理解!
大家好,我是 Rocky0429,一个连数据结构和算法都不会的蒟蒻… 学过数据结构和算法的都知道这玩意儿不好学,没学过的经常听到这样的说法还没学就觉得难,其实难吗?真难! 难在哪呢?当年我还是个小蒟蒻,初学数据结构和算法的时候,在忍着枯燥看完定义原理,之后想实现的时候,觉得它们的过程真的是七拐八绕,及其难受。 在简单的链表、栈和队列这些我还能靠着在草稿上写写画画理解过程,但是到了数论、图...
【搞定 Java 并发面试】面试最常问的 Java 并发基础常见面试题总结!
本文为 SnailClimb 的原创,目前已经收录自我开源的 JavaGuide 中(61.5 k Star!【Java学习 面试指南】 一份涵盖大部分Java程序员所需要掌握的核心知识。欢迎 Star!)。 另外推荐一篇原创:终极推荐!可能是最适合你的Java学习路线 方法 网站 书籍推荐! Java 并发基础常见面试题总结 1. 什么是线程和进程? 1.1. 何为进程? 进程是程...
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
shell脚本:备份数据库、代码上线
备份MySQL数据库 场景: 一台MySQL服务器,跑着5个数据库,在没有做主从的情况下,需要对这5个库进行备份 需求: 1)每天备份一次,需要备份所有的库 2)把备份数据存放到/data/backup/下 3)备份文件名称格式示例:dbname-2019-11-23.sql 4)需要对1天以前的所有sql文件压缩,格式为gzip 5)本地数据保留1周 6)需要把备份的数据同步到远程备份中心,假如...
iOS Bug 太多,苹果终于坐不住了!
开源的 Android 和闭源的 iOS,作为用户的你,更偏向哪一个呢? 整理 | 屠敏 出品 | CSDN(ID:CSDNnews) 毋庸置疑,当前移动设备操作系统市场中,Android 和 iOS 作为两大阵营,在相互竞争的同时不断演进。不过一直以来,开源的 Android 吸引了无数的手机厂商涌入其中,为其生态带来了百花齐放的盛景,但和神秘且闭源的 iOS 系统相比,不少网友...
神经⽹络可以计算任何函数的可视化证明
《Neural Networks and Deep Learning》读书笔记第四篇本章其实和前面章节的关联性不大,所以大可将本章作为小短文来阅读,当然基本的深度学习基础还是要有的。主要介绍了神经⽹络拥有的⼀种普遍性,比如说不管目标函数是怎样的,神经网络总是能够对任何可能的输入,其值(或者说近似值)是网络的输出,哪怕是多输入和多输出也是如此,我们大可直接得出一个结论:不论我们想要计算什么样的函数,...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
为什么你学不过动态规划?告别动态规划,谈谈我的经验
动态规划难吗?说实话,我觉得很难,特别是对于初学者来说,我当时入门动态规划的时候,是看 0-1 背包问题,当时真的是一脸懵逼。后来,我遇到动态规划的题,看的懂答案,但就是自己不会做,不知道怎么下手。就像做递归的题,看的懂答案,但下不了手,关于递归的,我之前也写过一篇套路的文章,如果对递归不大懂的,强烈建议看一看:为什么你学不会递归,告别递归,谈谈我的经验 对于动态规划,春招秋招时好多题都会用到动态...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
如何安装 IntelliJ IDEA 最新版本——详细教程
IntelliJ IDEA 简称 IDEA,被业界公认为最好的 Java 集成开发工具,尤其在智能代码助手、代码自动提示、代码重构、代码版本管理(Git、SVN、Maven)、单元测试、代码分析等方面有着亮眼的发挥。IDEA 产于捷克,开发人员以严谨著称的东欧程序员为主。IDEA 分为社区版和付费版两个版本。 我呢,一直是 Eclipse 的忠实粉丝,差不多十年的老用户了。很早就接触到了 IDEA...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
为什么要推荐大家学习字节码?
配套视频: 为什么推荐大家学习Java字节码 https://www.bilibili.com/video/av77600176/ 一、背景 本文主要探讨:为什么要学习 JVM 字节码? 可能很多人会觉得没必要,因为平时开发用不到,而且不学这个也没耽误学习。 但是这里分享一点感悟,即人总是根据自己已经掌握的知识和技能来解决问题的。 这里有个悖论,有时候你觉得有些技术没用恰恰是...
互联网公司的裁员,能玩出多少种花样?
裁员,也是一门学问,可谓博大精深!以下,是互联网公司的裁员的多种方法:-正文开始-135岁+不予续签的理由:千禧一代网感更强。95后不予通过试用期的理由:已婚已育员工更有责任心。2通知接下来要过苦日子,让一部分不肯同甘共苦的员工自己走人,以“兄弟”和“非兄弟”来区别员工。3强制996。员工如果平衡不了工作和家庭,可在离婚或离职里二选一。4不布置任何工作,但下班前必须提交千字工作日报。5不给活干+...
【超详细分析】关于三次握手与四次挥手面试官想考我们什么?
在面试中,三次握手和四次挥手可以说是问的最频繁的一个知识点了,我相信大家也都看过很多关于三次握手与四次挥手的文章,今天的这篇文章,重点是围绕着面试,我们应该掌握哪些比较重要的点,哪些是比较被面试官给问到的,我觉得如果你能把我下面列举的一些点都记住、理解,我想就差不多了。 三次握手 当面试官问你为什么需要有三次握手、三次握手的作用、讲讲三次三次握手的时候,我想很多人会这样回答: 首先很多人会先讲下握...
新程序员七宗罪
当我发表这篇文章《为什么每个工程师都应该开始考虑开发中的分析和编程技能呢?》时,我从未想到它会对读者产生如此积极的影响。那些想要开始探索编程和数据科学领域的人向我寻求建议;还有一些人问我下一篇文章的发布日期;还有许多人询问如何顺利过渡到这个职业。我非常鼓励大家继续分享我在这个旅程的经验,学习,成功和失败,以帮助尽可能多的人过渡到一个充满无数好处和机会的职业生涯。亲爱的读者,谢谢你。 -罗伯特。 ...
活到老,学到老,程序员也该如此
全文共2763字,预计学习时长8分钟 图片来源:Pixabay 此前,“网传阿里巴巴要求尽快实现P8全员35周岁以内”的消息闹得沸沸扬扬。虽然很快被阿里辟谣,但苍蝇不叮无缝的蛋,无蜜不招彩蝶蜂。消息从何而来?真相究竟怎样?我们无从而知。我们只知道一个事实:不知从何时开始,程序猿也被划在了“吃青春饭”行业之列。 饱受“996ICU”摧残后,好不容易“头秃了变强了”,即将步入为“高...
Vue快速实现通用表单验证
本文开篇第一句话,想引用鲁迅先生《祝福》里的一句话,那便是:“我真傻,真的,我单单知道后端整天都是CRUD,我没想到前端整天都是Form表单”。这句话要从哪里说起呢?大概要从最近半个月的“全栈工程师”说起。项目上需要做一个城市配载的功能,顾名思义,就是通过框选和拖拽的方式在地图上完成配载。博主选择了前后端分离的方式,在这个过程中发现:首先,只要有依赖jQuery的组件,譬如Kendoui,即使使用...
2019年Spring Boot面试都问了什么?快看看这22道面试题!
Spring Boot 面试题 1、什么是 Spring Boot? 2、Spring Boot 有哪些优点? 3、什么是 JavaConfig? 4、如何重新加载 Spring Boot 上的更改,而无需重新启动服务器? 5、Spring Boot 中的监视器是什么? 6、如何在 Spring Boot 中禁用 Actuator 端点安全性? 7、如何在自定义端口上运行 Sprin...
【图解】记一次手撕算法面试:字节跳动的面试官把我四连击了
字节跳动这家公司,应该是所有秋招的公司中,对算法最重视的一个了,每次面试基本都会让你手撕算法,今天这篇文章就记录下当时被问到的几个算法题,并且每个算法题我都详细着给出了最优解,下面再现当时的面试场景。看完一定让你有所收获 一、小牛试刀:有效括号 大部分情况下,面试官都会问一个不怎么难的问题,不过你千万别太开心,因为这道题往往可以拓展出更多有难度的问题,或者一道题看起来很简单,但是给出最优解,确实很...
关于裁员几点看法及建议
最近网易裁员事件引起广泛关注,昨天网易针对此事,也发了声明,到底谁对谁错,孰是孰非?我们作为吃瓜观众实在是知之甚少,所以不敢妄下定论。身处软件开发这个行业,近一两年来,对...
面试官:关于Java性能优化,你有什么技巧
通过使用一些辅助性工具来找到程序中的瓶颈,然后就可以对瓶颈部分的代码进行优化。 一般有两种方案:即优化代码或更改设计方法。我们一般会选择后者,因为不去调用以下代码要比调用一些优化的代码更能提高程序的性能。而一个设计良好的程序能够精简代码,从而提高性能。 下面将提供一些在JAVA程序的设计和编码中,为了能够提高JAVA程序的性能,而经常采用的一些方法和技巧。 1.对象的生成和大小的调整。 J...
相关热词 c# 时间比天数 c# oracle查询 c# 主动推送 事件 c# java 属性 c# 控制台 窗体 c# 静态类存值 c#矢量作图 c#窗体调用外部程式 c# enum是否合法 c# 如何卸载引用
立即提问