File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP  usebean type Vs class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP  usebean type Vs class " Watch "JSP  usebean type Vs class " New topic

JSP usebean type Vs class

Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191
Hi folks,
Can anybody explain the difference between the "type" and "class" attributes in <jsp:usebean> tag.

Stefan Evans

Joined: Jul 06, 2005
Posts: 1517
Its all explained here:

In short:
"type" specifies the type of the scriptlet variable created.
"class" specifies the class of the variable to be created if it is null.

a contrived example:
<jsp:useBean id="date" type="java.util.Object" class="java.util.Date"
Object date = new java.util.Date();
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63053

A slightly more up-to-date "syntax card":
[ March 20, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: JSP usebean type Vs class
It's not a secret anymore!