File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:useBean 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 "jsp:useBean" Watch "jsp:useBean" New topic


Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 389
Hello Ranchers,

In HFS, Chapter Scriptless JSP's,
what happens if we declare a type but not a class <jsp useBean id = "person" type="foo.person" scope = "page"/> ?

The books says that, if the type is used without class, the bean must already exists?. What does this mean?

Does this mean, there would be a statement something like
request.setattribute("person", p) in the servlet;

so if the setAttribute statement does not exists, will the useBean property create one?

I am getting confused?

SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+
Harish Yerneni
Ranch Hand

Joined: Sep 15, 2004
Posts: 94
yes. It will generally create one but not in this case because it doesnt know which instance it should create of

foo.Person p = new (of what)?

foo.Person (type)
foo.Employee(class) in usebean tag.

Hope it helps!

SCJP 1.4 | SCWCD 1.4 | SCJD (WIP)
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

"Rajesh", we don't have many rules around here but our naming policy is one of them. Not complying with the policy will lead to your account becoming locked. This warning hopefully will prevent that from happening, but some action is required on your part.

Please review the policy here and you can change your Publicly Displayed Name here.

A good workman is known by his tools.
I agree. Here's the link:
subject: jsp:useBean
It's not a secret anymore!