[jboss-user] [EJB 3.0] - @EJB Injection in JSF Managed Bean
sisepago
do-not-reply at jboss.com
Mon Oct 30 10:14:24 EST 2006
Hi all ejb3 gurus,
i' am trying to use @EJB injection in a jsf managed bean class and i use the jbossas version 4.0.5.
I want to know if this scenario can work?
--- EJB 3 Codes
| @javax.ejb,Remote
| public Interface Service{
| public String meth1(Object o);
| }
|
| @javax.ejb.Stateful
| public class ServiceImpl implements Service{
| @PersistenceContext
| private EntityManager em;
| public String meth1(Test t){
| em.persist(t);
| return "success";
| }
| }
|
| the String "success" is for the redirection
|
| --- JSF Managed Bean class
| public class ManagedBean{
| private String field1="";
|
| @EJB
| private Service s1;
|
| public String getField1(){return field1;}
| public void setFied1(String f){field1 = f;}
|
| public String controller(){
| if(field1==null){
| return null;
| }else{
| return (s1.meth1(new Test(getField1()));
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981782#3981782
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981782
More information about the jboss-user
mailing list