有关于JSTL中org.apache.jasper.JasperException与javax.el.PropertyNotFoundException的错误解决方法

有关于JSTL中org.apache.jasper.JasperException与javax.el.PropertyNotFoundException的错误解决方法 org.apache.jasper.JasperException错误的解决方案 大家首先看一下我这个错误提示:严重:Servlet.service()forservlet[jsp]incontextwithpath[/AboutJSP]threwexception[Theabsoluteuri:http://java.sun.com/jsp/jstl/…

  • org.apache.jasper.JasperException错误的解决方案

大家首先看一下我这个错误提示:

严重: Servlet.service() for servlet [jsp] in context with path [/AboutJSP] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core  cannot be resolved in either web.xml or the jar files deployed with this application] with root cause
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core  cannot be resolved in either web.xml or the jar files deployed with this application
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:277)
	at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:75)
	at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:250)
	at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:125)
	at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:421)
	at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:479)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1435)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:201)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:358)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:338)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:580)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

如果你能翻到这篇文章的话,说明你也遇到了这个问题。心里先不要着急,因为大家遇到的问题都异曲同工,但是Eclipse会报同一个错误。再看一下我的jsp文件,如下截图:

有关于JSTL中org.apache.jasper.JasperException与javax.el.PropertyNotFoundException的错误解决方法

大家请看我画出的箭头,总有三个,这是对比在taglib标签中的uri字符串中空格问题。箭头一与箭头三的性质是相同的(此处指位置的性质,都是靠近结束的双引号),而箭头二是结束时的空格,那么这个问题的解决方案之一就是空格。

解决方法:

1. 首先查看一下箭头一所指的位置是否有空格,如果有空格就会报这种错误,而箭头二的位置有没有空格没什么关系,但是为了保险起见,还是不要的这个标签里面肆意留空格;

2. 可能是tomcat服务器版本的问题:详细请点击关于tomcat服务器版本问题导致报此错误的详解

3. 也有可能是没有导入jstl.jar包,在这里也要注意包的版本,jstl1.0以下版本不支持EL表达式,而1.1版本支持,我们要导的包有jsp这个关键字:详细请点击:有关于没有导入jstl.jar包的详细解释;这里也有一篇:https://blog.csdn.net/liu_yuan_kai/article/details/80268323

  • javax.el.PropertyNotFoundException错误的解决方案

首先,我们来看一下我出现的这个错误,错误代码如下:

javax.el.PropertyNotFoundException: Property 'Id' not found on type com.itheima.stuManager.StuDao.Student
	at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:269)
	at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:221)
	at javax.el.BeanELResolver.property(BeanELResolver.java:356)
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:95)
	at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
	at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:943)
	at org.apache.jsp.stu_005finfo_jsp._jspx_meth_c_005fforEach_005f0(stu_005finfo_jsp.java:189)
	at org.apache.jsp.stu_005finfo_jsp._jspService(stu_005finfo_jsp.java:142)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

根据提示信息,大家可能可以看出是Id这个属性在这个类中没有找到,那该怎么办呢?当然是检查属性名称与此处的名称是否一模一样,当然,也有例外,如果你在类中的属性名称是大写的,那在EL表达式中属性值要小写哦!

此错误的解决方案:

1.首先检测你所写的属性值是否与你此时在EL表达式中的名称一致,如果你的属性名称为首字母大写,例如我定义一个变量private int Id;但是在写EL表达式的时候必须写为${XXX.id};一定不能写大写;还有,必须要有属性的set()和get()方法。EL实际使用的是反射机制,它会在电泳表达式时自己在前面加上”get” + 属性名称的首字母大写;关于更多具体的内部实现请点击这里

2.可能会涉及一些类型的转换;不过这个不会经常涉及。

写在最后,昨天晚上遇到第一个错误,找到了半夜两点多,心里还挺难受的。当知道错误竟然是一个空格时(是在结束的双英引号前面有个空格),真的好生气,毕竟找了这么久,但是最后还是解决了。这还是在编程的道路上第一次这么努力的找bug,加油吧!少年!共勉~

今天的文章有关于JSTL中org.apache.jasper.JasperException与javax.el.PropertyNotFoundException的错误解决方法分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/27553.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注