`
illiqiang
  • 浏览: 10558 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

在servlet中访问seam

 
阅读更多
在使用seam的时候,文件上传通常使用servlet来处理.

如果在上传完文件后要进行一些其他操作,如读写数据库操作.则使用seam组件又较为方便.

有两种方法可以采用

1:    --------这个方法我试了,能访问到组件了,但是seam的ServletContexts.getInstance().getRequest();为空,传说中的无状态?
这个适合做测试
import org.jboss.seam.Component;
import org.jboss.seam.contexts.Lifecycle;
Lifecycle.beginCall();

XX xx =  Component.getInstance("组件名", true);

Lifecycle.endCall();


上述这种方法 貌似只能取得无状态的组件.

2:  ----------这个方法我试了好像不行额,(应该是我没配置对)

则是将该servlet 加入seam的context-filter(src\META-INF\components.xml)

<web:context-filter regex-url-pattern="/JSON/*|/services/*|/servletName" />
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics