Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

EL is not being recognized

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there,
I've written a very simple test for jsp that is failing:

the bean is a simple standard bean with one attribute: "name"

in the servlet:

HttpServletRequest request = getThreadLocalRequest();
HttpSession session = request.getSession();

TestBean tb = new TestBean();
tb.setName("Dee");
session.setAttribute("testBean", tb);


in the jsp file:

${testBean.name}



server is tomcat 5.5

the output result on the jsp page is:
${testBean.name}


so, EL is not being recognized;
is there a setting or a tag to inform tomcat how to properly generate the page?


the following does work, tho:

<%
java.util.Date date = new java.util.Date();
%>
Hello! The time is now <%= date %>


any assistance would be greatly appreciated

B
 
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
Look at the top of your web.xml and see if it's listed as servlet version 2.4.
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please fix your code using <code> </code> from above.. Thanks..

[ UD: Note that code tags use rectangle brackets, not angle brackets. ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suspect you are not using JSP 2.0 . in jsp 2.0 EL is enabled by default and in previous version it is disabled by default.
I think this might help you.
 
Sheriff
Posts: 67595
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

Gab Narwaria wrote:I suspect you are not using JSP 2.0 . in jsp 2.0 EL is enabled by default and in previous version it is disabled by default.


Not always. It depends upon how the deployment descriptor is declared -- which is why Ben asked about that above.
 
wbrian radley
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very much for your replies; much appreciated.
I've also tried to run the jsp examples that come with tomcat and I've the same result:
EL is not being recognized; it is tomcat 5.5 I'm using.
checking the web.xml is a good idea and it's indeed version 2.4.

I'm thinking all I can do is to re-install tomcat and hope somehow it works.

B
 
Bear Bibeault
Sheriff
Posts: 67595
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
If you are using Tomcat 5.5, and the deployment descriptor is correctly declared, there is no reason that the EL should not work.

Perhaps it's time to post your code?
 
wbrian radley
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there,

thank you for all your suggestions:
it turns out that there were two problems:
at some point in the development of the app I add to the tomcat lib
directory a jar file - not sure which one exactly but likely a 'jasper' or 'servlet' - which caused
tomcat to turn off JSP;
second, different urls - ip address of the box vs 'localhost' - for the same localhost were being used for the app and for the
jsp url causing the tomcat to see different sessions and the JSP bean was being
stored in the bean.

a thought: there is a real need for some kind of central repository per technology that - given a situation - helps one to ask
questions. a simple faq might work in many cases.
in this case the questions would include:
- check the servlet version and web-xml,
- are there any jasper or servlet jars in the lib dir which may not need be there?
- check that the urls being used as exactly the same if beans are being stored in the session.

B
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic