jsp and Expression langage question ?

J

Java_Forum

hi,
in the j2EE tutorial, in the chapter related to Expression langage (EL), we
can read "EL Expressions can be used in two situations, In template text, In
any standard or custom tag attribute that can accept an expression"
ok have a look at this code

<html>
......
<c:eek:ut value="${1.2E4 + 1.4}"/>
${1.2E10 + 1.4}
.....
</html>


the output is

12001.4${1.2E10 + 1.4}
why the second EL ${1.2E10 + 1.4} is not evaluated, even if it appears in
the template texte!!!!
perhaps i didn't understand what is a 'template texte' ??
tahnks for your help
--
 
C

Christophe Vanfleteren

Java_Forum said:
hi,
in the j2EE tutorial, in the chapter related to Expression langage (EL), we
can read "EL Expressions can be used in two situations, In template text,
In any standard or custom tag attribute that can accept an expression"
ok have a look at this code

<html>
.....
<c:eek:ut value="${1.2E4 + 1.4}"/>
${1.2E10 + 1.4}
....
</html>


the output is

12001.4${1.2E10 + 1.4}
why the second EL ${1.2E10 + 1.4} is not evaluated, even if it appears in
the template texte!!!!
perhaps i didn't understand what is a 'template texte' ??
tahnks for your help
--

Are you using a JSP 2 aware servlet container, eg. Tomcat 5?
Because that doesn't work for older versions.

Template text is just the normal html in the file <=> the jsp
code/tags/scriplets.
 
J

Java_Forum

hi,

i am using wabesphere v5.1, i think was is a jsp2 aware servlet container
since it evaluated the expression <c:eek:ut value="${1.2E4 + 1.4}"/>
but why it doesn't evaluated the second expression ${1.2E10 + 1.4}
the template texte is anywhere inside the html or jsp document, isn't it ?
thanks
 
C

Christophe Vanfleteren

Java_Forum wrote:

i am using wabesphere v5.1, i think was is a jsp2 aware servlet container
since it evaluated the expression <c:eek:ut value="${1.2E4 + 1.4}"/>
but why it doesn't evaluated the second expression ${1.2E10 + 1.4}
the template texte is anywhere inside the html or jsp document, isn't it ?
thanks

The expression language (EL) is not a JSP 2 specific thing, it was first
introduced with the JSTL (the Java Standard Tag Library), and worked with
JSP 1.2.

There is a difference between using the EL in tags and in the text itself.
The JSTL has build-in support for the EL language (so even not all tags can
automatically use the expression language: they have to be written specially
to use it).

But as of JSP2, that support has been made available to anywhere in the JSP
file. So unless you get a JSP 2 compatible server, you will not be able to
make the second expression work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top