如何在没有action触发的情况下实例化一个组件

郁闷,整了这么长时间,都没整出个结果。好多情况下就是这样,你越是不想干的事,不得不干,想干的事又没时间干。
这几天在seam forum上提问,终于有回答:
SmokingAPipe
 
If the cnMessages component has not been accessed from a page, then Seam will not have initialized it (ie, called the factory). Just because your other class is trying to access it, Seam doesn't know anything about that and won't magically call the factory method. That class will have to call the factory method manually, or do it some other way.
 
... ...
 
You need to have a @Begin method that initializes the cnMessages member. You're calling getCnMessage() before cnMessages has been set to anything. Tell me where is cnMessages being set? If you can answer that question you'll see what's going on. 
 
下一步该怎样呢? 
 
posted @ 2007-03-04 12:06  cuibq  阅读(111)  评论(0编辑  收藏  举报