-
1. Re: Method not found ??
nimo22 Mar 9, 2011 9:38 AM (in response to nimo22)I found the error. I use weld and inject a bean A (which has this method) into another bean B which I referenced by @Named.
You can reproduce the error by doing these steps:
@Named
class A{
public void methodWithParam(String s){}
public void methodWithoutParam(){}
}
@Named
class B{
@Inject A injectedA:
}
Now, I reference my method within the view:
This does work:
<a4j:commandLink value="click" action="#{b.injectedA.methodWithoutParam}" ../>
This does NOT work (because it has parameters):
<a4j:commandLink value="click" action="#{b.injectedA.methodWithParam('mystring')}" ../>
But when using this, the method with parameters works:
<a4j:commandLink value="click" action="#{a.methodWithParam('mystring')}" ../>
This is very strange ! Is that a bug in weld ?
-
2. Re: Method not found ??
ilya_shaikovsky Mar 9, 2011 10:57 AM (in response to nimo22)need to check more still not looked more deeply.. but think not in Weld but at EL-evaluation at some level.
B.t.w. does it works with h:command ?
-
3. Re: Method not found ??
nimo22 Mar 9, 2011 1:24 PM (in response to ilya_shaikovsky)It does also not work with h:commandLink. So it is not a rf-issue.
If I change bean A to a stateless ejb, the indirect call of the methodWithParam via bean B will work.
If I reference the methodWithParam directly from bean A, then it will also work.
But injecting the (non ejb) managed bean A into B (which both are session scoped beans) and calling methodWithParam indirectly via b.injectedA.methodWithParam('mystring') will definitly not work - it only works for methods without params.
When changing bean A to a stateless ejb, the indirect call of b.injectedA.methodWithParam('mystring') via bean B will work. Strange.
.methodWithParam -
4. Method not found ??
geschtli Mar 9, 2011 2:14 PM (in response to nimo22)Hi Stephan
Have you test it with
@Named
@SessionScoped
class A.....
It can be, that in your next call, the bean is not more.
-
5. Re: Method not found ??
nimo22 Mar 10, 2011 2:33 AM (in response to geschtli){quote}But injecting the (non ejb) managed bean A into B (which both are session scoped beans) and calling methodWithParam indirectly {quote}
Bean A was already declared with SessionScoped.