Main

JSP Archives

July 3, 2006

How To Open the JSP Files in the Source Tab instead of the Visual Editor


This is a regular request we get in the OTN Forum:

how to set JDeveloper to open the JSP files in the Source Editor instead of the Visual (Design) Editor ?

This can be done by changing the IDE preferences;

Select menu Tools | Preferences...

Select File Types in the left panel.

On the right, click tab Default Editors

Select the type of file you want to change (JSP Source in this case).

Select 'Source' in the Default Editor and click OK.
Opening a file of this type will open it in the Source Editor from now.

Preferences_FileType:


March 20, 2006

JSTL 1.0 in JSP 2.0 Pages

The problem

We had several customers who reported the same issue last week through MetaLink. I see that others also created a Forum thread:

JSP pages with JSTL including EL gives the following error at compilation in JDeveloper 10.1.3:
Error(<line number="">): Expression Language not supported in compile time attribute value
</line>
or the following when running the page in OC4J:
500 Internal Server Error
OracleJSP: oracle.jsp.parse.JspParseException: /Name.jsp: Line # 13, <c:out value="Hello, my name is ${LastName}, ${FirstName} ${LastName}">
Error: Expression Language not supported in compile time attribute value</c:out>
The same pages could compile and run without any problem with JDeveloper 10.1.2.

The cause

This happens when using JSTL 1.0 in JSP 2.0
When the Deployment Descriptor (web.xml) is from version 2.4 - you see it in your web.xml file:
<web-app (...) version="2.4" (...) >
then the default mode for JSP pages is to evaluate EL expressions, what raises the above errors when JSTL 1.0 libraries are used.

The solution(s)

Depending on the fact you want to continue working with the JSTL 1.0 libraries or not, here are different solutions you can implement:
  1. use the JSTL 1.1 libraries;
    you should add the 1.1 libraries to your Project and replace the URIs in your pages, as they are different between the 2 versions.
    The new URIs are similar to the old JSTL 1.0 EL URIs, except that jsp/ has been added in front of jstl, stressing JSTL's dependency on the JSP specification (which now "owns" the EL).
    For example:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  2. use the "Request-Time" (..._rt) JSTL 1.0 libraries:
    for example, if you use the core library, replace "core" by "core_rt"
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
  3. Create your JSP Pages in a Project with a 2.3 Deployment Descriptor
     
    Each JSP page has a default mode for EL expression evaluation. The default value varies depending on the version of the web application deployment descriptor.
    The default mode for JSP pages delivered with a Servlet 2.4 descriptor is to evaluate EL expressions.
    The default mode for JSP pages delivered using a Servlet 2.3 or earlier descriptor is to ignore EL expressions.
    So, if you create your JSP pages with JSTL 1.0 in a "Servlet 2.3/JSP 1.2 (J2EE 1.3)" Web Project (when you create a "Web Project" in JDeveloper 10.1.3, you are prompted for its version), the EL will be ignored and your page will compile.

  4. Deactivate the EL evaluation with a Page directive or in the Deployment Descriptor:
    You can deactivate the EL evaluation either at the JSP page level, in the page directive, by setting the isELIgnored attribute to "true":
    <%@ page (...)  isELIgnored="true" %>
    or in your Deployment Descriptor (web.xml), by setting the <el-ignored></el-ignored> element to true (subelement of <jsp-property-group></jsp-property-group>):
    (...)
        <jsp-config>
            <jsp-property-group>
                <display-name>Ignore EL</display-name>
                <url-pattern>*.jsp</url-pattern>
                <el-ignored>true</el-ignored>
            </jsp-property-group>
        </jsp-config>
    (...)

In case you have access to MetaLink (*), I also created Note 361806.1 - JSTL Including EL Raises Error "Expression Language not supported in compile time attribute value"

(*) MetaLink requires a login that you get with your Oracle Support licence.

References

About JSP

This page contains an archive of all entries posted to Didier's Blog in the JSP category. They are listed from oldest to newest.

IDE is the previous category.

Java is the next category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle