GeeCON Prague 2014*
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


JavaRanch » Java Forums » Java » JSP
Bookmark "JSP  usebean type Vs class " Watch "JSP  usebean type Vs class " New topic
Author

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.
regards

Awais
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
Its all explained here:
http://java.sun.com/products/jsp/syntax/1.2/syntaxref1217.html#8865

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
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

A slightly more up-to-date "syntax card": http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html
[ March 20, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: JSP usebean type Vs class