0

using ejb3 annotation,dependency-injection

asked 2007-01-04 19:09:27 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4087003

By: korsdal

hi,
i am trying to use zk instead of jsf.
in my jsf-controller-classes (managed beans) i use the @EJB annotation to inject my controller with my ejb-DAOs.

it works perfectly. EJB-sepc says you can only use this dependency-injection (@EJB) with managed classes.

now i try to use the injection in my zk-controller, which basically works as a data-binding manager to submit new form-data.
(as you demenstraded in your latest data-binding smalltalk).

no i try to inject this class with my ejb-DAO as well, but it doesn't work. (@EJB annotation doesn't do anything, it just get ignored.).


#1. how can i make my zl-controller class "managed" like a jsf-managed-bean ?

#2. any other suggestions ?

thanks for any help.

tim

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2007-01-05 00:59:34 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4087438

By: henrichen

Can you provide a "very" simple example and let's see what we can do? (In jsf form and in zk form)

/henri

link publish delete flag offensive edit

answered 2007-10-14 18:37:14 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4568162

By: arrigonineri

I have the same problem.
Here is a simple Window what does not work propertly:
package test;

import org.zkoss.zul.*;
import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkforge.dojo.*;
import javax.ejb.*;
import mario.*;

public class Main extends Window
{

@EJB
MarioLocal m;

private Button b = new Button("test");

public Main()
{
super(null, "none", false);
setWidth("100%");
setHeight("600px");

b.addEventListener(Events.ON_CLICK, new EventListener()
{
public void onEvent(Event evt)
{
b.setLabel("" + m);
}
});
this.appendChild(b);
}
}

MarioLocal is the local interface to a stateless EJB in the same EAR.
when the button is pressed, m is still null.
If I implement the same in JSF m is correctly retrieved.

I cannot attach the whole zip, if you need I can upload it.

thanks for any help.
Mario

link publish delete flag offensive edit

answered 2010-11-15 18:26:17 +0800

aktejo gravatar image aktejo
155 3

Yeah, I think ZK should aware on Java EE 6, by providing EJB Annotation to access Local SessionBean. We do need it.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-01-04 19:09:27 +0800

Seen: 626 times

Last updated: Nov 15 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More