File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes problem with EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with EL" Watch "problem with EL" New topic
Author

problem with EL

mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
hi

in a servlet i do

in the jsp, i do

that work fine...

i work like to use EL now...

i tried


but only ; is displayed...

any idea?

thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

As per forum instructions, what version of JSP?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
i use netbeans 5 and java 1.5
if i check the jsp netbeans created.... there are some comment who talk about release 1.1
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Netbeans is an IDE, not a servlet container.
Find out what version of JSP the embedded container (Tomcat) supports.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

Indeed.

And if it turns out that your JSP version is indeed 1.1, then it's much too antiquated to even think about uaing the EL.

If so, you'll need to upgrade to Tomcat 5 which supports JSP 2.0.

The JSP FAQ covers this and how to set up your web.xml properly once you've updated your Tomcat version.
[ September 11, 2006: Message edited by: Bear Bibeault ]
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
netbeans use tomcat 5.5 maybe the comment is just a warning to said we support min 1.1 release...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

Then be sure that your web.xml is set up using the Servlets 2.4 Schema rather than the Servlets 2.3 DOCTYPE. You'll find instructions in the JSP FAQ.

Then try something simple to make sure that the EL is enabled. Something like:

3 + 4 = ${3+4}

and see if it emits 7. If so, the EL is ok and your problem may lie elsewhere.
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
Originally posted by Bear Bibeault:
Then be sure that your web.xml is set up using the Servlets 2.4 Schema rather than the Servlets 2.3 DOCTYPE. You'll find instructions in the JSP FAQ.

Then try something simple to make sure that the EL is enabled. Something like:

3 + 4 = ${3+4}

and see if it emits 7. If so, the EL is ok and your problem may lie elsewhere.


ya i see 7
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

OK. good. That eliminates setup issues as a possible suspect (which is usually the problem 90% of the time).

Now, we employ basic debugging techniques.

Place the getproperty version and the EL version side-by-side on the page. Do they yield the same output?

If not, I'd next suspect bean structure issues. The EL is very picky about properly formatted beans. Post your bean code.
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
Originally posted by Bear Bibeault:
OK. good. That eliminates setup issues as a possible suspect (which is usually the problem 90% of the time).

Now, we employ basic debugging techniques.

Place the getproperty version and the EL version side-by-side on the page. Do they yield the same output?

If not, I'd next suspect bean structure issues. The EL is very picky about properly formatted beans. Post your bean code.


i don't really understand the getproperty and the EL version...


the javabean code
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

At first glance, your bean looks fine.

Originally posted by mark smith:

i don't really understand the getproperty and the EL version...


Place both notations on the page and see what you get.
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250
work fine now

to use bean in the jsp, does i always need to use

request.getSession().setAttribute("beanID",member);

in the servlet?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

If a bean of that name does not already exist, and you use class= on the useBean action, it will create a bean of that type using the default constructor.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with EL