The moose likes Servlets and the fly likes Beans with JSP and Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Beans with JSP and Servlets" Watch "Beans with JSP and Servlets" New topic
Author

Beans with JSP and Servlets

Peter Murasky Jr
Greenhorn

Joined: Mar 13, 2001
Posts: 2
I have created a package which holds some beans I created I currently use the beans on jsp pages but I need to access the beans from a servlet also. Can you please show me the code to access beans from a servlet.
Thanks,
Peter
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11862
You create instances of Bean classes just like any other class in a servlet. There are no fancy shortcuts for setting and getting properties. Store the instance in the request for "request" scope, the session for "session" scope or the ServletContext for "application" scope.
Bill

------------------
author of:


Java Resources at www.wbrogden.com
 
 
subject: Beans with JSP and Servlets
 
Threads others viewed
TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP - I need some guidance.
How do i access locales created in EJB from JSP.
Problem with some JSPs moving to tomcat 4.1.12
How do i access locales created in EJB from JSP.
How to persist a Stateless Session Bean over several jsp pages?
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture