File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

jsp:useBean

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
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
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
Sheriff

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: http://aspose.com/file-tools
 
subject: jsp:useBean
 
Similar Threads
value for useBean class is invalid
Using type without class - page 354
jsp:useBean possible error in HFSJ
Head First Servlets and JSP:SCWCD Question
Scriptless JSPs: Type without class