This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Posts: 5856
7
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.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!