Solution to the ineffectiveness of $symbol in expression language in jsp page

  • 2021-10-25 07:37:08
  • OfStack

Today, a test project done before was deployed in myeclipse, and it was found that the $symbol tomcat in jsp was displayed on the page after it was started. Baidu searched others and had similar problems. It was reminded that web. xml was configured with version set to 2.5 and I started tomcat5. The version of tomcat is lower than the version of web, resulting in the improper use of the $symbol.

Replace tomcat5 with tomcat6. jdk uses 1.6 to start spring 2.5 project. Show problem resolution.

Here is a detailed description of the online excerpt:

When you output an jsp page using the $symbol in the expression language, such as ${pageScope. title}, you can't output the content or the ${pageScope. titl} is displayed intact

But in fact, you can test that pageContext. getAttribute ("title") is valuable by running the following code on the current jsp page


<%
 ...
 pageContext.setAttribute("title",aboutusBean.getTitle());
 System.out.println("pageContext="+pageContext.getAttribute("title"));
%> 

I am using Tomcat version 5.5, which only supports servlet/JSP specification version 2.4/2.0, while my web. xml is configured with the 2.5 specification, so the $symbol is not working properly.

1. Check your web. xml file to make sure it is Servlet 2.4 or above and EL is not disabled.

2. Check your Web server to make sure it supports Servlet 2.4 and above.

3. Note the version of Tomcat. Each version of Tomcat supports different specifications for Servlet

4. The version of Tomcat and the specification of the supported Servlet are as follows:

Tomcat: servlet/JSP specification version implemented by 6.0. 13: 2.5/2.1
Tomcat: servlet/JSP specification version implemented by 5.5. 23: 2.4/2.0
Tomcat: servlet/JSP specification version implemented by 4.1. 36: 2.3/1.2
Tomcat: servlet/JSP specification version implemented by 3.3. 2: 2.2/1.1


Related articles: