On 4/25/2012 7:46 AM, pgoransson wrote:
The only way I can get this to work is the following:
<center>
<jsp:useBean id="foo" class="FooBean" />
${foo.bar}
</center>
Do you need to have the useBean tag before your expression language
tags? If so, this is not clear in the slides. Please let me know.
Your observation is indeed correct. The slide is in fact misleading indeed.
${foo.bar} assumed that there is a bean already created and saved in
a scope object using "foo" as a key.
I updated the slide.
-S
Thanks,
Peter
On Apr 24, 7:01 pm, pgoransson<[email protected]> wrote:
Hi,
I am working through the Web Programming course for the past month. At
this point I am stuck a little bit on Expression Language.
You have several slides which show this following are equivalent:
<center>
<jsp:useBean id="foo" class="FooBean" />
<%= foo.getBar() %>
</center>
.............................
<center>
${foo.bar}
</center>
However, this is causing some confusion for me. Where is id="foo" ever
set in the second case? In other words, how does this ${foo.bar}to
reference the class FooBean.
I tested this out in the simplest case and it does not work. I created
a class named FooBean and put it in "mypackage" . The first version
works fine. The second version using expression language is not
working. It seems the only way to get the second one working would be
to do a<jsp:useBean id="foo" class="Foobean"/>
If not, there must be something I'm doing wrong.
Thanks,
Peter
--
-------------------------------------------------------------------
Sang Shin, [email protected]
Founder and Chief Instructor of JPassion.com
http://JPassion.com/portal/instructors/sang-shin-schedule (Bio)
http://www.javapassion.com/webinars (Webinars)
http://www.linkedin.com/in/javapassion (Linkedin)
http://twitter.com/javapassion (Tweeter)
Life is worth living... with Passion!
----------------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups
"JPassion.com: Web Programming Basics" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jpassion_web?hl=en.