• 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

JSP Bean reference

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Folks,
I have a bean which is loaded into a servlet as below

<jsp:useBean id="sanityBean" class="com.ibm.lotus.apollo.sanity.SanityBean" scope="application"/>
<jsp:setProperty name="sanityBean" property="*"/>


The bean is then referenced further down the jsp as below

<input type="text" name="emails" size="20" value="${sanityBean.emails}"/>

However what gets displayed on the input box is exactly ${sanityBean.emails} i.e it does not get resolved, as this is a legacy application I cannot change the code, on Webspahere 7.1 this works as expected just when deployed onto Tomcat this issue occurs, any ideas out there?

Thanks for your help
Rob
 
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
How is the web.xml declared? Using the 2.4 or 2.5 XML Schema? Or the 2.3 DTD?

The latter will disable the EL in JSP pages.
 
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
P.S. Why is this bean being loaded into application scope?
 
Rob Symth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
web.xml snippet below


<?xml version="1.0" encoding="UTF-8"?>
<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">
 
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
OK, next step. Create a JSP that contains nothing but ${3+4}

What is displayed?
 
Rob Symth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I found the issue, I am using Tomcat 5.5 which only support servlet 2.4, the app itself is defined as 2.5, see below

Tomcat 5.5 is Servlet 2.4/JSP 2.0, so #1 can be scratched. You didn't change anything in webapp before deploying I assume, so #3 and #4 can likely be scratched. Now left #2. Maybe you declared it as Servlet 2.5 for Tomcat 6.0 while the Tomcat 5.5 only understands up to with Servlet 2.4. This way everything will become a mess as Tomcat would then fallback to least compatibility modus. You need to redeclare web.xml as Servlet 2.4 so that it will work in both Tomcat 5.5 and 6.0. The declaration should look like:
 
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

Rob Symth wrote: the app itself is defined as 2.5


Not according to what you have posted so far.
 
Rob Symth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I got mixed up, what I had before was the web.xml for Tomcat itself
The web.xml for the app is below


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

 
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
Please AvoidRedHerrings.

Well, yeah. If you're using Tomcat 5, you need to declare the web.xml appropriately and build against the correct versions of the Servlet and JSP APIs.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic