NutzCN Logo
问答 今天遇到的奇怪问题,高手看下
发布于 2695天前 作者 wx_2qdej6bq3uup10lk4o79 4630 次浏览 复制 上一个帖子 下一个帖子
标签:
[WARN ] 14:58:36.250 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/gzl/query :
org.apache.catalina.connector.ClientAbortException: java.io.IOException: 您的主机中的软件放弃了一个已建立的连接。
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:356)
	at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:808)
	at org.apache.catalina.connector.OutputBuffer.realWriteChars(OutputBuffer.java:456)
	at org.apache.catalina.connector.OutputBuffer.flushCharBuffer(OutputBuffer.java:813)
	at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:307)
	at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284)
	at org.apache.catalina.connector.Response.flushBuffer(Response.java:541)
	at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:312)
	at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:176)
	at org.nutz.mvc.Mvcs.write(Mvcs.java:294)
	at org.nutz.mvc.view.UTF8JsonView.render(UTF8JsonView.java:68)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:126)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	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:1455)
	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)
Caused by: java.io.IOException: 您的主机中的软件放弃了一个已建立的连接。
	at sun.nio.ch.SocketDispatcher.write0(Native Method)
	at sun.nio.ch.SocketDispatcher.write(Unknown Source)
	at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
	at sun.nio.ch.IOUtil.write(Unknown Source)
	at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
	at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
	at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
	at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1259)
	at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:670)
	at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:450)
	at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:388)
	at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:644)
	at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:121)
	at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:235)
	at org.apache.coyote.Response.doWrite(Response.java:518)
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:351)
	... 60 more
八月 06, 2017 2:58:36 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [default] in context with path [/dqcyc] threw exception [Filtered request failed.] with root cause
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
	at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:472)
	at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:129)
	at com.alibaba.druid.support.http.WebStatFilter$StatHttpServletResponseWrapper.sendError(WebStatFilter.java:342)
	at org.nutz.mvc.view.HttpServerResponse.render(HttpServerResponse.java:181)
	at org.nutz.mvc.view.HttpStatusView.render(HttpStatusView.java:103)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
	at org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:30)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:49)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	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:1455)
	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)
[WARN ] 14:58:42.890 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/gzl/query :
org.apache.catalina.connector.ClientAbortException: java.io.IOException: 您的主机中的软件放弃了一个已建立的连接。
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:356)
	at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:808)
	at org.apache.catalina.connector.OutputBuffer.realWriteChars(OutputBuffer.java:456)
	at org.apache.catalina.connector.OutputBuffer.flushCharBuffer(OutputBuffer.java:813)
	at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:307)
	at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284)
	at org.apache.catalina.connector.Response.flushBuffer(Response.java:541)
	at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:312)
	at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:176)
	at org.nutz.mvc.Mvcs.write(Mvcs.java:294)
	at org.nutz.mvc.view.UTF8JsonView.render(UTF8JsonView.java:68)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:126)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:524)
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:389)
	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254)
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:349)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	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:1455)
	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)
Caused by: java.io.IOException: 您的主机中的软件放弃了一个已建立的连接。
	at sun.nio.ch.SocketDispatcher.write0(Native Method)
	at sun.nio.ch.SocketDispatcher.write(Unknown Source)
	at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
	at sun.nio.ch.IOUtil.write(Unknown Source)
	at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
	at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
	at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
	at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1259)
	at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:670)
	at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:450)
	at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:388)
	at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:644)
	at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:121)
	at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:235)
	at org.apache.coyote.Response.doWrite(Response.java:518)
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:351)
	... 60 more

9 回复

高手看看这是什么问题,

 public void process(ActionContext ac) throws Throwable {
        if (log.isWarnEnabled()) {
            String uri = Mvcs.getRequestPath(ac.getRequest());
            log.warn(String.format("Error@%s :", uri), ac.getError());
        }
        super.process(ac);
    }

错误定位在(FailProcessor.java:28)   ,就是这句: log.warn(String.format("Error@%s :", uri), ac.getError());

想走ajax,结果页面也刷新了?

这是点新增跳转到别一个新页面时出现的问题~~~~

贴页面代码

<%@page import="com.wenyi.bean.GZLDianFei"%>
<%@page import="com.wenyi.bean.Hetong"%>
<%@page import="org.nutz.dao.Cnd"%>
<%@page import="com.wenyi.bean.FmisDept2Dept"%>
<%@page import="com.wenyi.bean.User"%>
<%@page import="org.apache.shiro.subject.Subject"%>
<%@page import="org.apache.shiro.SecurityUtils"%>
<%@page import="com.wenyi.service.UserService"%>
<%@page import="com.wenyi.service.FmisDeptService"%>
<%@page import="com.wenyi.bean.GongzuoliangShenbao"%>
<%@page import="org.nutz.mvc.Mvcs"%>
<%@page import="com.wenyi.service.GongzuoliangShenbaoService"%>
<%@page import="com.wenyi.util.DateUtil"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String monthstr = request.getParameter("monthstr");
if(monthstr==null||"".equals(monthstr))
{
	monthstr= DateUtil.ym.format(new Date());
}
String baoshenxuhao = request.getParameter("baoshenxuhao");
if(baoshenxuhao==null)baoshenxuhao="";
FmisDeptService fmisDeptService = Mvcs.ctx().getDefaultIoc().get(FmisDeptService.class, "fmisDeptService");

UserService userService =Mvcs.ctx().getDefaultIoc().get(UserService.class,"userService");

Subject sub = SecurityUtils.getSubject();

User user = userService.dao().fetchLinks(userService.dao().fetch(User.class, Long.valueOf(sub.getPrincipal().toString())),null);




GongzuoliangShenbaoService gongzuoliangShenbaoService = Mvcs.ctx().getDefaultIoc().get(GongzuoliangShenbaoService.class, "gongzuoliangShenbaoService");

GongzuoliangShenbao shenbao = gongzuoliangShenbaoService.query( user.getProfile().getDept(), 1,monthstr,baoshenxuhao,"伴生气");

List<Hetong> ht = userService.dao().query(Hetong.class, Cnd.where("jssplx","=",1).and("niandu", "=", monthstr.substring(0, 4)));

GZLDianFei dianfei = fmisDeptService.dao().fetch(GZLDianFei.class);
if(dianfei==null)
	dianfei = new GZLDianFei();
%>


<!DOCTYPE html>
<html class=" ">
    <head>
    
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
        <meta charset="utf-8" />
        <title>V1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta content="" name="description" />
        <meta content="" name="author" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        
        <link rel="shortcut icon" href="../assets/images/favicon.png" type="image/x-icon" />    <!-- Favicon -->



        <!-- CORE CSS FRAMEWORK - START -->
        <link href="../assets/plugins/pace/pace-theme-flash.css"  rel="stylesheet" type="text/css" media="screen"/>
        <link href="../assets/plugins/bootstrap/css/bootstrap.min.css"  rel="stylesheet" type="text/css"/>
        <link href="../assets/plugins/bootstrap/css/bootstrap-theme.min.css"  rel="stylesheet" type="text/css"/>
        <link href="../assets/fonts/font-awesome/css/font-awesome.css"  rel="stylesheet" type="text/css"/>
        <link href="../assets/css/animate.min.css"  rel="stylesheet" type="text/css"/>
        <link href="../assets/plugins/perfect-scrollbar/perfect-scrollbar.css"  rel="stylesheet" type="text/css"/>
        <!-- CORE CSS FRAMEWORK - END -->

        <!-- HEADER SCRIPTS INCLUDED ON THIS PAGE - START --> 
        
		<link href="../assets/plugins/datatables/css/jquery.dataTables.css"  rel="stylesheet" type="text/css" media="screen"/>

        <!-- HEADER SCRIPTS INCLUDED ON THIS PAGE - END --> 

<link href="../assets/plugins/jquery-ui/smoothness/jquery-ui.min.css"  rel="stylesheet" type="text/css" media="screen"/>
<link href="../assets/plugins/multi-select/css/multi-select.css"  rel="stylesheet" type="text/css" media="screen"/>

        <!-- CORE CSS TEMPLATE - START -->
        <link href="../assets/css/style.css"  rel="stylesheet" type="text/css"/>
        <link href="../assets/css/responsive.css"  rel="stylesheet" type="text/css"/>
        <!-- CORE CSS TEMPLATE - END -->
 <script src="../assets/js/jquery-2.1.4.min.js"  type="text/javascript"></script> 
	  <script language="javascript" type="text/javascript" src="../assets/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">                                                 
	    var pageNumber = 1;                                                             
	    var pageSize = 10;                                                              
	    var base = '<%=request.getAttribute("base")%>';    
	    function data_reload() {                                                        
	        $.ajax({    
	            url : base + "/gzl/query",                                              
	            data : $("#dt_query_form").serialize(),                                 
	            dataType : "json",                                                      
	            success : function(data) {                                              
	            	 $("#dttable tbody").html("");                                      
	            	for (var i=0;i<data.list.length;i++) {                              
	                    var obj = data.list[i];
	            		var temp = '<tr >'+  
				                   '<th class="text-center">'+(obj.shenbaoxuhao)+'</th>'+
				                   '<th class="text-center">'+(obj.fadiandanwei)+'</th>'+
				                   '<th class="text-center">'+(obj.dept.name)+'</th>'+
				                   '<th class="text-center">'+((obj.kaishiriqi==null?"":obj.kaishiriqi.substring(0,10))+'至'+(obj.jiezhiriqi==null?"":obj.jiezhiriqi.substring(0,10)))+'</th>'+ 
				                   '<th class="text-center">'+(obj.xmlb.mingcheng)+'</th>'+
				                   '<th class="text-center">'+(obj.dianbiaoqishu.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.dianbaozhishu.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.chashu.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.beilv.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.xiaojidianliang.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.xiansun.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.jiesuandianliang.toFixed(2))+'</th>'+	
				                   '<th class="text-center">'+(obj.danjia.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.jiesuanjine.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.shuilv)+'</th>'+
				                   '<th class="text-center">'+(obj.weishuijia.toFixed(2))+'</th>'+
				                   '<th class="text-center">'+(obj.beizhu)+'</th>';
				                        <%
				                    	if(shenbao!=null&&(shenbao.getRstatu()==0||shenbao.getRstatu()==3))
				                    	{
				                    		%>
				                    		temp+='<td nowrap>'+
						                        '<button type="button" class="btn btn-primary btn-xs" onclick="editData('+obj.id+')">修改</button><button onclick="delData('+obj.id+')" type="button" class="btn btn-primary btn-xs" style="margin-left:20px">删除</button>'+
						                        '</td>';
				                    		<%
				                    	}
				                    	%>
				                       
			                    	temp+='</tr>';
			                    	
	                    $("#dttable tbody").append(temp);
	                }
	            	
	            	$("#htlabel").html("共 "+data.pager.recordCount+"条/"+data.pager.pageCount+"页");
	              	//分页
		           	var pn = data.pager.pageCount;
	              	var startp=1;
	              	var endp=data.pager.pageCount;
	              	
	              	startp=data.pager.pageNumber-2;
	              	if(startp<1)
	              		startp=1;
	              	endp = startp+5;
	              	if(endp>pn)
	              		endp=pn;
	              	
		            $('#dtpag').html("");
		            $('#dtpag').append('<li ><a href="#" onclick="goPage(1)">&laquo;</a></li>');
		            if(pn<=5)
		            {
		            	for (j = 1; j <= data.pager.pageCount; j++)
		              	 {
		              		 
		              		 $('#dtpag').append('<li '+(data.pager.pageNumber==j?'class="active"':'')+'><a href="#" onclick="goPage('+j+')">'+j+'</a></li>');
	                     }
		            }else
		            {
		            	if(data.pager.pageNumber>3)
			            	$('#dtpag').append('<li ><a href="#" onclick="void(0);">...</a></li>');
		            	for (j = startp; j <= endp; j++)
		              	 {
		              		 
		              		 $('#dtpag').append('<li '+(data.pager.pageNumber==j?'class="active"':'')+'><a href="#" onclick="goPage('+j+')">'+j+'</a></li>');
	                     }
		            	if(data.pager.pageNumber!=pn)
		            	$('#dtpag').append('<li ><a href="#" onclick="void(0);">...</a></li>');
		            }
	              	 
	              	$('#dtpag').append('<li ><a href="#" onclick="goPage('+pn+')">&raquo;</a></li>');
	            }
	        });
	    }
	    function goPage(page)
	    {
	    	$('#pageNumber').val(page);
	    	data_reload();
	    }

	    $(function() {
	        data_reload();
	    });
       
		function changeniandu()
		{
			var niandu = $('#kjqj').val();
			window.location.href='${base}/menu/gzl_bsq?monthstr='+niandu+'&baoshenxuhao='+$('#searchbsxh').val();
		}
		function addData()
		{
			$('#obj_add_form')[0].reset();
			$('#id').val(0);
			$('#showstatu').val(0);
        	$('#delstatu').val(0);
			$('#section-settings').modal('show');
		}
		function editData(id)
		{
			window.location.href='${base}/menu/tianjiabanshengqi?id='+id;
		}
		function delData(id)
		{
			$.ajax({
			    url : "<%=request.getAttribute("base")%>/gzl/del?id="+id,
			    dataType : "json",
			    success : function(data) {
			        if (data.ok) {
			        	data_reload();
			        } else {
			        	
			            alert(data.msg);
			        }
			    }
			});
		}
		function changeHt()
		{
			window.location.href='${base}/menu/gzl_bsq?monthstr='+$('#kjqj').val()+'&baoshenxuhao='+$('#hetongselect option:selected').attr('bsxh');
		}
		function addDF()
		{
			if($('#hetongselect option:selected').val()==-1)
			{
				alert("请先选择合同");
				return ;
			}
			window.location.href='${base}/menu/tianjiabanshengqi?baoshenxuhao='+$('#hetongselect option:selected').attr('bsxh')+'&monthstr=<%=monthstr%>&userdeptcode=<%=user.getProfile().getDept()%>';
		}
		function tijiaoshenhe()
		{
			$.ajax({
			    url : "${base}/gongzuoliangshenbao/shenbao?shenbaoid=<%=shenbao!=null?shenbao.getId():0%>",
			    dataType : "json",
			    success : function(data) {
			        if (data.ok) {
			        	window.location.href=window.location.href;
			        } else {
			        	
			            alert(data.msg);
			        }
			    }
			});
		}
	</script>
    </head>
    <!-- END HEAD -->

    <!-- BEGIN BODY -->
    <body class=" "><!-- START TOPBAR -->
<jsp:include page="../frame/head.jsp"></jsp:include>
<!-- END TOPBAR -->
<!-- START CONTAINER -->
<div class="page-container row-fluid container-fluid">

    <!-- SIDEBAR - START -->
<jsp:include page="../frame/left.jsp">
	<jsp:param value="/gongzuoliang" name="acdom"/>
</jsp:include>
<!--  SIDEBAR - END -->
    <!-- START CONTENT -->
<section id="main-content" class=" ">
    <section class="wrapper main-wrapper row" style=''>

    <div class='col-xs-12'>
        <div class="page-title">

            <div class="pull-left">
                <!-- PAGE HEADING TAG - START --><h1 class="title">伴生气签认</h1><!-- PAGE HEADING TAG - END -->                            </div>

                            <div class="pull-right hidden-xs">
                    <ol class="breadcrumb">
                        <li>
                            <a href="${base}/menu/main" ><i class="fa fa-home"></i>首页</a>
                        </li>
                        <li class="active">
                            <strong>伴生气签认</strong>
                        </li>
                    </ol>
                </div>
                                
        </div>
    </div>
    <div class="clearfix"></div>
    <!-- MAIN CONTENT AREA STARTS -->
    
<div class="col-lg-12">
    <section class="box ">
            <div class="content-body">          
            <div class="btn-toolbar" role="toolbar">
				
				
				<div class="col-xs-8">
			     <span style="display:inline">合同:</span><select class="form-control" style="width:40%;display:inline" name="hetongselect" id="hetongselect" onchange="changeHt()">
			        	<option value="-1">--请选择--</option>
			        	
			        	<%
			        		for(Hetong h: ht)
			        		{
			        			%>
			        			<option <%=baoshenxuhao.equals(h.getBaoshenxuhao())?" selected=\"selected\"":"" %> value="<%=h.getId()%>" bsxh="<%=h.getBaoshenxuhao()%>"><%=h.getMingcheng() %></option>		
			        			<%
			        		}
			        	%>
			        </select>
			             <label>所属月度:</label>
			                <input type="text" class="Wdate" id="kjqj" style="height:33px" value="<%=monthstr %>" onfocus="WdatePicker({onpicked:function(dp){changeniandu()},dateFmt:'yyyyMM',maxDate:'<%=monthstr%>'})"/>
				
				</div>
            <div class="
            col-xs-4 ">
            
			             <%if(shenbao==null||shenbao.getRstatu()==0||shenbao.getRstatu()==3){ %>
						      <button type="button" class="btn btn-primary"  onclick="addDF()">新增</button>
					     <%} %>
					     
					     <%if(shenbao!=null&&(shenbao.getRstatu()==0||shenbao.getRstatu()==3)) {%>
					     <button type="button" class="btn btn-primary"  style="margin-left:10px" onclick="tijiaoshenhe()">发起审批</button>
					     <%} %>
					     
					     <%if(shenbao!=null&&(shenbao.getRstatu()==2||shenbao.getRstatu()==1)) {%>
					     <button type="button" class="btn btn-primary"  style="margin-left:10px" onclick="window.location.href='${base}/menu/sp_banshengqi?taskid=&shenbaoid=<%=shenbao.getId()%>';">查看审核情况</button>
					     <%} %>
            
            
			    </div>
			</div>
			<p></p> 
			 
			<div class="row">
              <div class="col-md-12">
         

               
                        <div class="row">
       	 			<div class="col-xs-12">
				
					<table class="table table-striped table-bordered" id="dttable" >
		                <thead>
		                    <tr>
		                     	<th class="text-center">报审序号</th>	
		                     	<th class="text-center">合同单位</th>	
		                     	<th class="text-center">基层单位</th>	                        		                        	                        
		                        <th class="text-center">用电日期</th>
		                        <th class="text-center">项目类别</th>
		                        <th class="text-center">电表起数</th>
		                        <th class="text-center">电表止数</th>
		                        <th class="text-center">差数</th>
		                        <th class="text-center">倍率</th>
		                        <th class="text-center">发电电量</th>
		                        <th class="text-center">线损</th>
		                        <th class="text-center">结算电量</th>
		                        <th class="text-center">单价</th>
		                        <th class="text-center">结算金额</th>
		                        <th class="text-center">税率</th>
		                        <th class="text-center">未税价</th>
		                        <th class="text-center">备注</th>
		                        
	                             <%
			                    	if(shenbao!=null&&(shenbao.getRstatu()==0||shenbao.getRstatu()==3))
			                    	{
			                    		%>
			                    		 <th class="text-center">操作</th>
			                    		<%
			                    	}
			                    	%>
		                    </tr>
		                </thead>
		                <tbody>
		                </tbody>
		            </table>
		        </div>
		        <div class="col-xs-12" style="display:none">
			          <form action="#" id="dt_query_form">
							<input type="hidden" name="keyword" value=""/>
							<input type="hidden" name="monthstr" value="<%=monthstr%>"/>
							<input type="hidden" id="searchbsxh" name="baoshenxuhao" value="<%=baoshenxuhao%>"/>
							 <input type="hidden" name="pageNumber" id="pageNumber" value="1"/>
							 <input type="hidden" name="leixing" value="伴生气"/>
							 <input type="hidden" name="pageSize" id="pageSize" value="10000"/>
							<div class="col-lg-4 col-sm-4 col-xs-12 text-center">
							<label style="margin:30px 0;" id="htlabel">共0条</label>
							</div>
							<div class="col-lg-4 col-sm-4 col-xs-12 text-right">
							 		<ul class="pagination" id="dtpag">
							    <li><a href="#">&laquo;</a></li>
							    <li  class="active"><a href="#">1</a></li>
							    <li><a href="#">&raquo;</a></li>
							</ul>
							</div>
					</form>
		    	</div>
    	</div>
    	</div>
    </div>
    </div>
        </section></div>

    </section>
    </section>
    <!-- END CONTENT -->
    <div class="page-chatapi hideit">

    <div class="search-bar">
        <input type="text" placeholder="Search" class="form-control">
    </div>
</div>
    </div>
    <!-- END CONTAINER -->
<!-- LOAD FILES AT PAGE END FOR FASTER LOADING -->


<!-- CORE JS FRAMEWORK - START --> 
<script src="../assets/js/jquery-1.11.2.min.js"  type="text/javascript"></script> 
<script src="../assets/js/jquery.easing.min.js"  type="text/javascript"></script> 
<script src="../assets/plugins/bootstrap/js/bootstrap.min.js"  type="text/javascript"></script> 
<script src="../assets/plugins/pace/pace.min.js"  type="text/javascript"></script>  
<script src="../assets/plugins/perfect-scrollbar/perfect-scrollbar.min.js"  type="text/javascript"></script> 
<script src="../assets/plugins/viewport/viewportchecker.js"  type="text/javascript"></script>  
<script>window.jQuery||document.write('<script src="../assets/js/jquery-1.11.2.min.js"/*tpa=http://jaybabani.com/complete-admin/v4.1/preview/assets/js/jquery-1.11.2.min.js*/><\/script>');</script>
<!-- CORE JS FRAMEWORK - END --> 
<script>
$(document).ready(function() {
$('#obj_add_form').validate({
    focusInvalid: false,
    ignore: "",
    rules: {
        
    	httype: {
            required: true,
        },
        danjia: {
        	
            number:true,
            required: true,
        }

    },
    messages: {
    	danjia: "请输入正确的数字"
      },
    invalidHandler: function(event, validator) {
        //display error alert on form submit    
    },

    errorPlacement: function(label, element) { // render error placement for each input type   
        console.log(label);
        $('<span class="error"></span>').insertAfter(element).append(label)
        var parent = $(element).parent().parent('.form-group');
        parent.removeClass('has-success').addClass('has-error');
    },

    highlight: function(element) { // hightlight error inputs
        var parent = $(element).parent().parent('.form-group');
        parent.removeClass('has-success').addClass('has-error');
    },

    unhighlight: function(element) { // revert the change done by hightlight

    },

    success: function(label, element) {
        var parent = $(element).parent().parent('.form-group');
        parent.removeClass('has-error').addClass('has-success');
    },

    submitHandler: function(form) {
    	$.ajax({
		    url : "<%=request.getAttribute("base")%>/gzl/save",
		    data : $("#obj_add_form").serialize(),
		    dataType : "json",
		    success : function(data) {
		        if (data.ok) {
		        	
		        	$('#section-settings').modal('hide');
		        	data_reload();
		        } else {
		        	
		            alert(data.msg);
		        }
		    }
		});
    }
});
});

</script>

<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - START --> 

<script src="../assets/plugins/datatables/js/jquery.dataTables.min.js"  type="text/javascript"></script>
<script src="../assets/plugins/datatables/extensions/TableTools/js/dataTables.tableTools.min.js"  type="text/javascript"></script>
<script src="../assets/plugins/datatables/extensions/Responsive/js/dataTables.responsive.min.js"  type="text/javascript"></script>
<script src="../assets/plugins/datatables/extensions/Responsive/bootstrap/3/dataTables.bootstrap.js"  type="text/javascript"></script>
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - END --> 
<script src="../assets/plugins/jquery-validation/js/jquery.validate.min.js"  type="text/javascript"></script> <script src="../assets/plugins/jquery-validation/js/additional-methods.min.js"  type="text/javascript"></script> <script src="../assets/js/form-validation.js"  type="text/javascript"></script> 
<script src="../assets/plugins/jquery-ui/smoothness/jquery-ui.min.js"  type="text/javascript"></script> <script src="../assets/plugins/multi-select/js/jquery.multi-select.js"  type="text/javascript"></script> <script src="../assets/plugins/multi-select/js/jquery.quicksearch.js"  type="text/javascript"></script>

<!-- CORE TEMPLATE JS - START --> 
<script src="../assets/js/scripts.js"  type="text/javascript"></script> 
<!-- END CORE TEMPLATE JS - END --> 


<!-- General section box modal start -->
<div class="modal" id="section-settings" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog animated bounceInDown">
        <div class="modal-content">
             <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">合同单价</h4>
            </div>
            <div class="modal-body">
             <form id="obj_add_form" action="javascript:;" novalidate="novalidate">
             <input type="hidden" name="id" id="id" value="0"/>
             <input type="hidden" name="showstatu" id="showstatu"  value="0"/>
			 <input type="hidden" name="delstatu" id="delstatu" value="0"/>
            <div class="row">
 			<div class="col-xs-12">
                                                                                                         
   				<div class="form-group">                                                         
                    <label class="form-label">报审序号</label>                                   
                    <div class="controls">                                                       
                        <input type="text" class="form-control" name="boshenxuhao" id="boshenxuhao"> 
                    </div>                                                                       
                </div>                                                                           
                <div class="form-group">                                                         
                    <label class="form-label">发电单位</label>                                  
                    <div class="controls">                                                       
                        <input type="text" class="form-control" name="fadiandanwei" id="fadiandanwei"> 
                    </div>                                                              
                </div>                                                                        
                <div class="form-group">                                                      
                    <label class="form-label">用电单位</label>                                 
                    <div class="controls">                                                     
                        <input type="text" class="form-control" name="yongdiandanwei" id="yongdiandanwei">
                    </div>
                </div>
                  <div class="form-group">
                    <label class="form-label">用电日期</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="yongdianriqi" id="yongdianriqi">
                    </div>
                </div>
                 <div class="form-group">
                    <label class="form-label">项目类别</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="xiangmuleibie"  id="xiangmuleibie" >
                    </div>
                </div>
                 <div class="form-group">
                    <label class="form-label">上月底数</label>  
                    <div class="controls">
                        <input type="text" class="form-control" name="shangyedishu" id="shangyuedishu" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">本月底数</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="benyuedishu" id="benyuedishu" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">差数</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="chashu" id="chashu" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">互感器倍数</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="beilv" id="beilv" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">小计电量</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="xiaojidianliang" id="xiaojidianliang" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">线损电量</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="xiansun" id="xiansun" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">合计电量</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="jiesuandianliang" id="jiesuandianliang" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">单价</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="danjia" id="danjia" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">电费金额</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="jiesuanjine" id="jiesuanjine" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">备注</label>          
                    <div class="controls">
                        <input type="text" class="form-control" name="beizhu" id="beizhu" >
                    </div>
                </div>
            </div>
		</div>
              </form>  
            </div>
            <div class="modal-footer">
                <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                <button class="btn btn-success" type="button" onclick="$('#obj_add_form').submit();">保存</button>
            </div>
        </div>
    </div>
</div>
<!-- modal end -->
</body>
</html>



	function addDF()
		{
			if($('#hetongselect option:selected').val()==-1)
			{
				alert("请先选择合同");
				return ;
			}
			window.location.href='${base}/menu/tianjiabanshengqi?baoshenxuhao='+$('#hetongselect option:selected').attr('bsxh')+'&monthstr=<%=monthstr%>&userdeptcode=<%=user.getProfile().getDept()%>';
		}
这是新增JS。

submitHandler等用到$.ajax的方法,在$.ajax方法之后加return false;

这是jquery等js的知识,跟后端没关系

哦,明白了,麻烦问下, 为什么要return fales,这个submitHandler的$.ajax方法,其实也没有用到~~

我只是举例

添加回复
请先登陆
回到顶部