[jboss-user] [EJB 3.0] - any idea to inject a ejb to tapestry?
phoenix.zhp
do-not-reply at jboss.com
Wed May 16 21:54:23 EDT 2007
hi, I use tapestry as web tier and want get a slsb in this tier. this is my code:
public abstract class Home extends BasePage {
// @EJB
// Calculator bean;
public String getResult() {
// Double message = bean.calculate(11, 22, 0.08, 44);
// return message.toString();
InitialContext ctx = null;
Calculator bean = null;
try {
ctx = new InitialContext();
bean = (Calculator) ctx
.lookup("ejb3TapestryJboss/CalculatorBean/local");
} catch (NamingException e) {
e.printStackTrace();
}
Double message = bean.calculate(22, 22, 0.08, 22);
return "ok! " + message.toString();
}
}
When I use JNDI's lookup, as showed above, it works. But when I want to inject a slsb to this page, as the commented code showed, it get nothing. No bean is injected. do I misues this annotation? and how can I inject a bean to tapestry? or I can only do this in servlet? By the way, I use jbossAs 5 beta2 as the server.
Thanks for your help in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046342#4046342
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046342
More information about the jboss-user
mailing list