File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How to access a bean in a servlet file? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "How to access a bean in a servlet file?" Watch "How to access a bean in a servlet file?" New topic
Author

How to access a bean in a servlet file?

Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68
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?


Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Jeff Halleux
Greenhorn

Joined: Jan 15, 2002
Posts: 2
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 ?
 
 
subject: How to access a bean in a servlet file?
 
Threads others viewed
JSP to Servlet
Using bean declared in JSP from Servlet
Servlets using beans' methods
depolying servlet on weblogic server domain
Servlet - EJB - JSP
MyEclipse, The Clear Choice