You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John5342 <jo...@googlemail.com> on 2008/10/01 20:51:59 UTC

Unified EL question

Hi all.

Probably not the right place to ask this but not sure there where else so
here it is. Now that all my clients have upgraded to tomcat 6.0.18 (from
various rather old versions) i am starting to write any new webapps using
jsp 2.1 including Unified EL but i am even already running into a stupid
problem and can only assume i am doing something wrong or otherwise nobody
would be using tomcat in the first place. Below is a small snippet of code
to illustrate:

A javabean:

package a.pkg;
class ABean {
  public String getString() {
    return "Hello world!";
  }
}

A jsp page:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<jsp:useBean id="thbean" class="a.pkg.ABean" scope="session">
  <jsp:setProperty name="thebean" property="*"/>
</jsp:useBean>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>A title.</title>
    </head>
    <body>
<p>The string is: ${sessionScope.thebean.string}</p>
    </body>
</html>

All the tutorials and samples and such i can find on the net suggest the
output from this should be:

The string is: Hello world!

but i get:

The string is: ${sessionScope.thebean.string}

I just cant find anything on the net to suggest why this would happen but
plenty to say it should work. Has anybody got any ideas where i am going
wrong?
Am doing this in linux using tomcat 6.0.18 and openjdk 1.6.0.

Thanks in advance,
John

Re: Unified EL question

Posted by John5342 <jo...@googlemail.com>.
>It happens to me when the web.xml is pointing to a version prior to Servlet
2.4.
Thanks. Thats exactly what it was. Netbeans appears to provide a web.xml
using version 2.3. Changed it to v2.5 and everything works as expected.

>Looks like your bean ID is thbean not thebean. It is missing "e" in the
>"the". Could that be the problem?
Sorry that was just a typo when i was writing an example. The real page is
spelt correctly but Antonio gave me exactly the answer i needed. Thanks
anyway.

2008/10/1 Antonio Petrelli <an...@gmail.com>

> 2008/10/1 John5342 <jo...@googlemail.com>:
> > The string is: ${sessionScope.thebean.string}
>
> It happens to me when the web.xml is pointing to a version prior to Servlet
> 2.4.
>
> Antonio
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Unified EL question

Posted by Antonio Petrelli <an...@gmail.com>.
2008/10/1 John5342 <jo...@googlemail.com>:
> The string is: ${sessionScope.thebean.string}

It happens to me when the web.xml is pointing to a version prior to Servlet 2.4.

Antonio

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Unified EL question

Posted by Sai Pullabhotla <ps...@linoma.com>.
Looks like your bean ID is thbean not thebean. It is missing "e" in the
"the". Could that be the problem? 

Sai Pullabhotla
Senior Architect
Linoma Software 
1409 Silver St
Ashland, NE 68003 
(402) 944 4242 x 716/754
(800) 949 4696 x 716/754
www.linomasoftware.com
 

-----Original Message-----
From: John5342 [mailto:john5342@googlemail.com] 
Sent: Wednesday, October 01, 2008 1:52 PM
To: Tomcat Users List
Subject: Unified EL question

Hi all.

Probably not the right place to ask this but not sure there where else so
here it is. Now that all my clients have upgraded to tomcat 6.0.18 (from
various rather old versions) i am starting to write any new webapps using
jsp 2.1 including Unified EL but i am even already running into a stupid
problem and can only assume i am doing something wrong or otherwise nobody
would be using tomcat in the first place. Below is a small snippet of code
to illustrate:

A javabean:

package a.pkg;
class ABean {
  public String getString() {
    return "Hello world!";
  }
}

A jsp page:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<jsp:useBean id="thbean" class="a.pkg.ABean" scope="session">
  <jsp:setProperty name="thebean" property="*"/>
</jsp:useBean>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>A title.</title>
    </head>
    <body>
<p>The string is: ${sessionScope.thebean.string}</p>
     <BR><BR>__________ Information from ESET NOD32 Antivirus, version of
virus signature database 3486 (20081001) __________<BR><BR>The message was
checked by ESET NOD32 Antivirus.<BR><BR><A
HREF="http://www.eset.com">http://www.eset.com</A><BR>  <BR><BR>__________
Information from ESET NOD32 Antivirus, version of virus signature database
3486 (20081001) __________<BR><BR>The message was checked by ESET NOD32
Antivirus.<BR><BR><A HREF="http://www.eset.com">http://www.eset.com</A><BR>
</body>
</html>

All the tutorials and samples and such i can find on the net suggest the
output from this should be:

The string is: Hello world!

but i get:

The string is: ${sessionScope.thebean.string}

I just cant find anything on the net to suggest why this would happen but
plenty to say it should work. Has anybody got any ideas where i am going
wrong?
Am doing this in linux using tomcat 6.0.18 and openjdk 1.6.0.

Thanks in advance,
John



__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3486 (20081001) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org