• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

jsp usebean question regarding an existing value

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey im preparing for SCWCD and reading HF Servlets. Im a little confused with jsp:useBean.

If you have an existing value (dont worry about scope).

Do you use the class attribute or the type attribute to retrieve the existing value? Or can you use either.

I thought these are the rules, am i correct?

1. You can use either either class or type or both class and type attributes to retrieve an existing bean object in scope provided.
Is this correct?

2. You can use class if you dont have an existing bean object in scope and need to create a new bean instance

3. You cant use type f you dont have an existing bean object in scope and need to create a new bean instance
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi jim
try examples with all the scenarios you mentioned here in your post if you have enough time.
 
Jim So
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am all good now thanks. Re-read page 356

If type is used withut class, the bean must already exist.

If class is used (with or without type) the class must not be abstract, amd must have a public no-arg constructor.
 
Water! People swim in water! Even tiny ads swim in water:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic