当我混合 JSTL 1.0 和 JSTL 1.1 taglib 声明时,它会在我的一些服务器上导致 ParseException,但不是全部。
这是给我带来麻烦的代码块:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="TEXTVARIABLE">|STRINGOFTEXT|</c:set>
<c:set var="OTHERTEXTVARIABLE">${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}</c:set>
这是一个例外:
javax.servlet.jsp.JspException: com.caucho.jsp.JspLineParseException: /WEB-INF/jsp/online/system/modules/com.MYCOMPANY.marketing/templates/common/MY_JSP_PAGE.jsp:1: tag = 'out' / attribute = 'value':解析自定义操作属性“value”时出错,其值为“${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}”:org.apache.taglibs.standard.lang.jstl。 parser.ParseException:不支持 EL 函数。
但是,如果我将核心声明的 URI 更改为http://java.sun.com/jsp/jstl/core
所以这是真正奇怪的部分:出于某种原因,混合 1.0 和 1.1 taglib 声明只会在我的两台服务器上导致异常,我的登台服务器和我的生产服务器。它在我的本地机器或我的开发服务器上完全没有问题。为什么是这样?什么可能导致这种行为差异?这三台服务器的设置和配置极为相似。
JSP 页面由 OpenCMS 提供,我正在使用 Caucho 的 Resin 网络服务器。我知道您不知道我的服务器或 CMS 是如何设置的,但实际上,我正在寻找的是想法。任何想法都会有所帮助,这个问题一直让我非常恼火。即使您不知道可能导致问题的原因,如果您对我如何解决问题有任何建议,那将非常有帮助。我只是不明白是什么导致了我的服务器之间的这种行为差异。
作为参考,这是完整的堆栈跟踪:
javax.servlet.jsp.JspException: com.caucho.jsp.JspLineParseException: /WEB-INF/jsp/online/system/modules/com.MYCOMPANY.marketing/templates/common/MY_JSP_PAGE.jsp:1: tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}": org.apache.taglibs.standard.lang.jstl.parser.ParseException: EL functions are not supported.
at org.opencms.jsp.CmsJspTagInclude.includeActionWithCache(CmsJspTagInclude.java:369)
at org.opencms.jsp.CmsJspTagInclude.includeTagAction(CmsJspTagInclude.java:241)
at org.opencms.jsp.CmsJspTagInclude.doEndTag(CmsJspTagInclude.java:472)
at _jsp._WEB_22dINF._jsp._online._system._modules._com__MYCOMPANY__marketing._templates._MAIN_0PAGE__jsp._jspService(_MAIN_0PAGE__jsp.java:153)
at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
at com.caucho.jsp.Page.pageservice(Page.java:579)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:179)
at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:175)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:485)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:350)
at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:169)
at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:1193)
at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:173)
at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:1227)
at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:1171)
at org.opencms.loader.A_CmsXmlDocumentLoader.load(A_CmsXmlDocumentLoader.java:232)
at org.opencms.loader.CmsXmlContentLoader.load(CmsXmlContentLoader.java:52)
at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:964)
at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1498)
at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.caucho.filters.CmsGzipFilter.doFilter(CmsGzipFilter.java:177)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:277)
at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106)
at com.caucho.server.dispatch.ForwardFilterChain.doFilter(ForwardFilterChain.java:80)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:207)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:514)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520)
at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.caucho.jsp.JspLineParseException: /WEB-INF/jsp/online/system/modules/com.MYCOMPANY.marketing/templates/common/MY_JSP_PAGE.jsp:1: tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${fn:contains(TEXTVARIABLE, '|STRINGOFTEXT|')}": org.apache.taglibs.standard.lang.jstl.parser.ParseException: EL functions are not supported.
at com.caucho.jsp.java.JspNode.error(JspNode.java:1489)
at com.caucho.jsp.java.JspNode.error(JspNode.java:1480)
at com.caucho.jsp.java.JavaJspGenerator.validate(JavaJspGenerator.java:466)
at com.caucho.jsp.JspCompilerInstance.generate(JspCompilerInstance.java:475)
at com.caucho.jsp.JspCompilerInstance.compile(JspCompilerInstance.java:373)
at com.caucho.jsp.JspManager.compile(JspManager.java:233)
at com.caucho.jsp.JspManager.createPage(JspManager.java:177)
at com.caucho.jsp.JspManager.createPage(JspManager.java:157)
at com.caucho.jsp.PageManager.getPage(PageManager.java:248)
at com.caucho.jsp.PageManager.getPage(PageManager.java:166)
at com.caucho.jsp.QServlet.getSubPage(QServlet.java:292)
at com.caucho.jsp.QServlet.getPage(QServlet.java:210)
at com.caucho.server.dispatch.PageFilterChain.compilePage(PageFilterChain.java:206)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:133)
at shared.filter.RemoteAddrFilterBase.doFilter(RemoteAddrFilterBase.java:57)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:175)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:485)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:350)
at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:169)
at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:1193)
at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:173)
at org.opencms.jsp.CmsJspTagInclude.includeActionWithCache(CmsJspTagInclude.java:364)
... 45 more