jsp page does not recognize the expression of el Solutions

Original link: http://www.cnblogs.com/fingerboy/p/6007040.html

  Today, when writing a small demo of springmvc, encounter a problem, is written as $ {user.username} expression language in jsp page still displayed as $ {user.username} in the browser page, simply explained jsp $ {tag} do not know, and explore a bit and found my web.xml is declared

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

  This means that the 2.3 version of the servlet used, checked, by default, Servlet2.3 / jsp1.2 default does not support el expressions, then there are two solutions, testing can solve the problem.

  The first way is to add directly in front of jsp file header label

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

  Represent mandatory not ignore el expression format, re-test, the success of display data.

  The second way is to use a newer version of the servlet, for example, I directly into web.xml version 2.5:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">

</web-app>

  At this time, no need to set isELIgnored = "false" because this version has been supported by default el expressions.

Reproduced in: https: //www.cnblogs.com/fingerboy/p/6007040.html

Guess you like

Origin blog.csdn.net/weixin_30294709/article/details/94790556