我在数据集的sql语句中使用了三元运算符:where mp.id = mbp.planId ${has(bigProjectId)?("and bigProjectId="+bigProjectId):"")} ,报表设计器中也没有增加bigProjectId这个参数,但是我将生成的xml加入工程后启动,点击按钮生成报表,eclipse后台报错:脚本解析错误[E:/eclipse_mars/workspace/tomcat/webapps/project/demos/templates//test//test.xml] Parse error at line 1, column 56. Encountered: ) at bsh.Parser.generateParseException(Parser.java:6248)
at bsh.Parser.jj_consume_token(Parser.java:6200)
at bsh.Parser.Statement(Parser.java:2923)
at bsh.Parser.BlockStatement(Parser.java:3029)
at bsh.Parser.Line(Parser.java:152)
at bsh.Interpreter.Line(Interpreter.java:1337)
at bsh.Interpreter.eval(Interpreter.java:780)
at bsh.Interpreter.eval(Interpreter.java:762)
at bsh.Interpreter.eval(Interpreter.java:1015)
at bsh.Interpreter.eval(Interpreter.java:1005)
at jatools.engine.script.ReportContext.eval(ReportContext.java:241)
at jatools.engine.script.ReportContext.evalTemplate(ReportContext.java:192)
at jatools.data.reader.sql.SqlReader.readStart(SqlReader.java:181)
at jatools.data.reader.sql.SqlReader.getDataset(SqlReader.java:455)
at jatools.data.reader.sql.SqlReader.doRead(SqlReader.java:446)
at jatools.data.reader.AbstractDatasetReader.read(AbstractDatasetReader.java:83)
at jatools.dom.src.DatasetNodeSource.create(DatasetNodeSource.java:70)
at jatools.dom.NodeFactory.createChildNodes(NodeFactory.java:43)
at jatools.dom.ElementBase.getChildElements(ElementBase.java:217)
at jatools.dom.DatasetBasedNode.getLength(DatasetBasedNode.java:352)
at jatools.dom.DatasetBasedNode.getFirstChild(DatasetBasedNode.java:208)
at org.jaxen.dom.DocumentNavigator$1.getFirstNode(DocumentNavigator.java:155)
at org.jaxen.dom.DocumentNavigator$NodeIterator.<init>(DocumentNavigator.java:895)
at org.jaxen.dom.DocumentNavigator$1.<init>(DocumentNavigator.java:152)
at org.jaxen.dom.DocumentNavigator.getChildAxisIterator(DocumentNavigator.java:152)
at org.jaxen.expr.iter.IterableChildAxis.iterator(IterableChildAxis.java:76)
at org.jaxen.expr.DefaultNameStep.evaluate(DefaultNameStep.java:199)
at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:140)
at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:102)
at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:674)
at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:213)
at jatools.dom.src.xpath.XPath.selectNode(XPath.java:39)
at bsh.BSHLiteral.eval(BSHLiteral.java:70)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:113)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:54)
at bsh.BSHAssignment.eval(BSHAssignment.java:77)
at bsh.Interpreter.eval(Interpreter.java:801)
at bsh.Interpreter.eval(Interpreter.java:762)
at bsh.Interpreter.eval(Interpreter.java:1015)
at bsh.Interpreter.eval(Interpreter.java:1005)
at jatools.engine.script.ReportContext.eval(ReportContext.java:241)
at jatools.engine.printer.AbstractPrinter.open(AbstractPrinter.java:248)
at jatools.engine.PrinterFactory.getPrinter(PrinterFactory.java:98)
at jatools.engine.script.Context.getPrinter(Context.java:88)
at jatools.engine.printer.AbstractPrinter.prepareChildPrinters(AbstractPrinter.java:266)
at jatools.engine.printer.AbstractContainerPrinter.preparePrinters(AbstractContainerPrinter.java:226)
at jatools.engine.printer.AbstractContainerPrinter.print(AbstractContainerPrinter.java:180)
at jatools.engine.printer.AbstractContainerPrinter.printChildren(AbstractContainerPrinter.java:144)
at jatools.engine.printer.AbstractContainerPrinter.next(AbstractContainerPrinter.java:264)
at jatools.engine.printer.AbstractContainerPrinter.print(AbstractContainerPrinter.java:201)
at jatools.engine.printer.ReportPrinter.print(ReportPrinter.java:256)
at jatools.engine._Job.generatePage(_Job.java:150)
at jatools.engine._Job.printAsDHTML2(_Job.java:123)
at jatools.engine.ReportJob.printAsDHTML(ReportJob.java:134)
at jatools.tags.ReportTag.writeOut(ReportTag.java:156)
at jatools.tags.ContainerTag.writeOut(ContainerTag.java:78)
at org.apache.jsp.tools.defaultviewer_jsp._jspService(defaultviewer_jsp.java:298)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
at org.apache.jsp.tools.reportviewer_jsp._jspService(reportviewer_jsp.java:92)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at cn.com.checknull.filter.SessionCheckFilter.doFilter(SessionCheckFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at cn.com.checknull.filter.Log4jFormatFilter.doFilter(Log4jFormatFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:724)
1.去掉这个三元运算部分就不会出现这个异常;
2.我在url中传递了bigProjectId=125这个参数值,eclipse后台报错,但是报表显示出来了,查询的是全部的结果,所以bigProjectId这个参数值不起作用。
问题:我该如何处理才能使这个三元运算符部分能够正常使用呢?