如何使用spring标签库是不是需要jar

Posted

技术标签:

【中文标题】如何使用spring标签库是不是需要jar【英文标题】:how to use spring tag library is there any jar needed如何使用spring标签库是否需要jar 【发布时间】:2012-09-18 03:37:33 【问题描述】:

当我在 JSP 中添加标签库时,我得到了这个异常。我正在使用带有 spring-security 的 spring mvc。

我的 JSP:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

     <%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>

    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

    <c:set var="menuSel" value="MenuName" />
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <style type="text/css">
    @import url('resources/css/iCRL/iCRL.css');
    @import url('resources/css/iConfigure/iConfigure.css');
    @import url('resources/css/iConfigure/improvedDropdown.css');
    </style>
    <title>iCMT| iConfigure</title>
    <script>
    var context = "<c:url value=""/>";



    var include="<c:out value="getText('message.include')"/>;
    var exclude="<c:out value="getText('message.exclude')"/>;
    var itemToMove="<c:out value="getText('message.itemToMove')"/>";
    var confirmMsg="<c:out value="getText('message.confirmMsg')"/>";
    var fileReqrd="<c:out value="getText('message.fileRequired')"/>";   
    var textFile="<c:out value="getText('message.textFile')"/>";
    var compareDates="<c:out value="getText('message.compareDates')"/>";
    var validStartDate="<c:out value="getText('message.validStartDate')"/>";
    var validEndDate="<c:out value="getText('message.validEndDate')"/>";
    var selectFilter="<c:out value="getText('message.selectFilter')"/>";
    var FilterText="<c:out value="getText('message.FilterText')"/>";
    var differentCodeType="<c:out value="getText('message.differentCodeType')"/>";
    var validateAssoc="<c:out value="getText('message.validateAssoc')"/>";
    var NotToSearch="<c:out value="getText('message.NotToSearch')"/>";
    var NotToModify="<c:out value="getText('message.NotToModify')"/>";




     </script>
    </head>
    <body>
        <jsp:include page="../admin/pgHeader.jsp" flush="true">
            <jsp:param name="menuSelected" value="iCRL" />
        </jsp:include>
        <script type="text/javascript" src="resources/js/iConfigure/improvedDropDown.js"></script>
        <script type="text/javascript" src="resources/lib/jquery.Multiselect/js/jquery.multiselect.filter.js"></script>
        <div class="main_content_centered">
            <div class="main_content_outer_wrapper">
                <div class="s-content">
                    <div class="clean"></div>

                    <form action="iconfigure" method="post" name="configureForm"
                           value="iconfigure" id="configureForm" target="_self" enctype="multipart/form-data">
                        <div class="section_w1000">
                            <div class="module-info-container">
                                <div class="module-info">
                                    <div class="module-info-icon icfg-upload_icon"></div>
                                    <div class="module-info-content">
                                        <div class="module-info-title"><c:out value="Create Category"/></div>

添加%@taglib uri="http://www.springframework.org/tags" prefix="spring" %&gt;后出现此错误

输入异常报告 消息描述 服务器遇到一个内部错误 () 阻止它完成此请求。 异常

org.apache.jasper.JasperException: /jsp/iConfigure/pgiConfigure.jsp(90,26) 根据TLD或标签文件,标签出的属性值是强制性的

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:236) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:842) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2433) org.apache.jasper.compiler.Node$Root.accept(Node.java:495) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1776) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:211) org.apache.jasper.compiler.Compiler.compile(Compiler.java:360) org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet.java:734) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

【问题讨论】:

【参考方案1】:

这与 Spring MVC 无关。错误消息明确指出 c:out 标记在第 90 行缺少 value 属性。我无法向您显示确切的代码,因为您只发布了 JSP 的前 60 行左右。

【讨论】:

以上是关于如何使用spring标签库是不是需要jar的主要内容,如果未能解决你的问题,请参考以下文章

Spring security JSP 标签——我需要哪些 jars?

如何在改版的spring官网下载jar包问题

如何在 JSF 中使用 Spring Security Facelets 标签库

使用Spring标签库

如何使用 SBT 为库构建分层 JAR 文件?

使用 Spring Security 3.2.0.RELEASE,如何在没有标签库的纯 HTML 页面中获取 CSRF 令牌