包含带有未封闭标签的 jsp 页面的问题
我在包含 jsp 页面时遇到问题。我有一个 JSP 页面,其中我必须没有关闭标签,因为在包含页面时我会继续填充它们并关闭它们。 页面正在包含
<div class="ui-layout-content">
<form id="kartaForm">
<%-- zalozka Budova --%>
<m:zalozka id="tabs-1">
<m:sloupec prvni="true">
<elem:id/>
<elem:string path="typSubjektu" styl="I" />
<elem:boolean path="fyzickaOsobaPodnikatel"/>
<elem:string path="kod" styl="P" />
包含此页面的页面: 这是包含页面的声明
<%@ include file="/jsp/Subjekt/Subjekt/SubjektFormularNew.jsp" %>
,这是页面的其余部分,
</m:sloupec>
<m:sloupec />
</m:zalozka>
</form>
</div>
</div>
因此最终所有标签都被关闭。当我阅读文档时,include 指令只是将文本放入 jsp 页面,然后将其转换为 servlet,但在我的情况下,我得到了标签未关闭的异常。知道如何解决这个问题吗?
更新:
我使用 JSP 和 OracleJDeveloper 作为 IDE 和 spring 这是堆栈跟踪
org.apache.jasper.JasperException: /jsp/Subjekt/PravnickaOsoba/PravnickaOsobaFormularNew.jsp(1,1) /jsp/Subjekt/Subjekt/SubjektFormularNew.jsp(48,16) Unterminated <m:sloupec tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:378)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:486)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99)
I have problem including jsp pages. I have one JSP page where I must have not closed tags because in including page I continue filling them and close them.
Page beeing included
<div class="ui-layout-content">
<form id="kartaForm">
<%-- zalozka Budova --%>
<m:zalozka id="tabs-1">
<m:sloupec prvni="true">
<elem:id/>
<elem:string path="typSubjektu" styl="I" />
<elem:boolean path="fyzickaOsobaPodnikatel"/>
<elem:string path="kod" styl="P" />
Page that include this page:
This is statement that includes page
<%@ include file="/jsp/Subjekt/Subjekt/SubjektFormularNew.jsp" %>
and here is the rest of the page
</m:sloupec>
<m:sloupec />
</m:zalozka>
</form>
</div>
</div>
so finally all tag are closed. And as I read documentation include directive just puts text into jsp page and then it is translated into servlet but in my case I get exception that tags are not closed. Any idea how to solve this?
Update:
I am using JSP and OracleJDeveloper as IDE and spring
and here is the stacktrace
org.apache.jasper.JasperException: /jsp/Subjekt/PravnickaOsoba/PravnickaOsobaFormularNew.jsp(1,1) /jsp/Subjekt/Subjekt/SubjektFormularNew.jsp(48,16) Unterminated <m:sloupec tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:378)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:486)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
它对包含有一些好处Try
<jsp:include page="/jsp/Subjekt/Subjekt/SubjektFormularNew.jsp"/>
it has some benefits against includeJSP 标签就是为此类场景而设计的。将您的 jsp 更改为标签。如果您使用支持 jsp 2.0 的容器,则也可以使用 .tag 文件。如果您只想像这样使用,请尝试使用
jsp:include
JSP tags are made for these kind of scenarios. Change your jsp to a tag. If you are using container supporting jsp 2.0, you can use .tag files too. If you want to just use like this try using
jsp:include