2011-12-01 33 views
3

同時呼籲我的應用程序的第一頁的follwong拋出異常的前綴使用org.apache.jasper.JasperException:功能拆分必須在默認命名空間中沒有指定

org.apache.jasper.JasperException: /WEB-INF/login.jsp(28,21) The function split must be used with a prefix when a default namespace is not specified 
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:148) 
org.apache.jasper.compiler.Validator$ValidateVisitor$1FVVisitor.visit(Validator.java:1478) 
org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:129) 
org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200) 
org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:242) 
org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:56) 
org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200) 
org.apache.jasper.compiler.Validator$ValidateVisitor.validateFunctions(Validator.java:1503) 
org.apache.jasper.compiler.Validator$ValidateVisitor.prepareExpression(Validator.java:1508) 
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:724) 
org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:935) 
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338) 
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388) 
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838) 
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507) 
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338) 
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388) 
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2394) 
org.apache.jasper.compiler.Node$Root.accept(Node.java:489) 
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338) 
org.apache.jasper.compiler.Validator.validate(Validator.java:1737) 
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:178) 
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306) 
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) 
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273) 
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566) 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) 
org.apache.jasper.servlet.JspServlet._serviceJspFile(JspServlet.java:320) 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java) 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) 
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) 
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157) 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927) 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:874) 
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:779) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:690) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147) 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129) 
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:366) 
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:378) 
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) 
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167) 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) 
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 

login .jsp是具有代碼在線28

26 <select id="tnm" name="tnm" > 
    27 <c:forEach items="${temp}" var="i"> 
    28 <option value='${i.split("#")[0]}'>${i.split("#")[1]}</option> 
    29 </c:forEach>      
    30 </select> 

我無法識別爲什麼會引發此異常。任何人都可以告訴我什麼時候拋出這種類型的異常。

回答

6

只有在EL 2.2中支持語法(在參數中調用非getter方法)。您似乎沒有針對支持Servlet 3.0/JSP 2.2/EL 2.2(Tomcat 7,Glassfish 3等)或您的web.xml似乎不符合Servlet 3.0規範的容器。在EL 2.2之前,foo()語法僅被識別爲EL功能,並且應該是這種形式${prefix:functionName(arg1, arg2)}。這也是例外情況試圖告訴你的。

如果你的確不是針對一個Servlet 3.0容器和/或它是不可能改變web.xml符合的Servlet 3.0,那麼你需要JSTL的fn:split()代替(是的,這是一個真正的EL功能):

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
... 
<c:set var="parts" value="${fn:split(i, '#')}" /> 
<option value='${parts[0]}'>${parts[1]}</option> 
+0

在我的情況下,我試圖使用'map.get(foo)'從哈希映射中獲取值 - 但在EL 2.2之前,您必須使用像'map [foo]'這樣的下標。 – z0r

+1

@ z0r:這就是所謂的大括號。另見我們的EL維基頁面:http://stackoverflow.com/tags/el/info – BalusC