Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Bean Disscussion  RSS feed

Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this webapp that has several jsps and a few servlets. All of these will need to access varios bean methods. How ever I would like to store an instance of my beans in either the application scope or the session. I want to this the best way possible.
Originally I had a servlet setup in my web.xml to automatically load on startup. This servlet will create an instance of all my beans and load them in the session.
I would then have one jsp that was included with everyother jsp page that set the instances of each servlet to a local variable.
After talks with people around me, they say why not just do the <useBean> tag in each one of the jsps. I say no cause I dont want to type <useBean> for each Bean method for every jsp page that I have... On the other hand, I could use a <useBean> in one jsp file and have that file included in eevry jsp.
I am trying to do this in the most efficient way, because most of my beans call a db, and I wat to minimize calls and things like that.
What should I do? What do most peopel do?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!