-
1. Re: Seam component that extends class cannot be invoked from JSF
mimik789 Jun 26, 2009 1:40 PM (in response to kiekie96)Hi
I also would like to see solution/explanation for that particular case.Is it possible to have base class (abstract/concreate) - that share common logic for a further seam component(s) which extends that class. I would like also to use seam annotations like @Logger, to provide common logger for further seam components that extend that base class (without using @Name in that base class).
is that even possible?
example
(I know that I could use @Role annotation to get similar effect, but this question is
in general about inheritance support in Seam for it's components)base class (not meant to be directly created as seam component = no @Name annotation)
public class Counter { @Logger final Log log; private int count; public Counter() { log.debug("counter constructed"); } ... }
seam components that share common logic + common logger from preceding base class
seam comonent1 in application scope
@Name("applicationCounterAction") @Scope(ScopeType.APPLICATION) public class ApplicationCounterAction extends Counter { public ApplicationCounterAction() { log.debug("application counter constructed"); } public synchronized void setCount(int count) { super.setCount(count); //SessionRenderer.render("all"); } ... }
seam component2 in session scope
@Name("sessionCounterAction") @Scope(ScopeType.SESSION) public class SessionCounterAction extends Counter { public SessionCounterAction() { log.debug("session counter constructed"); SessionRenderer.addCurrentSession("all"); } public void setCount(int count) { super.setCount(count); //SessionRenderer.render("all"); } ... }
-
2. Re: Seam component that extends class cannot be invoked from JSF
empy Feb 19, 2010 3:02 PM (in response to kiekie96)Hi,
yep, that should work.
It did in a similar case for me.regards,
Mathias