NutzCN Logo
问答 请问beetl中有没有类似include标签的功能
发布于 2484天前 作者 qq_1d84c364 3938 次浏览 复制 上一个帖子 下一个帖子
标签:

sqlA中的where语句sqlA中也用到,能不能定义这个where sql 在sqlA和sqlB都include进来,这个功能在mybatis中有,nutz中怎么搞?

26 回复

sqlA中的where语句sqlB中也用到,能不能定义这个where sql 在sqlA和sqlB都include进来,这个功能在mybatis中有,nutz中怎么搞?

能否麻烦你写个简单的小李子

能看出哪里有错误吗?

/*getEmployeeReadList*/
select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
	<%
	layout("getEmployeeReadListWhere.sql",{
		companyId : companyId,
		loginUserId : loginUserId,
		employeeId : employeeId,
		documentTypeId : documentTypeId,
		labelId : labelId,
		searchText : searchText
	})
	%>
order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc


>>11:08:00:语法错误(PARSER_VIABLE_ERROR):<$ 位于14行 资源:select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
<%
layout("getEmployeeReadListWhere.sql",{
companyId : companyId,
loginUserId : loginUserId,
employeeId : employeeId,
documentTypeId : documentTypeId,
labelId : labelId,
searchText : searchText
})
%>
order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc LIMIT 0, 10
'layout("getEmployeeReadListWhere.sql",{\ncompanyId : companyId,\nloginUserId : loginUserId,\nemployeeId : employeeId,\ndocumentTypeId : documentTypeId,\nlabelId : labelId,\nsearchText : searchText\n})\n\n<$'
11|searchText : searchText

12|})

13|%>

14|order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc LIMIT 0, 10

org.antlr.v4.runtime.NoViableAltException
	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:1567)
	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:491)
	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:412)
	at org.beetl.core.parser.BeetlParser.statement(BeetlParser.java:376)
	at org.beetl.core.parser.BeetlParser.prog(BeetlParser.java:121)
	at org.beetl.core.engine.DefaultTemplateEngine.createProgram(DefaultTemplateEngine.java:56)
	at org.beetl.core.engine.FastRuntimeEngine.createProgram(FastRuntimeEngine.java:18)
	at org.beetl.core.GroupTemplate.loadTemplate(GroupTemplate.java:656)
	at org.beetl.core.GroupTemplate.getTemplateByLoader(GroupTemplate.java:582)
	at org.beetl.core.GroupTemplate.getTemplate(GroupTemplate.java:546)
	at org.nutz.plugins.sqltpl.impl.beetl.BeetlSqlTpl.c(BeetlSqlTpl.java:41)
	at org.nutz.plugins.sqltpl.impl.beetl.BeetlSqlTpl.render(BeetlSqlTpl.java:79)
	at org.nutz.plugins.sqltpl.NutSqlTpl.toPreparedStatement(NutSqlTpl.java:14)
	at org.nutz.dao.impl.sql.NutStatement.forPrint(NutStatement.java:194)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:20)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)[DEBUG] 11:08:00.282 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - 

	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1008)
	at com.easysoft.service.DocumentService.getEmployeePageList(DocumentService.java:221)
	at com.easysoft.controller.ReadController.loadData(ReadController.java:88)
	at com.easysoft.controller.ReadController$FM$loadData$a89cf2d7cdda0ed2302d9c666c6e6cc9.invoke(ReadController.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	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.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.easysoft.MyEncodeProcessor.process(MyEncodeProcessor.java:11)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
[DEBUG] 11:08:00.295 org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:97) - SQLException
java.sql.SQLException: Can not issue empty query.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
	at com.mysql.jdbc.StatementImpl.checkNullOrEmptyQuery(StatementImpl.java:514)
	at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1427)
	at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:217)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:246)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1008)
	at com.easysoft.service.DocumentService.getEmployeePageList(DocumentService.java:221)
	at com.easysoft.controller.ReadController.loadData(ReadController.java:88)
	at com.easysoft.controller.ReadController$FM$loadData$a89cf2d7cdda0ed2302d9c666c6e6cc9.invoke(ReadController.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	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.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.easysoft.MyEncodeProcessor.process(MyEncodeProcessor.java:11)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
[WARN ] 11:08:00.299 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/read/loadData :
org.nutz.dao.DaoException: !Nutz SQL Error: ''
PreparedStatement: 
''
CaseMessage=Can not issue empty query.
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1008)
	at com.easysoft.service.DocumentService.getEmployeePageList(DocumentService.java:221)
	at com.easysoft.controller.ReadController.loadData(ReadController.java:88)
	at com.easysoft.controller.ReadController$FM$loadData$a89cf2d7cdda0ed2302d9c666c6e6cc9.invoke(ReadController.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	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.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.easysoft.MyEncodeProcessor.process(MyEncodeProcessor.java:11)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Can not issue empty query.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
	at com.mysql.jdbc.StatementImpl.checkNullOrEmptyQuery(StatementImpl.java:514)
	at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1427)
	at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:217)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:246)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53)
	... 50 more
page:1
hideMask:true
ip:192.168.2.129
九月 25, 2017 11:08:00 上午 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
javax.el.PropertyNotFoundException: Property 'code' not found on type org.nutz.dao.DaoException
	at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268)
	at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:221)
	at javax.el.BeanELResolver.property(BeanELResolver.java:355)
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:95)
	at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
	at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:943)
	at org.apache.jsp.WEB_002dINF.error.excep_jsp._jspService(excep_jsp.java:180)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.nutz.mvc.NutFilter.nextChain(NutFilter.java:230)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:205)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
	at org.nutz.mvc.view.ForwardView.render(ForwardView.java:72)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

九月 25, 2017 11:08:00 上午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.RuntimeException: org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property 'code' not found on type org.nutz.dao.DaoException
	at org.nutz.lang.Lang.wrapThrow(Lang.java:184)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:52)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property 'code' not found on type org.nutz.dao.DaoException
	at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:555)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.nutz.mvc.NutFilter.nextChain(NutFilter.java:230)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:205)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
	at org.nutz.mvc.view.ForwardView.render(ForwardView.java:72)
	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)
	... 21 more
Caused by: javax.el.PropertyNotFoundException: Property 'code' not found on type org.nutz.dao.DaoException
	at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268)
	at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:221)
	at javax.el.BeanELResolver.property(BeanELResolver.java:355)
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:95)
	at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
	at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:943)
	at org.apache.jsp.WEB_002dINF.error.excep_jsp._jspService(excep_jsp.java:180)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
	... 41 more


我建议你先弄个简单的sql去测试

发现这个getEmployeeReadListWhere.sql找不到啊

select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
	<%layout("getEmployeeReadListWhere.sql",{
		companyId : companyId,
		loginUserId : loginUserId,
		employeeId : employeeId,
		documentTypeId : documentTypeId,
		labelId : labelId
	}){
	%>
	order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc
	<%}%>
[DEBUG] 11:23:29.265 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
getEmployeeReadListWhere.sql LIMIT 0, 10

主要是麻烦帮我看下这个getEmployeeReadListWhere.sql路径该怎么写?

想了想,貌似不行, 默认是StringTemplateResourceLoader

org.nutz.plugins.sqltpl.impl.beetl.BeetlSqlTpl

然后 StringTemplateResourceLoader 只能接受字符串, 不能是文件名,

我想想怎么支持一下

嗯,这个问题还是比较蛋疼的,拜托了

行,我来报一下

<%layout("/resources/getEmployeeReadListWhere.sql",{
companyId : companyId,
loginUserId : loginUserId,
employeeId : employeeId,
documentTypeId : documentTypeId,
labelId : labelId
}){
%>
order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc
<%}%>

[DEBUG] 16:17:50.834 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
/resources/getEmployeeReadListWhere.sql LIMIT 0, 10
[DEBUG] 16:17:50.876 org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:97) - SQLException
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'resources' in 'on clause'
不知道我的路径是否有误

我 的xml中sql配置如下

select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
	<%layout("/resources/getEmployeeReadListWhere.sql",{
		companyId : companyId,
		loginUserId : loginUserId,
		employeeId : employeeId,
		documentTypeId : documentTypeId,
		labelId : labelId
	}){
	%>
	order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc
	<%}%>

resources ? maven 吗?

是maven项目,resources 在classpath下

src/main/resources

放在 src/main/resources/sqls/layout/getEmployeeReadListWhere.sql

然后写

<%layout("/sqls/layout/getEmployeeReadListWhere.sql",{
[DEBUG] 16:28:44.151 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
/sqls/layout/getEmployeeReadListWhere.sql LIMIT 0, 10
[DEBUG] 16:28:44.160 org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:97) - SQLException
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'sqls' in 'on clause'

select distinct a.* from tdocument a
left join tdocumentlabelmap b on a.id = b.documentId
left join tcommonloginuser c on a.createuserid = c.id
	<%layout("/sqls/layout/getEmployeeReadListWhere.sql",{
		companyId : companyId,
		loginUserId : loginUserId,
		employeeId : employeeId,
		documentTypeId : documentTypeId,
		labelId : labelId
	}){
	%>
	order by a.status asc,a.toplevel desc,a.toptime desc,a.createTime desc
	<%}%>

貌你本地测试好的?

要是报文件找不到错误就好了

你用的是最新的代码吗? 在源码里面有testcase, 你可以看看

1.r.62
麻烦你发个地址给我看看

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