Hello,

I am trying to make a simple "Hello World" JSF + EJB3 application.  I have 
gotten my JSF side working fine.  I have gotten some EJBs.  But somehow the JSF 
side can never find any beans.  Is it possible to do this?  From what I have 
read people have been able to access beans from within Servlets, and JSF works 
in the same system as a servlet so it seems like it should be possible... but 
for some reason it isn't finding it.

On my bean, I have:


  | package entities;
  | import javax.ejb.*;
  | import javax.persistence.*;
  | 
  | @Stateless
  | public class Status implements StatusLocal {
  | 
  |     public int getId() { return id; }
  | 
  |     public void setId(int id) { this.id = id; }
  | 
  |     private int id;
  | 
  |     public String getName() { return name; }
  | 
  |     public void setName(String s) { this.name = s; }
  | 
  |     private String name = null;
  | 
  |     public String getStatus() {
  |         return status;
  |     }
  | 
  |     private String status = "This is the status!";
  | 
  |     public void setStatus(String s) { this.status = "My bean says: " + s;   
                               }
  | 
  | }
  | 

I also have:


  | package entities;
  | 
  | public interface StatusLocal {
  | 
  |     public String getStatus();
  | 
  |     public void setStatus(String s);
  | 
  |     public String getName();
  | 
  |     public void setName(String s);
  | 
  | }
  | 

Then on the JSF side I have a Manager:

  | package webside;
  | 
  | import javax.annotation.EJB;
  | 
  | import entities.Status;
  | 
  | public class Managed {
  | 
  |     @EJB() Status status;
  | 
  |     public String getGreeting () {
  |         if(status == null) return "Oh no the status was null!";
  |         return status.getStatus();
  |     }
  | 
  |     public Managed() {
  |     }
  | }
  | 

I can use this within my JSF page, and every time I try to getGreeting, I get 
"Oh no the status was null".  So it isn't even finding the bean at all.  Is 
there a way to do this?

JSF seems like it would be an excellent companion to EJB!  And they are both 
within JBoss.  But if they can't send data back and forth they don't help!

Thanks


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952868#3952868

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952868

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to