• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access a bean in a servlet file?

 
Niu Xiuyuan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use <jsp:useBean.... create a bean in a jsp file and set its scope to "session",when the file redirect to a servlet file,i don't know how use the instance of bean in the servlet?
 
Jeff Halleux
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that <jsp:useBean> action with a scope equals to "session" will put the object in the pageContext associated with the jsp page using a session scope. Therefore, this object is unavailable in the session object that you get with req.getSession() under a servlet.
Let's say you have defined an HttpSessionAttributeListener for the context, setting/unsetting session attributes in this context using jsp:setProperty will not fire any events either.
Rather ackward ain't it ?
Any comments ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic