Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bean import/reference problem [1/2 solved]

 
Aivis Vidins
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
 
Peter Johnson
author
Bartender
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic