您的位置:首页 > 其它

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

2007-03-04 12:06 309 查看
郁闷,整了这么长时间,都没整出个结果。好多情况下就是这样,你越是不想干的事,不得不干,想干的事又没时间干。
这几天在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.

下一步该怎样呢?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐