使用自定义组件在 JSF 中创建弹出窗口
如果我在 JSF 页面上创建弹出窗口,我需要使用一个自定义组件。 它似乎使用了带有 CSS 隐藏和显示的 DHTML 技术,并在当前页面上创建了一个覆盖层,而不是一个正确的窗口。
就我而言,它是显示由 servlet 提供服务的图像。
我尝试了几件事,结果如下: 1)如果我使用
弹出窗口和图像会显示然后消失,因为 commandButton 会刷新页面。
2) 如果我将 commandButton 的类型更改为“button”,则操作字段中的 bean.displayImage
永远不会被调用,servlet 也不应该提供图像
3) 我还尝试将bean.displayImage
在 actionListener 字段中,并通过添加 ActionEvent e 作为参数来修改方法以防止页面刷新,但它的行为与 2) 我已经
没有想法了,可以有人帮忙吗?
提前致谢, 迈克尔
I've got a custom component that I need to use if I create a popup on a JSF page.
It seems it uses the DHTML technique with CSS hide and show and creates an overlay on the current page, and not a proper window.
In my case, it's to display an image that is served by a servlet.
I have tried several thing and here are the results:
1) if I use <h:commandButton action="bean.displayImage" onclick="mypopup.show()">
the popup and image are displayed then disappear because the commandButton refreshes the page.
2) if I change the type of the commandButton to "button", then bean.displayImage
in the action field is never called, neither is the servlet supposed to serve the image
3) I also tried putting the bean.displayImage
in the actionListener field and modifying the method by adding ActionEvent e as param to prevent the page from refreshing, but it then has the same behavior as 2)
I'm running out of ideas, can anyone help ?
Thanks in advance,
Michael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
功能需求并不完全清楚,但您可以使用
使其成为 ajax 请求并呈现页面的某些部分。像这样的东西:
The functional requirement is not entirely clear, but you could use
<f:ajax>
to make it an ajax request instead and render certain parts of the page.Something like: