Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Bean import/reference problem [1/2 solved]  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 5856
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!