You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Heping Zhang <ph...@gmail.com> on 2007/05/18 11:59:23 UTC
any idea to inject a ejb to tapestry?
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.
Re: any idea to inject a ejb to tapestry?
Posted by Heping Zhang <ph...@gmail.com>.
thank you very much! I will try that.Thank you again!
Re: any idea to inject a ejb to tapestry?
Posted by SergeEby <sd...@hotmail.com>.
Hi,
This post might be helpful:
http://www.nabble.com/Inject-EJB-3-into-Tapestry-4-page-tf2841494.html#a8468544
/Serge
Heping Zhang wrote:
>
> 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 this message in context: http://www.nabble.com/any-idea-to-inject-a-ejb-to-tapestry--tf3776725.html#a10681972
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: any idea to inject a ejb to tapestry?
Posted by #Cyrille37# <cy...@gmail.com>.
Andrea Chiumenti a écrit :
> With T4 ?
> Have a look here:
> http://hivemind.apache.org/hivemind1/hivedocs/service/hivemind.lib.EJBProxyFactory.html
>
I've added a copy of that mail in the Tapestry's wiki like now we can
search "EJB3" in the wiki and find it.
http://wiki.apache.org/tapestry/InjectEJB3
cyrille.
>
> ciao,
> kiuma
>
> On 5/18/07, Heping Zhang <ph...@gmail.com> wrote:
>> 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.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: any idea to inject a ejb to tapestry?
Posted by Andrea Chiumenti <ki...@gmail.com>.
Then it shouldn't be hard to create an hivemind service that does what
you are doing in your page
kiuma
On 5/18/07, Heping Zhang <ph...@gmail.com> wrote:
> thanks for your reply! however, as I use ejb3, it seems that hivemind
> doesn't support *EJB3:
> http://www.nabble.com/EJB3-and-EJBProxyFactory...-t943423.html Since this
> message is one year ago, I don't know is there any more development of
> hivemind on this subject? Or any other way to inject slsb to tapestry?*
> I also looked through HiveMind 2's homepage, but it does not mention this
> thing. So, I just have no idea.
> Thank you!
>
>
>
> 2007/5/18, Andrea Chiumenti <ki...@gmail.com>:
> >
> > With T4 ?
> > Have a look here:
> >
> > http://hivemind.apache.org/hivemind1/hivedocs/service/hivemind.lib.EJBProxyFactory.html
> >
> > ciao,
> > kiuma
> >
> > On 5/18/07, Heping Zhang <ph...@gmail.com> wrote:
> > > 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.
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: any idea to inject a ejb to tapestry?
Posted by Heping Zhang <ph...@gmail.com>.
thanks for your reply! however, as I use ejb3, it seems that hivemind
doesn't support *EJB3:
http://www.nabble.com/EJB3-and-EJBProxyFactory...-t943423.html Since this
message is one year ago, I don't know is there any more development of
hivemind on this subject? Or any other way to inject slsb to tapestry?*
I also looked through HiveMind 2's homepage, but it does not mention this
thing. So, I just have no idea.
Thank you!
2007/5/18, Andrea Chiumenti <ki...@gmail.com>:
>
> With T4 ?
> Have a look here:
>
> http://hivemind.apache.org/hivemind1/hivedocs/service/hivemind.lib.EJBProxyFactory.html
>
> ciao,
> kiuma
>
> On 5/18/07, Heping Zhang <ph...@gmail.com> wrote:
> > 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.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: any idea to inject a ejb to tapestry?
Posted by Andrea Chiumenti <ki...@gmail.com>.
With T4 ?
Have a look here:
http://hivemind.apache.org/hivemind1/hivedocs/service/hivemind.lib.EJBProxyFactory.html
ciao,
kiuma
On 5/18/07, Heping Zhang <ph...@gmail.com> wrote:
> 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.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org