如何访问在模态面板中传递的参数
问题描述:
我有一个要求,在点击图像时我需要在模态面板上显示相同图像的较大尺寸。如何访问在模态面板中传递的参数
为此,我所做的就是将图像位置作为f:param传递给模态面板,然后在图像标记中使用传递的参数。
但不知何故,我无法获得我传递参数的值。
下面是代码:
这是我如何激活modalPanel我如何传递参数usingf:PARAM
<h:graphicImage value="../images/DSCN0965.JPG" height="50" width="50" styleClass="iconClass">
<rich:componentControl for="imagePanel" operation="show" event="onclick">
<f:param value="../images/DSCN0965.JPG" name="imagePath"/>
</rich:componentControl>
</h:graphicImage>
这是模式面板代码,我如何试图让F:参数值在这里...
<rich:modalPanel id="imagePanel" width="600" height="600">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Image"></h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="../images/closeIcon.GIF" styleClass="iconClass" id="closeImageLink"/>
<rich:componentControl for="imagePanel" attachTo="closeImageLink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
<h:outputLabel value="#{imagePath}"/>
<h:graphicImage value="{imagePath}" height="400" width="500" styleClass="iconClass"/>
</rich:modalPanel>
你能告诉我如何访问传递的参数值吗?
问候,
萨蒂亚
答
在这里,你不需要设置参数值的方式,用于显示较大的图像,而不是本可以只用javascript
很容易地完成。
给模型面板的图像元素id
说“largeImage”,并在页面中使用下面的脚本更小的图像
onclick = "document.getElementById('largeImage').src = this.src;"
以下脚本打开面板。
要传递参数值,您需要按照here所述将它绑定到JSF支持bean对象。
那是对的,我已经完成了它使用JavaScript。我不必为此使用f:param – Satya 2011-04-04 15:29:15