Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EL is not being recognized  RSS feed

 
wbrian radley
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the top of your web.xml and see if it's listed as servlet version 2.4.
 
Swagato Bhatta
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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. ]
 
Gab Narwaria
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!