This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to instantiate Bean in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to instantiate Bean in servlet" Watch "How to instantiate Bean in servlet" New topic
Author

How to instantiate Bean in servlet

Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi!
I'm doing a web application using jsp's. How do i instantiate a bean in a servlet (controller).
Regards
Danish Shaukat
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 13005
    
    5
Just like creating any other object.
MyBean b = new MyBean();
AFAIK the servlet api does not provide any shortcut initialization like the JSP <jsp:setProperty ....>
(but that is rather inefficient anyway)
Bill
 
Have you checked out Aspose?
 
subject: How to instantiate Bean in servlet
 
It's not a secret anymore!