File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes calling javabeans from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "calling javabeans from a servlet" Watch "calling javabeans from a servlet" New topic

calling javabeans from a servlet

Bron Czimes
Ranch Hand

Joined: May 09, 2004
Posts: 44
hi there,

i have a servlet and I need to create a new instance of a javabean i have also created, but my servlet is about four folders away from the javabean.
my servlet is within WEB-INF/classes/com/mycompany and my javabeans are just within my context root. it won't allow me to create my java beans within the servlet, giving me an error of "it cannot resolve the symbol" blah blah.
i know that you are able to import the web-inf folders into jsp's n so on, so that you are able to make use of servlets etc, but can it work the other way around, so that i can make use of my javabeans?
I'm assuming that I have my servlets in the right spot.
All my files are within the context root, except for web.xml which is in WEB-INF, and my servlets which are in WEB-INF/classes/com/mycompany. Is this correct?
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Hi Bron,

All class files for a web application need to be placed either
- in the WEB-INF/classes folder (with appropriate package structure) OR
- packaged in a jar and placed in the WEB-INF/lib folder

Your bean classes too would need to placed in one of the above locations.

Bron Czimes
Ranch Hand

Joined: May 09, 2004
Posts: 44
I agree. Here's the link:
subject: calling javabeans from a servlet
It's not a secret anymore!