JSTL---Servlet.service() for servlet action threw exceptionjavax.el.MethodNotFoundException Method s

简介:

JSTL---Servlet.service() for servlet action threw exceptionjavax.el.MethodNotFoundException Method size

 

         背景

         最近在项目测试的时候,发现有的JSP页面有时会出现如下错误:

JSTL--- Servlet.service() for servlet action threw exceptionjavax.el.MethodNotFoundExceptionMethod size

 

         原因

         EL表达式语法错误,页面中绑定数据使用的是JSTL,所以有时会出现判空的情况写法如下:

<c:if test = “${list.size>0}”>
……
</c:if>

         而EL表达式并不支持${list.size>0}这种写法。

 

         解决方法

         其实,JSTL是有相关的函数支持获取集合的大小大。我们需要再引入一个标签

<%@taglib uri="http://java.sun.com/jsp/jstl/core"prefix="c"%> 
<%@taglib prefix="fn"uri="http://java.sun.com/jsp/jstl/functions"%> 

         EL表达式的正确写法

<c:if test = “${fn:length(list)}”>
……
</c:if>

        

         更多的知识大家可以去下面的链接地址看看:

         JSTL官网:https://jstl.java.net/

         开源中国JSTL社区:http://www.oschina.net/question/tag/jstl

         JSTL标签库:http://www.runoob.com/jsp/jsp-jstl.html


目录
相关文章
SpringCloud Feign报错Method has too many Body parameters
SpringCloud Feign报错Method has too many Body parameters
报错ERROR 3576 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for
报错类似题目这样的是因为你相应的类没有序列化,只需要在相关类后继承序列化接口即可。
1070 0
报错ERROR 3576 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for
|
5天前
spring3 springfox报错Type javax.servlet.http.HttpServletRequest not present
spring3 springfox报错Type javax.servlet.http.HttpServletRequest not present
62 0
|
5天前
Servlet3.0+环境下使用注解注册Servlet、Filter和Listener组件
Servlet3.0+环境下使用注解注册Servlet、Filter和Listener组件
44 2
|
5天前
|
缓存 Java Spring
servlet/filter/listener/interceptor区别与联系
servlet/filter/listener/interceptor区别与联系
45 0
|
Java 数据库连接 mybatis
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
在进行springboot和mybatis遇到了这个错误 Servlet.service() for servlet [dispatcherServlet] in context with path [] th
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
|
存储 前端开发 Java
servlet初识,认识service()方法
servlet初识,认识service()方法
150 0
servlet初识,认识service()方法
Property 'server.jsp-servlet.init-parameters' is Deprecated: Use 'server.servlet.jsp.init-parameters
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/80897595 Property 'server.
1290 0
|
JSON Java 数据格式
Method has too many Body parameters openfeign
feign 调用问题,最新版本的feign和旧版本的稍微有一些不一样,具体如下(eureka 作为服务发现与注册 )  依赖: compile('io.github.openfeign:feign-java8:9.
6522 0