Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Need Help - jsp:useBean

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at jsp:useBean specification

<jsp:useBean id="beanInstanceName"
scope="page|request|session|application"
{
class="package.class" [ type="package.class" ]|
beanName="{package.class | '${' Expression '}' | <%= expression %>}" type="package.class" |
type="package.class"
}
{ /> | > other elements </jsp:useBean> }



as you can see "beanName can do everything "class" can do it even have support to EL and expression . what is the significance of class ?

Can we use both "class" and "beanName" together? the specification says its not possible.

Do write whatever you know about this two attribute even though it may not related to this question.

Regards,
Ranajit
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a little explanation from JWebPlus:


<jsp:useBean id="name" scope="page|request|session|application" typeSpec />
typeSpec ::=class="className" ||
class="className" type=="typeName" ||
type="typeName" beanName=="beanName" ||
type="typeName"
If the Bean is not already instantiated then the container looks for class or beanName attribute to instantiate an object and then if type is present, it casts the object to the type.
Normally, type is used when you want to cast the bean object to some interface or superclass. In such a case, class attribute specifies the class of the bean and type specifies the interface.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic