JSP EL expressions not working in tag files

We are trying to port our Java web application from the Tomcat 5.5 server to the more modern Tomcat 6.0.24, but we have some problems with the JSP EL.

Expressions placed in XML tag files are not recognized by the server, which simply displays them as text (as in the following example). Any ideas why?

<object id="${id}"
        classid="java:${code}.class"
        type="application/x-java-applet;version=1.5"
        archive="${archive}" codebase="${codebase}"
        height="${height}" width="${width}" > 
    <param name="code" value="${code}" /> 
    <param name="codebase" value="${codebase}" /> 
    <param name="archive" value="${archive}" /> 
    <param name="type" value="application/x-java-applet;version=1.5"/> 
    <param name="mayscript" value="true" /> 

    <param name="cache_archive" value="wetorrent.jar,weupnp.jar" /> 
        <param name="cache_version" value="0.0.0.17,0.0.0.17" />    
    <strong> 
        <span style="cursor: pointer" onclick="window.open('http://www.java.com/','_blank','toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');"> 
            This browser does not have a Java Plug-in.<br /> 
            Get the latest Java Plug-in here.</span> 
    </strong> 

</object>

The strange thing is that in JSPs that include an EL tag expression work fine.

I even tried to set the attribute isELIgnored="false"in the .tag file, but I got this error:

Tag directive: it is illegal to have multiple occurrences of isELIgnored with different values ​​(old: true, new: false)

Where does the old (true) meaning come from? We never pointed it out.


Additional Information:

taglib ( .jsp .tag ),   <% @taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" % >

standard.jar jstl.jar lib/.

web.xml :

<web-app version="2.4" 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">
+3
4
+2

Tomcat 6.0 Servlet 2.5 JSP 2.1. <web-app> :

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

, JSTL, JAR Tomcat lib, WEB-INF\lib. , JSP 2.0 EL JSP, JSTL .

+4

Since it works with JSP but not with tags, you can also check .tld if you have a jsp-version element, which could be the reason:

<?xml version="1.0" encoding="ISO-8859-1" ?>
    <taglib xmlns="http://java.sun.com/xml/ns/j2ee" version="2.0">
        <tlib-version>2.0</tlib-version>
        <jsp-version>1.2</jsp-version>

just remove the jsp-version element.

+3
source

Are you sure you have JSTL 1.2 jars? You must have this version for recognition ${foo}without <c:out/>, I think.

0
source

Source: https://habr.com/ru/post/1752612/


All Articles