[jboss-user] [JBoss Seam] - Re: Seam 2.0: Why does @Datamodel require a setter?
pete.muir@jboss.org
do-not-reply at jboss.com
Tue Aug 28 06:51:04 EDT 2007
So that when you do:
@Name("eventLister")
| public class EventListerAction {
|
| @DataModel(value="eventList", scope=ScopeType.PAGE)
| private List<Integer> eventList;
|
| @DataModelSelection("eventList")
| private Integer selectedEvent;
|
| @Factory("eventList")
| public void initRequestList() {
| ...
| }
|
| public void selectEvent() {
| log.info(selectedEvent);
| }
|
| }
That eventList isn't null (it would be unless we did this set). This seems like a reasonable assumption to me (and anyway we can't change this behaviour now!). This is the relevant commit:
http://fisheye.jboss.com/browse/JBoss/jboss-seam/src/main/org/jboss/seam/Component.java?r=1.93#l734
anonymous wrote : I always thought that @DataModel works pretty much like @Factory: Once a datamodel is created it becomes a completly independent, fist-class component. The difference is of course that @Factory is called automatically and @DataModel is only used if the annotated bean is called.
@DataModel is like @Out with additional logic to "convert" the data from one type to another (e.g. List -> DataModel). However it has an additional bit (reinjecting the value when using PAGE scope) - that which we are discussing.
I've committed a fix to CVS, let me know how it works out.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078685#4078685
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078685
More information about the jboss-user
mailing list