• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference betweenn c:set and jsp:useBean

 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have this basic question regarding the differnce between c:set and jsp:useBean.

Is the following right ?

If I don't specify the scope, the jsp:useBean takes page as the default scope (looks in the page scope only), but,
c:set starts looking for the attribute starting from the page scope ?

Is that right ?

Please correct me if I'm wrong ...

Thanks in advance ...
 
Ranch Hand
Posts: 242
Mac Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vassili,

See the basic difference between c:set and jsp:useBean is:
c:set is a JSTL tag
while jsp:useBean is a JSP action.

Second thing, you can use jsp:useBean either to retrieve a bean or create a bean object.
While c:set is used to set the property of an already existing bean not to create a bean or get a bean. c:set works somewhat similar to jsp:setProperty action for java beans.

And third thing,
there is no scope attribute for c:set(when you are using it with target attribute) JSTL tag as it is there for jsp:useBean JSP action.
And if you provide the value of target attribute as an EL expression, searching is from most restrictive scope to least restrictive scope.

Regards,
Khushhal
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q1) I want know when to use <c:set target>?
Q2)Please let me know things that we can do with bean in parallel with <c:set target> with code?
Q3) <c:set target> helps to add an entry in map isone advantage as to beans? Am i correct?
Q4) Please give simple code that helps me to undertand c:set target in parallel with bean actions?
 
reply
    Bookmark Topic Watch Topic
  • New Topic