I'm trying to use ace:fileEntry
to upload a picture, as I read this component requires a submit from h:commandButton
in order to start downloading. My problem is that when I switched my ice:commandButton
with h:
, my managed bean (which is in Conversation Scope) gets created again (@PostConstruct
called) and the method in h:commandButton
and also the fileEntryListener
aren't called anymore.
And as another problem that might be causing this is that when I first enter my page the managed bean gets created and I call conversation begin, but when I do a second request (from a commandLink
) the managed bean is created again, and a new conversation is started, after that you can play how long do you want the managed bean doesn't get created again.
Back to my initial question, if I have ice:commandButton
the managed bean ins't created again, if it's with h:
it gets created again.
And to add a little bit more fun in it, if I remove the rendered attribute (which resolves to true) from ace:fileEntry
the fileEntryListener
is called, but the action from h:commandButton
isn't called no matter what.
I tried to add explicit ids to the components, tried to change ice:form
with h:form
.. nothing.
Please Help.
Ps: why ICEfaces 2 can't work with all ice components, why does it requires h:commandButton
, instead of ice:commandButton
, why the new JSF 2.0 stuff with f:selectItems
backed by a regular list isn't working with ice:selectOneMenu
, works just with h:selectOneMenu
? What's up with ICEfaces ? And why CDI doesn't work as expected, with Seam 2 also I had problems with conversations called twice .. ps2: if I don't navigate to another view ?cid=1
isn't present in the URL.
2 回答
现在,有了 ace:fileEntry 和 h:commandButton,ice:commandButton 不能使用的原因是因为它是一个 AJAX 组件,浏览器不会在 AJAX 提交中上传文件。即使使用 HTML5,它也不是自动的,必须使用新的 File 和 XmlHttpRequest API。在 HTML4 浏览器中,只有完整的页面、完整的表单、提交才会上传文件内容,并且只有 h:commandButton 以这种方式操作。有关更多详细信息,您可以在页面顶部附近看到此说明:
http://wiki.icefaces.org/display/ICE/FileEntry
对于我们的 ice: 组件,它们是 h: 组件的扩展变体,例如 ice:selectOneMenu,它们缺少一些新的 JSF 2 功能,因为我们一直专注于更新的高级组件环境,因为客户对富客户端的需求-侧组件。同样,重点是保持与 ice:组件的向后兼容性,以简化客户从 ICEfaces 1.8.x 到 ICEfaces 2.x 的迁移,而不是改变这些组件的行为。但我们仍在积极维护和改进 ice:组件,并将很快添加新功能。随意在我们的 Jira 系统中创建任何增强请求,并对任何现有条目进行投票,因为这确实指导了我们的开发优先级。
- 马克·科莱特
我是 ICEfaces 组件团队的 Mark Collette,希望我能回答您的一些问题。
您的大多数问题似乎与 CDI 集成有关,而不是与组件本身的问题有关。我知道症状会根据您使用的组件而变化,但我认为这是因为 ice: 组件使用 AJAX 而 h: 组件不使用。很多时候,与其他框架的集成问题在 AJAX 交互中比在整页 GET/POST 交互中更容易观察到。因此,您的问题可能是由于我们的 CDI 集成或您的应用程序的配置造成的。因此,请查看我们关于在 CDI 中使用 ICEfaces 的文档,如果您仍然遇到任何问题,我建议您将详细信息发布到我们的论坛。
http://wiki.icefaces.org/display/ICE/Using+ICEfaces+with+CDI
http://www.icefaces.org/JForum/forums/list.page
[对不起,但这个论坛不允许我发布超过 2 个链接,所以我会将我的其余信息拆分到另一个帖子中,希望这能奏效]
- 马克·科莱特