wood burning stoves
The moose likes JSF and the fly likes ui:repeat + AJAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "ui:repeat + AJAX" Watch "ui:repeat + AJAX" New topic

ui:repeat + AJAX

Shashi vardhan reddy

Joined: Oct 10, 2011
Posts: 1
We create have a list - to be displayed under a panel of the screen where all the code in which the fields are repeatable are kept under a different xhtml file and while i am trying to render an image based on the listener's action for an ajax event i am getting some problem to update the image with id as JSF is generate an id with the index in the middle due to the use of ui:repeat. "repeatForm:repeat:2:redimage"

Now: to use it in a page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<title>Repeat Test Demo</title>

<h:form id="repeatForm">
<ui:repeat id ="repeat" value="#{listBean.xyzList}" var="repeatListVar">
<p:panel id="genLiabPanelRender">
<ui:include src="MyScreen.xhtml" />
<html xmlns="http://www.w3.org/1999/xhtml"

<h:body class="body">

<h:panelGrid columns="4" border="0" width="90%">

<h:panelGroup style="display:block;text-align:left;width: 320px">
<h:selectBooleanCheckbox value="#{repeatListVar.primaryPolicyInd}" />
<hutputText value="#{label.primaryCov}" />

<h:panelGroup style="display:block;text-align:left;width: 240px">
<h:selectBooleanCheckbox value="#{repeatListVar.abcInd1}" />
<hutputText value="#{label.commGenLiab}" />

<h:panelGroup style="display:block;text-align:left;width: 180px">
<hutputText value=" #{label.eachOccur}" style="text-align:left" />

<h:panelGroup style="display:block;text-align:left;width: 130px">
<p:inputMask mask="#{label.limitAmtMask}" id="genLiabEachOccAmt"
value="#{repeatListVar.a25GLEOAmt}" required="true"
style="width: 90px">
<f:ajax event="blur" render="redimage" listener="#{repeatListVar.testA25GLEOAmt}"/>
<h:graphicImage id="redimage" url="/images/icons/redIcon.png" rendered="#{repeatListVar.testA25GLEOAmtInd}" />

This ends up generating ids for the outputText field that look like: repeatForm:repeat:2:redimage. But because we're using the f:ajax tag, we only need to specify "redimage" - the tag takes care of the work of finding out what the real id is.

we are calling a method in the listener and set the value of boolean indicator to either true or false which is false by default.
and the indicator is used to render the image.

but when we are using this f:ajax to render the image based on the indicator value I am getting the error as "malformedXMLuring update repeatForm:repeat:2:redimage not found".

Please let me know why i am getting this error.
I agree. Here's the link: http://aspose.com/file-tools
subject: ui:repeat + AJAX
It's not a secret anymore!