Why am I getting a JasperException that attribute test does not accept any expressions using JSTL?
Especially when you see an example that uses uses expressions in the test attribute of the <c:if ..> tag like so:
<c:if test="${not empty param.lang}">
<fmt:setLocale scope="session" value="${param.lang}"/>
</c:if>
Here's the simple solution that works:
Instead of using the following declaration:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
use this one (note the bolded text: "jsp/"):
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
and Voila! It works!
BTW, this is what the original exception would more or less look like:
org.apache.jasper.JasperException: /inc/test.jsp(4,0) According to TLD or attribute directive in tag file, attribute test does not accept any expressions
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.checkXmlAttributes(Validator.java:952)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:706)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Validator.validate(Validator.java:1484)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
HTH!
Recent blog posts
- A guide to Kitchen Bins
- Forex is Short term and Fruitful business, find out how
- Khartoum, a worth Visiting city in Sudan
- Some Facts about Door hinges
- Discounted telecommunications services
- Dubai welcomes people from around the globe
- Installing door furniture is not just easy but fun to do!
- Dubai, the perfect place to visit, less hassle and more fun!
- How to manage with Forex and a broker, tips on how to get started!
- Door Furniture is what needs to keep in mind while constructing the dream home!








