jQuery in Action, 3rd edition
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in JSP standard tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in JSP standard tag" Watch "Doubt in JSP standard tag" New topic

Doubt in JSP standard tag

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

When I write

it shows error
my bean class Person is in default pacakge(no package)

but keeping everything same when I write

it works perfectly
I have changed my bean class Person default package to ashok package(Person class in ashok package)

I have doubt that the bean class should always be placed in a package ?if so why ?
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Generally the default package usage is discouraged, but I guess that the question is still valid...
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2099

Yes, the bean should be defined in a package.

This is to avoid instantiating the "wrong" bean ( if two beans with the same name are defined in the default package, for example your MyBean and somebody else's MyBean which is packaged in a .jar file inside your web-application, which one did you mean to be used with your jsp:UseBean....).

Have a look here Syntax jsp:UseBean
scope="page | request | session | application"
class="package.class" |
type="package.class" |
class="package.class" type="package.class" |
beanName="{package.class | <%= expression %>}" type="package.class"
/> |
> other elements </jsp:useBean>

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

thanks to all !!!
I agree. Here's the link: http://aspose.com/file-tools
subject: Doubt in JSP standard tag
It's not a secret anymore!