This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes JavaBean Scope in JSP pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JavaBean Scope in JSP pages" Watch "JavaBean Scope in JSP pages" New topic

JavaBean Scope in JSP pages

Reema Patel
Ranch Hand

Joined: Jan 26, 2006
Posts: 169
Hello All,
I'm struck at understanding the scope of a JavaBean used inside a standard action element.

For example, considet the following code snippet:

To my surprise, the page works fine. I think the JSP engine should not have even compiled the page, cause the scope of the two elements is different. It should have flaged a compilation error.....

After digging into the work directory this is what I found from the generated servlet:

Pls. help...
[ October 21, 2006: Message edited by: Reema Patel ]
Reema Patel
Ranch Hand

Joined: Jan 26, 2006
Posts: 169
Since nobody has posted a reply...let me try to do some study here.
The same code with some modification now causes compilation error:

I'm still lost as to why does it happen so........
I agree. Here's the link:
subject: JavaBean Scope in JSP pages