包含带有未封闭标签的 jsp 页面的问题

发布于 2024-09-06 21:18:34 字数 5025 浏览 4 评论 0原文

我在包含 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 &lt;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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

も星光 2024-09-13 21:18:34

尝试 它对包含有一些好处

Try <jsp:include page="/jsp/Subjekt/Subjekt/SubjektFormularNew.jsp"/> it has some benefits against include

暖阳 2024-09-13 21:18:34

JSP 标签就是为此类场景而设计的。将您的 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文