• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EL is not working

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Java and JSP. I passed SCJP 1.4 recently and I am working on SCWCD preparation. I am in the process of learning EL in JSP. But my EL doesn't seem to work at all. When my EL's are rendered , I get the same as I typed in/ Is there any setting that I have to do make it work?
 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, ELs are by default enabled.

But you can check into web.xml and JSP directives if you have change any setting.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rathi ji:
No, ELs are by default enabled.



No, not always.

What servlet/JSP container are you using? If it's Tomcat 5, you need to make sure that your web app is declared as a servlets 2.4 web app in the deployment descriptor. See the JSP FAQ for more info.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:


No, not always.

What servlet/JSP container are you using? If it's Tomcat 5, you need to make sure that your web app is declared as a servlets 2.4 web app in the deployment descriptor. See the JSP FAQ for more info.



But it is written in HFS&J. Page 320.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rathi ji:
But it is written in HFS&J. Page 320.



EL is only supported in the most recent versions of the JSP spec.
To insure backward compatibility, containers will refer to the DTD in the deployment descriptor to see which version the app is using.

Also, if you are going to refer to text in a book, please do not just post the page number.
Post the relevant text. Don't assume that everyone reading these posts owns the same books that you do.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also facing same problem. I checked FAQ

Here is my deployment discriptor main tag entry, where I specified the version as 2.4

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

I checked JSP FAQ at http://java.sun.com/products/jsp/faq.html there also I haven't foundmuch.

Here is my full jsp source.
-------------------------
<html>
<body>
<%@ page isELIgnored="false"%>
<%! String texts="Welcome to Expression language"; %>
Welcome to the jsp programming.
<br/>
<strong>If you see this page, it means jsp are also funtioning properly.</strong>
<form action="result.jsp">
<input type="text" name="username"/>
<input type="password" name="userpassword"/>
<input type="submit" value="Save"/>
Text = ${texts}
</form>
</body>
</html>
--------------------------------------------

For somereason it is still now workging. Please let me know if I am missing something.

I am using Tomcat 5.5, XP Pro envi
Thanks!

Shiva rao
[ December 09, 2005: Message edited by: shiva rao ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your example:

<%! String texts="Welcome to Expression language"; %>

...

Text = ${texts}



you define texts as a scriptlet variable. The EL references scoped variables.

The JSTL and EL have no provisions for referencing scripting elements.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:

Also, if you are going to refer to text in a book, please do not just post the page number.
Post the relevant text. Don't assume that everyone reading these posts owns the same books that you do.



The text from the book is: El is enabled by default!

I think it was not very tough to guess what is written in the book from my post. I try to post text from the book when it is required.

Thanks.

[ December 11, 2005: Message edited by: rathi ji ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rathi,
This conversation is straying from the original poster's question.
Please see my PM on the book quoting issue.
If you would like to know why it's impossible for EL to be turned on by default in container versions that were released before the existence of EL, start a new thread please.
[ December 10, 2005: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rathi, Ben is correct. The book is probably referring to JSP 2.0, in which case EL is enabled by default. If using jSP 1.2 or earlier EL is not enabled by default.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic