---
title: "a4j:ajaxListener 实现ajax更新功能"
author: "jxh118"
date: "2008-09-02T15:31:31Z"
tags: []
slug: "a4j-ajaxlistener-ajax"
draft: false
lastmod: "2008-09-02T15:31:31Z"
id: 235763
url: "https://jdh.iteye.com/blog/235763"
---

```
<h:dataTable value="#{pictures.al}" var="pics">

<f:facet name="header">

<f:verbatim>Data table with Pictures and Zoom Elements</f:verbatim>

</f:facet>

<h:column>

<h:panelGroup id="rerenderpic">

            <h:graphicImage value="#{pics.flag}" width="#{pics.width}" height="#{pics.height}"

                style="display:block;"/>
<a4j:commandLink value="Zoom In" action="#{pictures.zoomIn}" reRender="rerenderpic"

                style="display:#{pics.zoomed ? 'none': 'block'}">

<a4j:actionparam value="#{pics.flag}" name="picture"/>

<a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>

</a4j:commandLink>

            <a4j:commandLink value="Zoom Out" action="#{pictures.zoomOut}" reRender="rerenderpic" 

                style="display:#{pics.zoomed ? 'block': 'none'}">

<a4j:actionparam value="#{pics.flag}" name="picture"/>

<a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>

</a4j:commandLink>

</h:panelGroup>

</h:column>

</h:dataTable>
```