Java Web编程中使用JSTL注意c标签URI引用

使用标签是要注意属性uri值,正确写法<%@ taglib  uri="http://java.sun.com/jsp/jstl/core"  prefix="c" %>

应该依据jstl包下的c.tld中的uri为准。

<%@ taglib  uri="http://java.sun.com/jstl/core"  prefix="c" %>这种写法会报如下异常:

org.apache.jasper.JasperException: /WEB-INF/jsp/messageList.jsp (line: 19, column: 2) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:149)
	org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1240)
	org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:875)
	org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
	org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1795)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1181)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:779)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


你可能感兴趣的:(java)