JSP exception Org.apache.jasper.JasperException (RPM)

Source: Internet
Author: User
Tags tld

According to TLD or attribute directive in tag file, attribute items does not accep t any expressions

  1. Critical: Servlet.service () for Servlet JSP threw exception
  2. Org.apache.jasper.JasperException:/selectortagtest.jsp (26,8) according to TLD or attribute directive in tag file, attrib Ute items does not accep
  3. T any expressions
  4. At Org.apache.jasper.compiler.DefaultErrorHandler.jspError (defaulterrorhandler.java:40)
  5. At Org.apache.jasper.compiler.ErrorDispatcher.dispatch (errordispatcher.java:407)
  6. At Org.apache.jasper.compiler.ErrorDispatcher.jspError (errordispatcher.java:148)
  7. At Org.apache.jasper.compiler.validator$validatevisitor.checkxmlattributes (validator.java:1172)
  8. At Org.apache.jasper.compiler.validator$validatevisitor.visit (validator.java:819)
  9. At Org.apache.jasper.compiler.node$customtag.accept (node.java:1512)
  10. At Org.apache.jasper.compiler.node$nodes.visit (node.java:2343)
  11. At Org.apache.jasper.compiler.node$visitor.visitbody (node.java:2393)
  12. At Org.apache.jasper.compiler.node$visitor.visit (node.java:2399)
  13. At Org.apache.jasper.compiler.node$root.accept (node.java:489)
  14. At Org.apache.jasper.compiler.node$nodes.visit (node.java:2343)
  15. At Org.apache.jasper.compiler.Validator.validate (validator.java:1737)
  16. At Org.apache.jasper.compiler.Compiler.generateJava (compiler.java:165)
  17. At Org.apache.jasper.compiler.Compiler.compile (compiler.java:314)
  18. At Org.apache.jasper.compiler.Compiler.compile (compiler.java:294)
  19. At Org.apache.jasper.compiler.Compiler.compile (compiler.java:281)
  20. At Org.apache.jasper.JspCompilationContext.compile (jspcompilationcontext.java:566)
  21. At Org.apache.jasper.servlet.JspServletWrapper.service (jspservletwrapper.java:317)
  22. At Org.apache.jasper.servlet.JspServlet.serviceJspFile (jspservlet.java:337)
  23. At Org.apache.jasper.servlet.JspServlet.service (jspservlet.java:266)
  24. At Javax.servlet.http.HttpServlet.service (httpservlet.java:803)
  25. At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:290)
  26. At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206)
  27. At Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (characterencodingfilter.java:96)
  28. At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:75)
  29. At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:235)
  30. At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206)
  31. At Org.apache.struts2.dispatcher.FilterDispatcher.doFilter (filterdispatcher.java:413)
  32. At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:235)
  33. At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206)
  34. At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:233)
  35. At Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:175)
  36. At Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:128)
  37. At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:102)
  38. At Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109)
  39. At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:286)
  40. At Org.apache.coyote.http11.Http11Processor.process (http11processor.java:844)
  41. At Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (http11protocol.java:583)
  42. At Org.apache.tomcat.util.net.jioendpoint$worker.run (jioendpoint.java:447)
  43. At Java.lang.Thread.run (thread.java:595)

Workaround:
Put
<%@ taglib uri= "Http://java.sun.com/jstl/core" prefix= "C"%>
Switch
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>

Another very thorough analysis is as follows:

Environment: Win2003 Tomcat 5.5 JDK1.6 on
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app version= "2.4"
Xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
Xmlns:xsi=http://www.w3.org/2001/xmlschema-instance
xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
</web-app>
JSP Code:

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

1+2+3 = ${1+2+3} <br>

1+2+3 = <c:out value= "6"/> <br>

There is no problem with execution at this time.

1+2+3 = <c:out value= "${1+2+3}" occurs when/> executes:

According to TLD or attribute directive in tag file, attribute value does no accept any expressions

There was a JSP missing yesterday, so there was always a problem.

Code

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

Written

<% @taglib prefix= "C" uri= "Http://java.sun.com/jstl/core"%>

Try again today. Discover JSTL1.1 can be used. But when using JSTL1.0, there is a problem.

is to put the JSTL1.1 library under the/web-inf/lib/.

At first I was a copy of the Jstl library in NetBeans 5.5.1 and found it to work. Later with the jstl1.1.2 library, can also be used.

Summarize:

JSTL1.1 's library is used in JSP2.0 (Servlet 2.4) and later (recommended with JSTL1.1 and above):

Code

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

Xml

<?xml version= "1.0" encoding= "UTF-8"?>

<web-app version= "2.4"

Xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"

Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"

xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >

</web-app>

In Servlet2.3 and before,

Code

<% @taglib prefix= "C" uri= "Http://java.sun.com/jstl/core"%>

Less JSP than version 2.4

Xml

<?xml version= "1.0" encoding= "UTF-8"?>

<! DOCTYPE Web-app Public "-//sun Microsystems, INC.//DTD Web Application 2.3//en" "Http://java.sun.com/dtd/web-app_2_3. DTD ">

<web-app>

</web-app>

In Servlet2.3 the best use JSTL1.0, if use JSTL1.1, please add

<?xml version= "1.0" encoding= "UTF-8"?>

<! DOCTYPE Web-app Public "-//sun Microsystems, INC.//DTD Web Application 2.3//en" "Http://java.sun.com/dtd/web-app_2_3. DTD ">

<web-app>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>

<taglib-location>/WEB-INF/c.tld</taglib-location>

</taglib>

</web-app>

Copy the C.tld under the TLD directory to/web-inf.

Find the official:

Http://jakarta.apache.org/site/downloads/downloads_taglibs.html

Select Standard 1.0 Taglib and standard 1.1 Taglib to download jstl1.0 and jstl1.1 versions.

According to TLD or attribute directive on tag file, attribute page does not accept any expressions

The property that corresponds to tag does not support expression passing in. The workaround is to add the Rtexprvalue attribute to the corresponding tag in the TLD file and set it to true, for example:

<tag>

<name>CustomTag</name>

......

<attribute>

<name>AttName</name>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

The internet says this has something to do with the Tomcat version (5.x), and I'm using 5.0.27, but this has not been confirmed.

JSP exception occurs when the application deployment is running, when using the JSTL library: According to TLD or attribute directive in tag file, attribute value does no accept any expressions, perhaps because of the use of the JSP2.0 version, while not using the backup version of the JSTL Core library (RT library), there are two ways to handle this:

1. Modify Web. Xml.

<web-app

xmlns= "Http://java.sun.com/xml/ns/j2ee" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation = "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version= "2.4" >

Change to version 2.3

<! DOCTYPE Web-app Public "-//sun Microsystems, INC.//DTD Web Application 2.3//en" "Http://java.sun.com/dtd/web-app_2_3. DTD ">

<web-app>

2. Using the JSTL Core RT Library

There are two taglib pseudo-directives for the JSTL Core library, where the RT library is dependent on the property value of the JSP's traditional request, rather than relying on El to implement it (called the El Library. JSP2.0 will support EL)

JSP in the use of <%@ taglib uri=http://java.sun.com/jstl/core prefix= "C"%> in the 2.3 version can be, in 2.4, is not the version is incompatible?

As long as the

<%@ taglib uri= "Http://java.sun.com/jstl/core" prefix= "C"%>

Switch

<%@ taglib uri=http://java.sun.com/jstl/core_rt prefix= "C"%>

There's no problem.

Reprinted from: http://www.cnblogs.com/fish-king/archive/2013/01/16/2862686.html

JSP exception Org.apache.jasper.JasperException (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.