i have tow beans and i inject the second in the the first but when i call a method from the seconde insid the first , dwr doesn't khnow it, this is my code of tow beans and dwr.xml
this is dwr.xml :
<dwr>
<allow>
<create creator="new" javascript="Hello">
<param name="class" value="eu.sorinzo.lc.Hello"/>
</create>
</allow>
</dwr>
Bean hello
package eu.sorinzo.lc;
import eu.sorinzo.lc.common.HelloYou;
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
@Named
@SessionScoped
public class Hello implements Serializable{
@Inject
private HelloYou helloYou;
public String sayMyHello() {
return helloYou.MyHelloYou();
}}
Bean helloYou
package eu.sorinzo.lc.common;
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class HelloYou implements Serializable{
public String MyHelloYou(){
return "success MyHelloYou";
}}
if the the method sayMyHello of Hello bean returns a simple message , when i call it , it works good but if it returns the message of MyHelloYou() it gives a error message:
console.trace(): engine.js:789
dwr.engine._debug() engine.js:789
dwr.engine._debug() engine.js:789
dwr.engine.defaultErrorHandler() engine.js:180
dwr.engine.remote.handleException() engine.js:921
<anonyme> engine.js line 584 > eval:6
<anonyme> engine.js line 584 > eval:2
dwr.engine._eval() engine.js:584
dwr.engine.transport.xhr.stateChange() engine.js:1632
dwr.engine.transport.xhr.send/batch.req.onreadystatechange() engine.js:1477
"Error: undefined, Error
In the dwr.xml you can use just :
new: Which uses the Java 'new' operator.
static: Which uses the 'getInstance()' method (by default) to obtain an instance of the class.
none: This does not create objects. See below for why. (v1.1+)
scripted: Uses a scripting language like BeanShell or Groovy via BSF.
spring: Gives access to beans through the Spring Framework.
jsf: Uses objects from JSF. (v1.1+)
struts: Uses struts FormBeans. (v1.1+)
pageflow: Gives access to a PageFlow from Beehive or Weblogic. (v1.1+)
I think that DWR doesn't support injection if you work with JEE6 CDI and it works juste with the creators type written before