• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access a Bean with application scope

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a bean which has a constructor with some arguments
I have to invoke it thtough JSP
I am doing follwing thng in my scriptlet tag
<% SomeObj x = new SomeObj(...);
bar.FooBean foobar = new FooBean(x);
application.setAttribute("foobar",foobar);
%>
where foobar is the name of the bean class
now my doubt is how can i retrive the bean
is there any method like
application.getAttribute() or some other way???

 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think that's the wrong way to call a bean ...i ,am not able to understand that why are you using set/getAttributes()...your don't need them ....you have to use a bean via introspection.
just declare functions into a bean and keep calling them into the jsp .....simple .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic