Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabling el in jsp [duplicate]

How can I enable EL expression in JSP version 2.0? Every time I'm getting EL expression as an String literal in the JSP as an output.

Here's the DD which the container is using to sending request to servlet, and then servlet dispating request to JSP:

    <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">

    <servlet>
    <servlet-name>check</servlet-name>
    <servlet-class>Welcome</servlet-class>

    </servlet>


<servlet-mapping>
<servlet-name>check</servlet-name>
<url-pattern>/Momma.do</url-pattern>
</servlet-mapping>

</web-app>

I've not ignored any el in JSP too. Am I still missing something?

like image 773
Greenhorn Avatar asked Jun 24 '09 12:06

Greenhorn


People also ask

Is El ignored in JSP?

The default mode for JSP pages delivered using a descriptor from Servlet 2.3 or before is to ignore EL expressions; this provides backward compatibility.

What is EL expression in JSP?

Expression Language (EL) in JSP The Expression Language (EL) simplifies the accessibility of data stored in the Java Bean component, and other objects like request, session, application etc. There are many implicit objects, operators and reserve words in EL. It is the newly added feature in JSP technology version 2.0.


1 Answers

Your web.xml file looks fine for JSP 2.0. If you are having problems accessing EL on specific pages try adding the following to the top of the individual JSP page:

<%@ page isELIgnored="false" %>

Since you are using JSP 2.0 I think that EL is ignored by default so you can can add the following to your web.xml to enable it for all pages:

<jsp-config>
  <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <el-enabled>true</el-enabled>
    <scripting-enabled>true</scripting-enabled>
  </jsp-property-group>
</jsp-config>
like image 182
amischiefr Avatar answered Oct 05 '22 17:10

amischiefr