jsp <c:if>判断问题..... 5C

图片说明

我在jsp中是这样写的,然后后台输出的值是1.
在c:if标签中


这两种写法都不是true,是怎么回事

6个回答

 <c:if test="${resource.getString('Table_Journal')==1}">
 <c:if test="${Table_Theses.equals('1')}">

c:if掉了,补上

 <c:if test="${resource.getString('Table_Journal')=='1'}">

后台只是打印,没有比较。你看看你的值是否可以确认是1?并且前后有没有空格或者别的不可见字符串

输出打印前后加上字符串,看下有没有空格之类的

在<%%>中加上一句:pageContext.setAttribute("Table_Theses", Table_Theses);

就可以了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
JSTL <c:if>标签不生效的诡异问题
jsp中正常引入JSTL标签库: ``` <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ``` 正常写判断语句: ``` <c:forEach items="${list}" var="item" varStatus="sta"> <c:if test="{item.quantity > 0}"> <div>${item.quantity}</div> </c:if> </c:forEach> ``` 无论条件是否满足的情况下,div都不显示内容,这个c:if判断不生效了,求解。
jsp <c:if test=""/>判断求助,在线等。谢谢啦
``` # <c:if test="如何判断?"/> 下面这样写没有效果,应该如何修改? ``` ![图片说明](https://img-ask.csdn.net/upload/201702/16/1487257349_40503.jpg) # <c:if test="如何判断?"/>
c:if 标签的值 的判定问题
<c:if test="${item.yhfj}" item.yhfj 里面可能的值为 null 和 on 注意都是字母 <c:if test="${item.yhfj eq 'null'}" > <font color="#EE4000">丢失</font> </c:if> <c:if test="${item.yhfj eq 'on'}"> <font color="#8FBC8F">正常</font> </c:if> 这样写不行 [b]问题补充:[/b] 下面的2位同学 给出了答案 表示感谢 可是eq 和==是雷同的 另外 c:when没有试验 大家都知道 数据库里(mssql)空值 和null值是不一样的 我的值为null 它就是一个简简单单得null值 (null 可以理解为字符串) 在我的html(jsp)页面,查看源代码得到 <tr class="odd"> <td></td></tr> <tr class="even"> <td></td></tr> 这时我用c:if就判断不出来了
查询页面有个时限字段date类型,如何用jstl,与当前时间比较,判断是否超时?
查询页面,查询列表中有个时限字段:serviceDredgeDate,Date类型的, 我用<fmt:formatDate value="${item.serviceDredgeDate}" pattern="yyyy-MM-dd HH:mm:ss" /> 输出来了。 现在需要增加一个功能,就是判断,这个字段是否过期,与当前时间比较,如果过期,该行用红色 高亮显示。提示用户该单据处理日期超时了。 我尝试了几种都不成功,应该怎样写才能比较时间字段呢? 1. <c:set var="nowDate" value="<%=new Date()%>"></c:set> <c:if test="${nowDate-item.serviceDredgeDate > 0}"> aaaa </c:if> 这样写 报错:javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "java.util.Date" to type "java.lang.Long" 2. <c:set var="nowDate" value="<%=System.currentTimeMillis()%>"></c:set> <c:if test="${nowDate-item.serviceDredgeDate > 0}"> aaaa </c:if> 这样写 报错:javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "java.sql.Timestamp" to type "java.lang.Long" 3. <fmt:formatDate value="${item.serviceDredgeDate}" type="time" timeStyle="long" var="tmp"/> <c:set var="nowDate" value="<%=System.currentTimeMillis()%>"></c:set> <c:if test="${nowDate-tmp > 0}"> aaaa </c:if> 这样写 报错:javax.servlet.jsp.el.ELException: An exception occured trying to convert String "下午04时27分55秒" to type "java.lang.Long" 谁能帮帮我?
jstl的c:set和c:if标签用法
[align=left][/align]比如说我在后来设了request.setAttribute("abc", abc); 在JSP页面里把aaa拿出来怎么拿,, 不要用<%%>这种方式拿 就是说用c:set 还有就是c:if我想判断abc的值是否为空 怎么写 在此先谢过
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>
java.lang.OutOfMemoryError: PermGen space
在服务器中添加一个SSH项目时,服务器运行一段时间后报错。 错误如下: 三月 06, 2017 5:45:50 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in 21784 ms 三月 06, 2017 5:46:35 下午 org.apache.jasper.compiler.TldLocationsCache tldScanJar 信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 三月 06, 2017 6:41:24 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [468] milliseconds. 三月 06, 2017 7:00:53 下午 org.quartz.core.JobRunShell run 严重: Job HtmlChannelJob.HtmlChannelJob8757c397-a53d-4c3d-84a0-929aac8e6db5 threw an unhandled Exception: java.lang.OutOfMemoryError: PermGen space 原服务器中有2个项目,把新加的项目war包直接放入webapps中。运行几个小时后出现了内存溢出的错误。 服务器tomcat配置如下![图片说明](https://img-ask.csdn.net/upload/201703/07/1488857464_691095.png) 新加的SSH项目有 excl导入导出功能,代码如下: ``` package zcib.recruitment.action; import zcib.recruitment.action.utils.UploadFile; import zcib.recruitment.domain.Student; import zcib.recruitment.service.StudentService; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFDataFormat; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.struts2.ServletActionContext; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.interceptor.ServletRequestAware; import com.opensymphony.xwork2.ActionSupport; public class AddStudentAction extends ActionSupport implements ServletRequestAware { private InputStream excelFile; private File uploadFile; private String uploadFileFileName; private StudentService studentService; private Student student; private String verifyCode; private HttpServletRequest request; // 进入页面查询数据 public String listAll() { HttpServletRequest request = ServletActionContext.getRequest(); List<Student> sList = studentService.findAll(); request.setAttribute("list", sList); return "listAll"; } // 导出Excel public String ExcelExport() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); String ids = request.getParameter("ids"); List<Student> list = new ArrayList<Student>(); String[] array = ids.split(","); int[] id = new int[array.length]; for (int i = 0; i < id.length; i++) { Student student = studentService .findById(Integer.valueOf(array[i])); list.add(student); } Workbook workbook = new HSSFWorkbook(); Sheet sheet = workbook.createSheet("学生信息"); Row row = sheet.createRow(0); row.createCell(0).setCellValue("考号"); row.createCell(1).setCellValue("姓名"); row.createCell(2).setCellValue("身份证号"); row.createCell(3).setCellValue("性别"); row.createCell(4).setCellValue("备注"); CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy")); for (int i = 1; i <= list.size(); i++) { Student stu = list.get(i - 1); row = sheet.createRow(i); row.createCell(0).setCellValue(stu.getExamId()); row.createCell(1).setCellValue(stu.getName()); row.createCell(2).setCellValue(stu.getMemberId()); row.createCell(3).setCellValue(stu.getSex()); row.createCell(4).setCellValue(stu.getRemark()); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); workbook.write(baos); excelFile = new ByteArrayInputStream(baos.toByteArray()); baos.close(); return "excel"; } // 导入Excel public String ExcelInto() throws Exception { String directory = "/file"; String targetDirectory = ServletActionContext.getServletContext().getRealPath(directory); File target = UploadFile.Upload(uploadFile, uploadFileFileName,targetDirectory); List<Student> sList = new ArrayList<Student>(); excelFile = new FileInputStream(target); Workbook wb = new HSSFWorkbook(excelFile); Sheet sheet = wb.getSheetAt(0); int rowNum = sheet.getLastRowNum() + 1; for (int i = 1; i < rowNum; i++) { Student student = new Student(); Row row = sheet.getRow(i); int cellNum = row.getLastCellNum(); for (int j = 0; j < cellNum; j++) { Cell cell = row.getCell(j); String cellValue = null; switch (cell.getCellType()) { // 判断excel单元格内容的格式,并对其进行转换,以便插入数据库 case 0: cellValue = String .valueOf((int) cell.getNumericCellValue()); break; case 1: cellValue = cell.getStringCellValue(); break; case 2: cellValue = String .valueOf((int) cell.getNumericCellValue()); break; case 3: cellValue = cell.getStringCellValue(); break; case 4: cellValue = cell.getStringCellValue(); break; } switch (j) {// 通过列数来判断对应插如的字段 case 0: student.setExamId(cellValue); break; case 1: student.setName(cellValue); break; case 2: student.setMemberId(cellValue); break; case 3: student.setSex(Integer.valueOf(cellValue)); break; case 4: student.setRemark(cellValue); } } Student stu = studentService.findByExamId(student.getExamId());//判断数据库中是否拥有重复学生 if(stu==null){ sList.add(student); } } studentService.save(sList); return "success"; } public void setServletRequest(HttpServletRequest request) { this.request = request; } public Student getStudent() { return student; } public void setStudent(Student student) { this.student = student; } public String getVerifyCode() { return verifyCode; } public void setVerifyCode(String verifyCode) { this.verifyCode = verifyCode; } public StudentService getStudentService() { return studentService; } public void setStudentService(StudentService studentService) { this.studentService = studentService; } public InputStream getExcelFile() { return excelFile; } public void setExcelFile(InputStream excelFile) { this.excelFile = excelFile; } public File getUploadFile() { return uploadFile; } public void setUploadFile(File uploadFile) { this.uploadFile = uploadFile; } public String getUploadFileFileName() { return uploadFileFileName; } public void setUploadFileFileName(String uploadFileFileName) { this.uploadFileFileName = uploadFileFileName; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } } ``` struts配置如下: ``` <action name="export_*" class="zcib.recruitment.action.AddStudentAction" method="{1}"> <result name="listAll">/recruitmentInfoList.jsp</result> <result name="success" type="redirect">export_listAll.action</result> <result name="excel" type="stream"> <param name="contentType">application/vnd.ms-excel</param> <param name="contentDisposition">attachment;filename="AllUsers.xls"</param> <param name="inputName">excelFile</param> </result> <result name="pdf" type="stream"> <param name="contentType">application/pdf; charset=gb2312</param> <param name="inputName">excelFile</param> <param name="contentDisposition">attachment; filename="contract.pdf"</param> <param name="bufferSize">2048</param> </result> <result name="word" type="redirect">export_listAll.action</result> </action> ``` 求大神帮忙看一下 内存溢出到底什么问题。
请大佬们看看我上传图片到本地项目然后数据库保存路劲为null是那部分出错了?
接收图片的jsp前端页面 ``` <form method="post" action="PicUpServlet" enctype="multipart/form-data"> <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"> <legend>添加文章</legend> </fieldset> <div class="layui-form-item layui-form-text" > <div class="layui-input-block" style="margin-left: 0px;"> <textarea placeholder="请输入内容" class="layui-textarea"></textarea> </div> </div> <!-- <input type="text" name="content" /><br/> --> <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;" > <legend>添加图片</legend> </fieldset> <div style="margin-left: 8px;"> <input type="file" name="uploadFile"/> </div> <br/><br/> <div style="margin-left: 8px;"> <input type="submit" value="上传" /> </div> </form> ``` 文件保存 ``` package com.gugu.servlet; import java.io.File; import java.io.IOException; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.gugu.dao.WisUploadDao; import com.gugu.pojo.GgNote; import com.gugu.util.Upload; public class PicUpServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final String UPLOAD_DIRECTORY = "C:\\MyBlog-master\\WebContent\\images"; public PicUpServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ").append(request.getContextPath()); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String path = UPLOAD_DIRECTORY+"//images//"+File.separator ; Map<String, String> map = Upload.upload(request, 1024 * 1024 * 10, path); String newFileName ="images"+File.separator+ map.get("newFileName"); GgNote note = new GgNote(); note.setNoteContent(map.get("content")); note.setNotePhoto(newFileName); System.out.println(newFileName); System.out.println(map.get("content")); WisUploadDao add = new WisUploadDao(); add.addwis(note); response.sendRedirect("page/whisper/manage.jsp"); } } ``` 判断文字还是图片 ``` package com.gugu.util; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import com.oreilly.servlet.multipart.FilePart; import com.oreilly.servlet.multipart.MultipartParser; import com.oreilly.servlet.multipart.ParamPart; import com.oreilly.servlet.multipart.Part; public class Upload { public static Map<String, String> upload(HttpServletRequest request,int maxSize, String path) { //以map形式保存数据 key对应保存的是获取界面上的name名称 value保存的是获取界面上的name对应的值 Map<String, String> map = new HashMap<String, String>(); Part part = null; try { MultipartParser mrequest = new MultipartParser(request, maxSize); mrequest.setEncoding("utf-8"); //遍历所有的part组 while ((part = mrequest.readNextPart()) != null) { if (part.isFile()) { //判断是否是文件 FilePart filepart = (FilePart) part;//转化成文件组 String fileName = filepart.getFileName();//得到文件名 if (fileName != null && fileName.length() > 0) { // 取得扩展名 String fileExtName = fileName.substring( fileName.lastIndexOf(".") + 1).toLowerCase(); // 只上传图片 //判断图片上传的格式是否符合 后缀名是否有效 if (fileExtName.equalsIgnoreCase("jpeg") || fileExtName.equalsIgnoreCase("png") || fileExtName.equalsIgnoreCase("jpg") || fileExtName.equalsIgnoreCase("gif") || fileExtName.equalsIgnoreCase("ico") || fileExtName.equalsIgnoreCase("bmp") || fileExtName.equalsIgnoreCase("flv") || fileExtName.equalsIgnoreCase("mp4") || fileExtName.equalsIgnoreCase("mp3")) { /*String newFileName = new Date().getTime() + "."+ fileExtName;//重新改文件名 文件名+扩展名 */ String newFileName =new Date().getTime() +fileName;//不改图片名字 String newPath = path + "/" + newFileName; //文件处理文件上传的路径 File newFile = new File(newPath); filepart.writeTo(newFile); //将文件真正写入到对应的文件夹中 //filepart.getName() 得到 request 要接收的参数的名字 map.put("newFileName", newFileName); map.put(filepart.getName(), newFileName);//把文件信息保存到map中 map.put("newFile", newFile.toString()); } else { map.put("geshi", "geshi"); continue; }// 说明上传的不是图片 } else { map.put("yes","yes"); continue; // 说明没有选择上传图片 } } else if (part.isParam()) { //判断是否是参数 ParamPart paramPart = (ParamPart) part; map.put(paramPart.getName(), paramPart.getStringValue()); } } } catch (IOException e) { e.printStackTrace(); } return map; } } ``` 上传到数据库的文字内容为null 图片保存路劲也为null请问是那部分出错了 控制台报错 ``` java.io.FileNotFoundException: C:\Users\12874\Desktop\毕业设计\MyBlog-master\WebContent\images\images\1572883296157tony_tony_chopper-006.jpg (系统找不到指定的路径。) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at com.oreilly.servlet.multipart.FilePart.writeTo(FilePart.java:166) at com.gugu.util.Upload.upload(Upload.java:50) at com.gugu.servlet.PicUpServlet.doPost(PicUpServlet.java:40) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) images\null null ```
jsp中el表达式问题,急!!!求大神!
我从后台传入一个ArrayList<String>给jsp,然后我要在jsp的foreach循环中判断这个字符串数组中是否包含我的foreach中每次遍历的一个值,应该怎么做。 代码是这样的,后台的ArrayList<String>中有[2,3,4,5],传check给jsp,然后jsp中的代码是这样的: ``` <c:forEach items="${compRole }" var="t" varStatus="index" > <input type="checkbox" id="compRole" name="compRole" value="${t.id }" checked="<c:if test='${fn:contains(check,t.id)}'>checked</c:if>" >&nbsp;${t.name }&nbsp;&nbsp;&nbsp;&nbsp; </c:forEach> ``` 这里我该如何在循环中每次都判断传进来的check中是否包含t.id,如果包含则复选框前打对勾。
SSH整合过程中:service老是注入失败?
action对象是用struts2产生的,但是service老是注入失败,其他的dao注入正常,在action中通过getbean的方式可以正常获得service beans.xml如下: ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <context:annotation-config /> <!-- 分散配置(配置配置文件的位置) --> <context:property-placeholder location= "classpath:jdbc.properties"/> <!-- 生成实例对象要扫描的包,扫描该包,将该包下的注解@Component的类实例化 --> <context:component-scan base-package="com.slg.surveypark.dao.impl,com.slg.surveypark.service.impl,com.slg.surveypark.struts2.action" /> <!-- 配置数据源 --> <bean id="dataSource" destroy-method="close" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driverClassName}" /> <property name="jdbcUrl" value="${jdbc.url}" /> <property name="user" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="maxPoolSize" value="${c3p0.pool.size.max}"/> <property name="minPoolSize" value="${c3p0.pool.size.min}"/> <property name="initialPoolSize" value="${c3p0.pool.size.ini}"/> <property name="acquireIncrement" value="${c3p0.pool.size.increment}"/> </bean> <!--本地会话工程(spring整合 hibernate配置) --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 扫描一下包内的实体类,有@Entity注解与数据库形成映射 --> <property name="packagesToScan"> <list> <value>com.slg.surveypark.model</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <!-- hibernate.hbm2ddl.auto 当为update时根据java对象生成数据库里的表 --> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <aop:config> <aop:pointcut id="bussinessService" expression="execution(* *..*Service.*(..))" /> <aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <!-- 写操作 --> <tx:method name="save*" propagation="REQUIRED" isolation="DEFAULT"/> <tx:method name="update*" propagation="REQUIRED" isolation="DEFAULT"/> <tx:method name="delete*" propagation="REQUIRED" isolation="DEFAULT"/> <tx:method name="batch*" propagation="REQUIRED" isolation="DEFAULT"/> <!-- 读操作 --> <tx:method name="load*" propagation="REQUIRED" isolation="DEFAULT" read-only="true"/> <tx:method name="get*" propagation="REQUIRED" isolation="DEFAULT" read-only="true"/> <tx:method name="find*" propagation="REQUIRED" isolation="DEFAULT" read-only="true"/> <tx:method name="*" propagation="REQUIRED" isolation="DEFAULT" /> </tx:attributes> </tx:advice> </beans> ``` struts.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <!-- 主题 --> <constant name="struts.ui.theme" value="simple" /> <!-- 开发模式 --> <constant name="struts.devMode" value="true" /> <package name="surveypark" namespace="/" extends="struts-default"> <action name="RegAction_*" class="com.slg.surveypark.struts2.action.RegAction" method="{1}"> <result name="regPage">/reg.jsp</result> <result name="input">/reg.jsp</result> <result name="success">/index.jsp</result> </action> </package> </struts> ``` action类 ``` package com.slg.surveypark.struts2.action; import javax.annotation.Resource; import org.apache.struts2.interceptor.validation.SkipValidation; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Scope; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.stereotype.Component; import com.slg.surveypark.model.User; import com.slg.surveypark.service.UserService; import com.slg.surveypark.service.impl.UserServiceImpl; import com.slg.surveypark.util.ValidateUtil; //@Component("regaction") //@Scope("prototype") //@Controller public class RegAction extends BaseAction<User> { /** * */ private static final long serialVersionUID = 1L; private User model = new User(); private String confirmPassword; public String getConfirmPassword() { return confirmPassword; } public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; } protected UserService userService; public UserService getUserService() { return userService; } @Resource(name="userService") public void setUserService(UserService userService) { this.userService = userService; } @Override public User getModel() { // TODO Auto-generated method stub return model; } /** * * 这里添加了注解 @SkipValidation 所以会跳过默认的拦截器函数validate() */ @SkipValidation public String toRegPage(){ return "regPage"; } public String doReg(){ userService.saveEntity(model); return SUCCESS; } /** * struts2的默认验证拦截器,所有的action执行前都会执行此函数,除非有跳过注解,如果验证过程有有问题,则 * 终端action的执行过程,返回到struts2配置的“input”指向的页面 */ public void validate(){ if(!ValidateUtil.isValid(model.getEmail())){ addFieldError("email", "email是必填项!"); } if(!ValidateUtil.isValid(model.getNickName())){ addFieldError("nickname", "nickname是必填项!"); } if(!ValidateUtil.isValid(model.getPassword())){ addFieldError("password", "password是必填项!"); } if(hasErrors()){ return ; } if(!model.getPassword().equals(confirmPassword)){ addFieldError("password", "密码不一致!"); return ; } //通过getBean可以获得service // ApplicationContext ctx = new ClassPathXmlApplicationContext("bean.xml"); // userService = (UserService)ctx.getBean("userService"); System.out.println(userService); if(userService.isRegisted(model.getEmail())){ addFieldError("email", "email已占用!"); return; } } } ``` service类 ``` package com.slg.surveypark.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import com.slg.surveypark.dao.BaseDao; import com.slg.surveypark.model.User; import com.slg.surveypark.service.UserService; import com.slg.surveypark.util.ValidateUtil; @Component("userService") public class UserServiceImpl extends BaseServiceImpl<User> implements UserService { @Resource(name="userDao") public void setDao(BaseDao<User> dao) { super.setDao(dao); } /** * 判断email是否被注册过 */ public boolean isRegisted(String email){ String hql = "select email from User where email =?"; List<User> users = this.findEntityByHQL(hql, email); return ValidateUtil.isValid(users); } } ``` 求指教
在jsp页面用EL表达式如何判断一个变量是否为空
我想判断从数据库中拿到的parentUserAccount是不是为空,然后做是否可编辑的功能,但是这样做报错了: ``` <c:if test="${null==parentUserAccount || '' == parentUserAccount}"> <li><input type="text" id="pa" name="t2" value="${parentUserAccount}"></li> </c:if> <c:if test="${null!=parentUserAccount || '' != parentUserAccount}"> <li><input type="text" id="pa" name="t2" value="${parentUserAccount}" readonly="readonly"></li> </c:if> ``` 请问要怎么样判断啊大神们??
ajax 返回值问题
<script> function yanzheng() { var varify = document.getElementById("verify").value; var code = document.sendMail.code.value; var phone = document.sendMail.phone.value; var number = code+"_"+phone; var cellphone = document.sendMail.cellphone.value; var ajax=new AJAXRequest; ajax.get( "verify.jsp?verify="+varify+"&number="+number+"&cellphone="+cellphone+"&random="+Math.random(), function(obj) { alert(document.getElementById("returnAnswer").value=obj.responseText); //document.getElementById("returnAnswer").innerHTML=obj.responseText; //接受ajax返回的值 if((document.getElementById("returnAnswer").value=obj.responseText)==1){ document.sendMail.operate.value="sure_Click"; document.sendMail.submit(); } else{ document.getElementById("returnAnswer").innerHTML=obj.responseText; } } ); } </script> [code="java"][/code] <input type="button" value="立即呼叫" onclick="yanzheng()" /> <span id="returnAnswer"></span> verify.jsp页面代码: <html> <c:choose> <c:when test="${fn:length(param.number)==13 || fn:length(param.cellphone)==11 }"> <c:choose> <c:when test="${param.verify==sessionScope.rand}"> 1 </c:when> <c:otherwise> <c:out value="验证码错误" /> </c:otherwise> </c:choose> </c:when> <c:otherwise> <c:out value="固话/下灵通 或 移动电话输入错误" /> </c:otherwise> </c:choose> </html>[code="java"][/code] 问题: 我点击button按钮时,跳转到verify.jsp做验证 然后返回值后 判断是否跳转。 如果 verify.jsp 里 我不加<html></html> 则可以正常运行,但是加上之后 返回的值是"<html>1</html>" 如果页面还有其他代码的话 统统返回, 所以判断不成功,但是 在linux下 不加<html></html>的话,返回值是错误的,win 是可以的。 所以现在想 有什么办法 能让 加上<html>后,返回的值还是具体的“1” 而不是“<html>1</html>” 请各位指点一下
<c:if>标签的使用
在jsp页面中,我有一个从后台发过来的值,这样可以取出来${id}, <table url="get.do"> 现在就想知道怎样才能判断如果${id}这里的值为空就直接发送url,如果有值,就添加一个参数?a=${id}
微信公众号jsApi支付问题
**支付目录:**http://testmecom.hhit.com.cn/mecom/micromall/page/wxPrePay.jsp **测试授权目录:**http://testmecom.hhit.com.cn/mecom/micromall/page/ **统一下单支付请求:** <com.trendcom.mecom.micromall.wxpay.model.UnifiedOrderReqData> <appid>****</appid> <mch_id>****</mch_id> <nonce_str>8fu8Z1206x9Bz5270ioAxdD2L23u066T</nonce_str> <sign>54B7F7BA12812F958E97844650543EE2</sign> <body>亲,请仔细核对交易金额,以免失误!</body> <out_trade_no>db331NIA2644817U59o3679891F077O2</out_trade_no> <total_fee>1</total_fee> <spbill_create_ip>219.136.133.131</spbill_create_ip> <notify_url>http://testmecom.hhit.com.cn/mecom/wxpay!notifyUrl.action</notify_url> <trade_type>JSAPI</trade_type> <openid>oneDCuL44fxwh-BNB_aC3xIBvnjA</openid> <product_id>10311106</product_id> </com.trendcom.mecom.micromall.wxpay.model.UnifiedOrderReqData> **统一下单返回结果:** <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> <appid><![CDATA[****]]></appid> <mch_id><![CDATA[****]]></mch_id> <nonce_str><![CDATA[SbGmWWImFwvlh13z]]></nonce_str> <sign><![CDATA[8C123495A6777C95C24D976762F51CFA]]></sign> <result_code><![CDATA[SUCCESS]]></result_code> <prepay_id><![CDATA[wx201507301403575355b478720900716820]]></prepay_id> <trade_type><![CDATA[JSAPI]]></trade_type> </xml> ** h5请求:** function onBridgeReady(appId, timestamp, nonceStr, packages, signType, paySign) { WeixinJSBridge.invoke( 'getBrandWCPayRequest', { "appId": appId, //公众号名称,由商户传入 "timeStamp": timestamp, //时间戳,自1970年以来的秒数 "nonceStr": nonceStr, //随机串 "package": packages, "signType": signType, //微信签名方式: "paySign": paySign //微信签名 }, function (res) { WeixinJSBridge.log(res.err_msg); alert(res.err_msg); ---->get_brand_wcpay_request:fail if (res.err_msg == "get_brand_wcpay_request:ok") { // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。 window.location.href = "${basePath}/mecom/MmOrderAction!findOrderListPageInfo.action?dataType=unsend" } } ); } 问题描述:公众号支付,在客户端使用H5网页端调起支付(jsApi),错误信息:get_brand_wcpay_request:fail,有知道怎么解决这个问题的大神吗?请指教
shiro+ssm项目一启动就报错
第一次使用shiro,遇到好多的问题。项目启动就报错,求大神帮忙看看 ``` 报错信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter': FactoryBean threw exception on object creation; nested exception is org.apache.shiro.config.ConfigurationException: Unable to parse filter chain definition token: at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:173) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1467) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1123) at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:323) at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235) at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.apache.shiro.config.ConfigurationException: Unable to parse filter chain definition token: at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.toNameConfigPair(DefaultFilterChainManager.java:238) at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:145) at org.apache.shiro.spring.web.ShiroFilterFactoryBean.createFilterChainManager(ShiroFilterFactoryBean.java:397) at org.apache.shiro.spring.web.ShiroFilterFactoryBean.createInstance(ShiroFilterFactoryBean.java:437) at org.apache.shiro.spring.web.ShiroFilterFactoryBean.getObject(ShiroFilterFactoryBean.java:343) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:166) ... 35 more Caused by: java.lang.IllegalArgumentException: Filter name not found for filter chain definition token: at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.toNameConfigPair(DefaultFilterChainManager.java:204) ... 40 more ``` ``` Web.xml <display-name></display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:applicationContext-*.xml, classpath:spring-shiro.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- shiro过滤器 --> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:springmvc-servlet.xml, classpath:spring-shiro.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpeg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.mp4</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.eot</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.svg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.ttf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.woff</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.woff2</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.otf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.psd</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.xls</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.properties</param-value> </context-param> <context-param> <param-name>webAppRootKey</param-name> <param-value>SMBMS_C12_12.root</param-value> </context-param> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener> <welcome-file-list> <welcome-file>/WEB-INF/jsp/back/customerprice.jsp</welcome-file> </welcome-file-list> ``` ``` spring-shiro.xml <bean id="myShiroRealm" class="com.rn.Filter.UserRealm"></bean> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="myShiroRealm"></property> <property name="cacheManager" ref="cacheManager" /> </bean> <!-- 用户授权信息Cache --> <bean id="cacheManager" class="org.apache.shiro.cache.MemoryConstrainedCacheManager" /> <bean id="shiroFilter" class="com.rn.Filter.MyShiroFilterFactoryBean"> <property name="securityManager" ref="securityManager"></property> <property name="loginUrl" value="/manager/login"></property> <property name="successUrl" value="/test/homepage"></property> <property name="unauthorizedUrl" value="/test/error"></property> <property name="filterChainDefinitions"> <value> /test/login=anon, <!-- /test/*=authc --> </value> </property> <property name="filters"> <map> <entry key="roles"> <bean class="com.rn.Filter.MyShiroFilter"/> </entry> </map> </property> </bean> <!-- 配置Shiro在Spring中的生命周期的控制操作 --> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/> springmvc-servlet.xml <mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>application/json;charset=UTF-8</value> </list> </property> </bean> <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> <value>application/json</value> </list> </property> <property name="features"> <list> <!-- Date的日期转换器 --> <value>WriteDateUseDateFormat</value> </list> </property> </bean> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> <property name="objectMapper" ref="customObjectMapper"></property> </bean> </mvc:message-converters> </mvc:annotation-driven> <context:component-scan base-package="com.rn.controller,com.rn.dao,com.rn.service,com.rn.service.impl,com.rn.Filter"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <bean id="customObjectMapper" class="com.rn.demo.CustomObjectMapper"></bean> <mvc:resources location="/statics/" mapping="/statics/**"></mvc:resources> <!-- 配置多视图解析器:允许同样的内容数据呈现不同的view --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean> <!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/user/sys/**"/> <bean class="cn.smbms.interceptor.SysInterceptor"/> </mvc:interceptor> </mvc:interceptors> --> <!-- 配置MultipartResolver,用于上传文件,使用spring的CommonsMultipartResolver --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="5000000"/> <property name="defaultEncoding" value="UTF-8"/> </bean> <!-- 配置启用Shiro的注解功能 --> <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"> <property name="proxyTargetClass" value="true"></property> </bean> <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"> <property name="securityManager" ref="securityManager"/> </bean> ``` ``` UserRealm.java public class UserRealm extends AuthorizingRealm { @Autowired private UserService userSer; /** * 每次验证权限执行 */ @Override protected AuthorizationInfo doGetAuthorizationInfo( PrincipalCollection principal) { System.out.println("权限验证"); Subject subject = SecurityUtils.getSubject(); Session session = subject.getSession(); User user = (User) session.getAttribute(Constants.SESSION_USER); List<String> roleIds = userSer.getUserRoleIds(user.getUser_Code()); if (roleIds != null && roleIds.size() > 0) { SimpleAuthorizationInfo info= new SimpleAuthorizationInfo(); for (String roleId : roleIds) { info.addRole(roleId); } return info; } return null; } /** * 每次登陆验证 */ @Override protected AuthenticationInfo doGetAuthenticationInfo( AuthenticationToken authenticationToken) throws AuthenticationException { String user_Name = (String) authenticationToken.getPrincipal(); User user = userSer.getpassword(user_Name); if (user != null) { return new SimpleAuthenticationInfo(user_Name, user.getPassword(), null, getName()); } return null; } } ``` ``` MyShiroFilterFactoryBean.java public class MyShiroFilterFactoryBean extends ShiroFilterFactoryBean { private static final String ROLE_STRING = "roles[{0}]"; private String filterChainDefinitions; @Autowired private RolePermissionService RPService; @Override public void setFilterChainDefinitions(String definitions) { filterChainDefinitions = definitions; Ini ini = new Ini(); ini.load(definitions); Ini.Section section = ini.getSection("urls"); if (CollectionUtils.isEmpty(section)) { section = ini.getSection(""); } List<MenuPermission> menuPermissions=RPService.getMenuPerms(); if (menuPermissions!=null) { for (MenuPermission menuPermission : menuPermissions) { List<String> group_code=menuPermission.getGroup_code(); if (StringUtils.hasLength(menuPermission.getUrl())&&group_code!=null&&group_code.size()>0) { StringBuilder sb = new StringBuilder(); for (String role : group_code) { sb.append(role).append(","); } String str = sb.substring(0, sb.length() - 1); section.put(menuPermission.getUrl(), MessageFormat.format(ROLE_STRING, str)); } } } section.put("/**", "authc"); this.setFilterChainDefinitionMap(section); } public void update() { synchronized (this) { try { AbstractShiroFilter shiroFilter = (AbstractShiroFilter) this .getObject(); PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver) shiroFilter .getFilterChainResolver(); DefaultFilterChainManager manager = (DefaultFilterChainManager) resolver .getFilterChainManager(); manager.getFilterChains().clear(); this.getFilterChainDefinitionMap().clear(); this.setFilterChainDefinitions(filterChainDefinitions); Map<String, String> chains = this.getFilterChainDefinitionMap(); if (!CollectionUtils.isEmpty(chains)) { Iterator var12 = chains.entrySet().iterator(); while (var12.hasNext()) { Map.Entry<String, String> entry = (Map.Entry) var12 .next(); String url = (String) entry.getKey(); String chainDefinition = (String) entry.getValue(); manager.createChain(url, chainDefinition); } } } catch (Exception e) { e.printStackTrace(); } } } } ``` ``` MyShiroFilter.java public class MyShiroFilter extends AuthorizationFilter { /** * 判断用户是否可以放行 */ @Override protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletresponse, Object object) throws Exception { Subject subject=getSubject(servletRequest, servletresponse); String[] roles=(String[])object; if (roles==null||roles.length==0) { return true; } for (String role : roles) { if (subject.hasRole(role)) { return true; } } return false; } } ``` 麻烦各位大神帮忙看一下是怎么回事,这个问题已经折磨我好久了,一直解决不掉,拜托大神,真的很急
为什么两个按钮我随便点击一个按钮都会更新成功,插入按钮我需要的是插入更能而不是更新功能,求大神指教
<%@ page import="com.trs.constants.AuthConstants"%> <%@ page import="org.springframework.validation.FieldError"%> <%@ page language="java" import="java.util.*" pageEncoding="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"> <head> <meta charset="UTF-8"> <title>短信管理-修改短信模板</title> <link rel="stylesheet" type="text/css" href="<%=basePath %>images/smsNewAndUpdatePopup.css" /> <link rel="stylesheet" type="text/css" href="<%=basePath %>images/bootstrap.min.css" /> <script src="<%=basePath %>images/jquery.min.js"></script> <script src="<%=basePath %>images/layer/layer.js"></script> </head> <body> <div class="smsNewAndUpdate_Popup"> <div class="titlePopup_head"> <span>修改短信模板</span> <img src="<%=basePath %>images/cls.jpg" class="titlePopup_head_right" onclick="cancelbtn()"> </div> <div class="smsNewAndUpdate_Popup_con"> <div class="smsNewAndUpdate_Popup_main"> <form class="form-horizontal" id="updateSmsTemp" action="<%=basePath%>smsTemp.do?method=updateSmsTemp" method="post"> <input type="hidden" name="stId" value="${requestScope.mrsSmsTemp.stId}"> <fieldset> <div class="popupInfo_left"> <span>名称:</span><input type="text" placeholder="" class="input-xlarge" value="${requestScope.mrsSmsTemp.tempName}" id="tempName" name="tempName"/><span class="required_Info">*</span> </div> <div class="popupInfo_left"> <span>类型:</span> <div class="drop_down"> <select class="border_clr" id="tempType" name="tempType" value="${requestScope.mrsSmsTemp.tempType}"> <option value="1" <c:if test="${requestScope.mrsSmsTemp.tempType eq '1'}">selected</c:if> >自取</option> <option value="2" <c:if test="${requestScope.mrsSmsTemp.tempType eq '2'}">selected</c:if> >邮寄</option> <option value="3" <c:if test="${requestScope.mrsSmsTemp.tempType eq '3'}">selected</c:if>>打卡</option> </select> </div> </div> <div class="popupInfo_left"> <span>内容:</span> <div class="drop_down"> <select class="border_clr" id="ditchId" name="ditchId" value="${requestScope.mrsSmsTemp.ditchId}"> <option value="0" <c:if test="${requestScope.mrsSmsTemp.ditchId eq '0'}">selected</c:if> >渠道选择</option> <option value="1" <c:if test="${requestScope.mrsSmsTemp.ditchId eq '1'}">selected</c:if> >APP</option> <option value="2" <c:if test="${requestScope.mrsSmsTemp.ditchId eq '2'}">selected</c:if> >网站</option> <option value="3" <c:if test="${requestScope.mrsSmsTemp.ditchId eq '3'}">selected</c:if>>纸媒</option> <option value="4" <c:if test="${requestScope.mrsSmsTemp.ditchId eq '4'}">selected</c:if>>杂志</option> </select> </div> <div class="drop_down"> <select class="border_clr" > <option value="标题">标题</option> <option value="作者">作者</option> <option value="时间">时间</option> </select> </div> <button class="border_clr0" onclick="insert()">插入</button> </div> <div class="popupInfo_left"> <textarea class="ml42 popupInfo_right_area" name="tempContent" id="tempContent" cols="57" rows="7" >${requestScope.mrsSmsTemp.tempContent }</textarea><span class="required_Info1">*</span> </div> <div class="popupInfo_left"> <span>说明:</span> <textarea class="popupInfo_right_area" name="tempDescription" id="tempDescription" cols="57" rows="7">${requestScope.mrsSmsTemp.tempDescription }</textarea> </div> </fieldset> </form> <div class="smsNewAndUpdatePopup_footer"> <button class="news-role-btn-success" onclick="successBtn()">确定</button> <button class="news-role-btn" onclick="cancelbtn()">取消</button> </div> </div> </div> </div> <script type="text/javascript"> function insert() { } //关闭弹出层 function cancelbtn() { var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); } function successBtn(){ var tempName = document.getElementById("tempName").value; var tempContent = document.getElementById("tempContent").value; if(tempName==""){ layer.tips('模板名称不能为空!', '#tempName', { tips: 3 }); }else if(tempContent==""){ layer.tips('模板内容不能为空!', '#tempContent', { tips: 3 }); }else{ document.getElementById("updateSmsTemp").submit(); } } </script> <!-- 判断如果返回了错误信息则显示 --> <c:forEach items="${requestScope.hasError}" var="hasError" > <c:set var="_haserror" scope="page" value="${hasError }"/> </c:forEach> <c:if test="${_haserror!=null}"> <script> layer.tips('${_haserror}', '#tempName', { tips: 3 }); </script> </c:if> <% //如果没有错误信息则代表成功,关闭当前窗口 %> <c:if test="${requestScope.success eq 'success'}"> <script> var index = parent.layer.getFrameIndex(window.name); parent.location.reload(); parent.layer.close(index); </script> </c:if> <script type="text/javascript"> (function($){ $.fn.extend({ insertAtCaret: function(myValue){ var $t=$(this)[0]; if (document.selection) { this.focus(); sel = document.selection.createRange(); sel.text = myValue; this.focus(); } else if ($t.selectionStart || $t.selectionStart == '0') { var startPos = $t.selectionStart; var endPos = $t.selectionEnd; var scrollTop = $t.scrollTop; $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length); this.focus(); $t.selectionStart = startPos + myValue.length; $t.selectionEnd = startPos + myValue.length; $t.scrollTop = scrollTop; } else { this.value += myValue; this.focus(); } } }); })(jQuery); $(".border_clr0").change(function(){ $("#tempContent").insertAtCaret($(this).val()); }); </script> </body> </html>
数据库的数据无法在jsp中显示出来
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="frt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <html> <head> <title>成员列表</title> </head> <body> <form name="frmuser"> <table width="60%" border="1" align="center"> <tr> <td align="left">图书列表&nbsp;&nbsp;&nbsp; <input type="button" name="btnadd" value="添加" onclick="useradd()"> <input type="button" name="btnedit" value="修改" onclick="useredit()"> <input type="button" name="btndelete" value="删除" onclick="userdel()"> </td> </tr> </table> <table width="60%" border="1" align="center"> <tr> <td width="10" align="center">选择</td> <td width="40" align="left">姓名</td> <td width="30" align="left">班级</td> <td width="20" align="right">学号</td> </tr> <c:forEach var="user" items="${userlist}" varStatus="vstatus"> <c:if test="${(vstatus.index)%2 == 0}"> <tr class="tr0"> <td class="td1"> <input type="radio" name="userId" value="${user.userId}"> </td> <td>${user.userName}</td> <td>${user.clazz}</td> <td>${user.userNo}</td> </tr> </c:if> <c:if test="${(vstatus.index)%2 == 1}"> <tr class="tr1"> <td class="td1"> <input type="radio" name="userId" value="${user.userId}"> </td> <td>${user.userName}</td> <td>${user.clazz}</td> <td>${user.userNo}</td> </tr> </c:if> </c:forEach> </table> </form> <script language="JavaScript"> function userdel() { var userids=document.getElementsByName("userId"); var isSelected = false; //循环判断是否有选择的用户 for (i = 0; i<userids.length;i++){ if(userids[i].checked){ isSelected=true; } } if (isSelected){ if (confirm("确认删除选择的用户?")) { document.frmuser.action="${pageContext.request.contextPath}/userDelete"; document.frmuser.submit(); } } else { alert("请先选择用户"); } } function useradd() { document.location.replace("${pageContext.request.contextPath}/toUserAdd"); } function useredit() { var userids=document.getElementsByName("userId"); var isSelected=false; //循环判断是否有选择的用户 for (i = 0; i<userids.length;i++){ if(userids[i].checked){ isSelected=true; } } if (isSelected){ document.frmuser.action="${pageContext.request.contextPath}/toUserEdit"; document.frmuser.submit(); } else { alert("请先选择用户"); } } </script> </body> </html> -------------------------------------下面是数据库的代码------------ ![图片说明](https://img-ask.csdn.net/upload/201812/22/1545473267_247553.png) ---------------------------------------下面是jsp运行截图--------------- ![图片说明](https://img-ask.csdn.net/upload/201812/22/1545473334_280085.png)
为什么我用hibernate创建的对象不被垃圾回收(即使会话过期也不消失)
为什么Hibernate创建的对象不被销毁呢? 如图(1)先用hibernate查询,创建了36(TMain.java)个对象 然后再用jdbc查询如图(2)创建了37(TMain2.java)个对象 系统设置会话过期时间为2分钟 会话过期后如图(3)jdbc创建的对象消失了36个,而hibrenate创建的对象一个也没有消失,并且可以看到CGLIB代理对象也没有消失 这是为什么?小弟不才,没有仔细读过hibernate源代码,对其中原因不明。希望各位帮助解惑,版主请别删贴。 [img]http://yourgame.iteye.com/upload/picture/pic/17123/074d52d8-3774-394b-8a7b-ce26f889dfee.jpg[/img] 图(1) [img]http://yourgame.iteye.com/upload/picture/pic/17121/5c4baf23-28b2-3216-82fc-35f9a23f37ad.jpg[/img] 图(2) [img]http://yourgame.iteye.com/upload/picture/pic/17119/c15ade7d-a0c3-3c25-8afa-962b5eab0c64.jpg[/img] 图(3) WEB.xml [code="xml"]<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet> <servlet-name>service</servlet-name> <servlet-class>org.test.Service</servlet-class> </servlet> <servlet-mapping> <servlet-name>service</servlet-name> <url-pattern>/servlet/service</url-pattern> </servlet-mapping> <session-config> <!-- 这里为了测试,设置session国企时间为2分钟 --> <session-timeout>2</session-timeout> </session-config> </web-app> [/code] Hibernate.cfg.xml (hibernate 配置文件) [code="xml"] <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.username">sa</property> <property name="connection.url">jdbc:jtds:sqlserver://127.0.0.1:1433/fast</property> <property name="dialect">org.hibernate.dialect.SQLServerDialect</property> <property name="myeclipse.connection.profile">jtds</property> <property name="connection.password">yourgame</property> <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> <property name="show_sql">true</property> <mapping resource="org/test/TMain.hbm.xml" /> </session-factory> </hibernate-configuration> [/code] Service.java [code="java"] package org.test; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.hibernate.Session; @SuppressWarnings("serial") public class Service extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String method = request.getParameter("method"); List list = null; if (method.equals("hibernate")) { // 判断查询的方式 list = this.hibernate(request, response); } if (method.equals("jdbc")) { list = this.jdbc(request, response); } request.setAttribute("list", list); //将查询的结果集放入request中 request.getRequestDispatcher("/index.jsp").forward(request, response); } /** * 2008-7-1-上午11:05:41 * * 功能:通过Hibernate来查询对象返回集合 * */ private List hibernate(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Session session = HibernateUtils.getSession(); session.beginTransaction(); List list = session.createQuery("from TMain").list(); session.getTransaction().commit(); HibernateUtils.closeSession(session); return list; } /** * 2008-7-1-上午11:06:20 * * 功能:通过jdbc查询对象返回集合,Utils.list()方法将结果集封装成javabean * */ private List jdbc(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { return Utils.list(new TMain2(), "t_main", null, new Conn()); } } [/code] TMain.java (这个javabean用户Hibernate映射) [code="java"]package org.test; public class TMain implements java.io.Serializable { private Integer id; private String uuid; 其他字段和setter,getter() 略……… TMain2.java(和TMain.java 一样,这个javabean用于jdbc结果集封装) [/code] [b]问题补充:[/b] package com.bjsxt.hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class HibernateUtils { private static SessionFactory factory; private HibernateUtils() { } static { Configuration cfg = new Configuration().configure(); factory = cfg.buildSessionFactory(); } public static SessionFactory getSessionFactory() { return factory; } public static Session getSession() { return factory.openSession(); } public static void closeSession(Session session) { if (session != null) { if (session.isOpen()) { session.close(); } } } } [b]问题补充:[/b] 请问wangxin0072000 您指的是不是spring的OpenSessionInView ??? [b]问题补充:[/b] 请问wangxin0072000: OpenSessionInView 的作用就是把hiernate的Session保持到页面或者说保持到请求完成后再关闭吗? [b]问题补充:[/b] 请问请问wangxin0072000: 我按照您说的调用System.gc(); 效果可以,但是还有一些对象没有消失,org.test.TMain$$BulkBeanByCGLIB$$6d008257 org.test.TMain$$FastClassByCGLIB$$2519251b org.test.Service org.test.TMain 以上类的实例都还存在一个实例不被回收,请问这是什么原因呢? [b]问题补充:[/b] 请问wangxin0072000 按照您说的调用System.gc()方法很凑效,对象大部分都消失了 但是还有四个实例不被回收 分别是 org.test.TMain (1个) org.test.Service (1个) org.test.TMain$$FastClassByCGLIB$$2519251b (1个) org.test.TMain$$BulkBeanByCGLIB$$6d008257 (1个) 无论我调用多少次System.gc() 这些对象也不会被回收 请您帮助
jsp中进行判断的问题,抛出空指针异常
源代码如下,是未经判断的情况,产生了空指针异常,报错的下面第二句话,现在的情况是有附件是不报错,无附件是就报错(ps. file代指附件) ``` <s:set var="file" value="mailInfoFB.file" scope="page"></s:set> <%fileName = ((String)pageContext.getAttribute("file")).split(","); %> <tr id="addedfujian"> <td></td> <td colspan="2"> <c:if test="${file != null}"> <!--附件列表开始--> <div class="attachment"> <div class="att_mail"><strong>附件(<%=fileName.length %>个)</strong></div> <div class="att_table"> <table border="0" cellpadding="0" cellspacing="0"> <%for(int i = 0;i<fileName.length;i++) {%> <tr><td style="text-align: left;"><%=fileName[i]%></td><td style="text-align: left;"><span style="color: #7D7D7D;"></span></td><td style="text-align: left;"> <input type="button" onclick="$('#fileName').attr('value','<%=fileName[i] %>');$('#folderType').attr('value','${ft}');$('#downloadform').submit();" value="下载"> </td></tr> <%} %> </table> </div> </div> <!--附件列表结束--> </c:if> </td> </tr> ```
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
开源一个功能完整的SpringBoot项目框架
福利来了,给大家带来一个福利。 最近想了解一下有关Spring Boot的开源项目,看了很多开源的框架,大多是一些demo或者是一个未成形的项目,基本功能都不完整,尤其是用户权限和菜单方面几乎没有完整的。 想到我之前做的框架,里面通用模块有:用户模块,权限模块,菜单模块,功能模块也齐全了,每一个功能都是完整的。 打算把这个框架分享出来,供大家使用和学习。 为什么用框架? 框架可以学习整体
源码阅读(19):Java中主要的Map结构——HashMap容器(下1)
(接上文《源码阅读(18):Java中主要的Map结构——HashMap容器(中)》) 3.4.4、HashMap添加K-V键值对(红黑树方式) 上文我们介绍了在HashMap中table数组的某个索引位上,基于单向链表添加新的K-V键值对对象(HashMap.Node&lt;K, V&gt;类的实例),但是我们同时知道在某些的场景下,HashMap中table数据的某个索引位上,数据是按照红黑树
c++制作的植物大战僵尸,开源,一代二代结合游戏
    此游戏全部由本人自己制作完成。游戏大部分的素材来源于原版游戏素材,少部分搜集于网络,以及自己制作。 此游戏为同人游戏而且仅供学习交流使用,任何人未经授权,不得对本游戏进行更改、盗用等,否则后果自负。 目前有六种僵尸和六种植物,植物和僵尸的动画都是本人做的。qq:2117610943 开源代码下载 提取码:3vzm 点击下载--&gt; 11月28日 新增四种植物 统一植物画风,全部修
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
深度学习图像算法在内容安全领域的应用
互联网给人们生活带来便利的同时也隐含了大量不良信息,防范互联网平台有害内容传播引起了多方面的高度关注。本次演讲从技术层面分享网易易盾在内容安全领域的算法实践经验,包括深度学习图
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程实用技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法,并会持续更新。
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
"狗屁不通文章生成器"登顶GitHub热榜,分分钟写出万字形式主义大作
GitHub 被誉为全球最大的同性交友网站,……,陪伴我们已经走过 10+ 年时间,它托管了大量的软件代码,同时也承载了程序员无尽的欢乐。 万字申请,废话报告,魔幻形式主义大作怎么写?兄dei,狗屁不通文章生成器了解一下。这个富有灵魂的项目名吸引了众人的目光。项目仅仅诞生一周,便冲上了GitHub趋势榜榜首(Js中文网 -前端进阶资源教程)、是榜首哦
推荐几款比较实用的工具,网站
1.盘百度PanDownload 这个云盘工具是免费的,可以进行资源搜索,提速(偶尔会抽风????) 不要去某站买付费的???? PanDownload下载地址 2.BeJSON 这是一款拥有各种在线工具的网站,推荐它的主要原因是网站简洁,功能齐全,广告相比其他广告好太多了 bejson网站 3.二维码美化 这个网站的二维码美化很好看,网站界面也很...
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问