wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Bean import/reference problem [1/2 solved] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Bean import/reference problem [1/2 solved]" Watch "Bean import/reference problem [1/2 solved]" New topic
Author

Bean import/reference problem [1/2 solved]

Aivis Vidins
Greenhorn

Joined: Nov 15, 2011
Posts: 3
Hallo,

I'm fairly new to Eclipse and JSP/Beans, but I'm working on a little project that uses all of that.

I made a project that contains a .jsp file and another ejb project that contains a stateless session bean. I would like to use that bean in that .jsp file, but I don't really know how.. I goes that I have to have some kind of reference to that ejb project, so I looked around and found a section called "Project References" in the properties of the JSP project.. now I checked the checkbox next to my ejb project assuming that it would make some kind of connection between the two that would allow me to use that bean in my .jsp but so far I haven't had any success.

So my question is pretty much:

How do I use a bean that is in project B in my project A? (in Eclipse)

I did try to import the bean, but I always get a "Import cannot be resolved" error. :(

[edit]New problem - I found where you can reference the EJB probjec (Build path > Configure build path > Projects > Add...), but I still keep getting the following error:
"Only a type can be imported. beans.TestSessionBean resolves to a package"

So can someone please help me with this? :|

[edit 2]So after looking around... it seems like I would have to add a project to the build path of the JSP project, which I did... (right click on project > properties > build path > project > add..), but it still won't find the bean class. Also, I also see the classes from the JSP project in the built, and not the beans which should be there too ,right? So I'm still having the same problem. :(

Or do I have to edit the web.xml file? Because it keeps popping up when I look for this topic, but I can't figure out if I'm supposed to edit it or not.. :x
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

The proper way to do this (well, from an Eclipse only viewpoint) is to add the EJB project to your web app project, which is what you did. So there must be something else going on.

"Only a type can be imported. beans.TestSessionBean resolves to a package"


Is TestSessionBean really a package? Perhaps you should post the source code form both the bean and the jsp.


JBoss In Action
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Bean import/reference problem [1/2 solved]