• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP usebean type Vs class

 
Awais Bajwa
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
Can anybody explain the difference between the "type" and "class" attributes in <jsp:usebean> tag.
regards

Awais
 
Stefan Evans
Bartender
Posts: 1780
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic