-
1. Re: a4j:repeat creates multiple h:outputText, but not rich:t
ilya_shaikovsky Feb 4, 2008 6:18 AM (in response to dkarr)you should not use a4j:repeat or ui:repeat. It was discussed numerous times at this forum.
In your case - you should use c:forEach. -
2. Re: a4j:repeat creates multiple h:outputText, but not rich:t
dkarr Feb 5, 2008 1:10 AM (in response to dkarr)c:foreach is what I tried first, before I tried a4j:repeat. That doesn't work either, but it fails in different ways.
The following is an excerpt from my JSP:<c:forEach items="#{ratingRequest.usedProperties}" var="property"> <rich:tab name="#{property.propertyID}" label="Property: #{property.propertyID} #{ratingRequest.loanID}" rendered="#{property.used}"> </rich:tab> </c:forEach>
When I run this, it gets an NPE in TabPanelRendererBase.encodeTabs() (line 327), because the "name" attribute of the resulting tab is a null pointer. In this example, the label comes out to "Property: abc", where the "loanID" attribute of the "ratingRequest" backing bean is "abc". The value of the "propertyID" attribute is actually "12345" (I watched the getter retrieve that value), but the reference in the "rich:tab" element comes out to a null pointer. -
3. Re: a4j:repeat creates multiple h:outputText, but not rich:t
ilya_shaikovsky Feb 5, 2008 4:45 AM (in response to dkarr)something with your model.
I used:<rich:tabPanel switchType="client" id="tab"> <c:forEach items="#{capitalsBean.capitals}" var="cap"> <rich:tab label="#{cap.name}" name="#{cap.state}"> <h:outputText value="#{cap.timeZone}"/> </rich:tab> </c:forEach> </rich:tabPanel>
Works fine. (bean code the same as used in suggestion code at demosite.) -
4. Re: a4j:repeat creates multiple h:outputText, but not rich:t
ilya_shaikovsky Feb 5, 2008 4:53 AM (in response to dkarr)B.t.w. the similar code used to create dynamic toolBar in list shuttle example at demosite.
-
5. Re: a4j:repeat creates multiple h:outputText, but not rich:t
dkarr Feb 5, 2008 12:08 PM (in response to dkarr)I'm very confused. My app is still not working, but now it's misbehaving differently than before. It's not getting the NPE anymore, because it's not even trying to render the tab with the null name (which shouldn't be null).
I've reduced the page to the minimum to demonstrate the problem. My model is very simple. I can't see how there could be anything wrong with it. I'll include my jsp, and the two bean classes. Can you see anything wrong with this?<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>TabPanel</title> </head> <body> <f:view> <a4j:form> <rich:messages layout="table" tooltip="true" showDetail="true" showSummary="true"/> <h:outputText value="usedProperties["/> <c:forEach items="#{ratingRequest.usedProperties}" var="property"> <h:outputText value="id[#{property.propertyID}] used[#{property.used}]"/> </c:forEach> <h:outputText value="]"/> <h:outputText value="propertyList["/> <c:forEach items="#{ratingRequest.propertyList}" var="property"> <h:outputText value="id[#{property.propertyID}] used[#{property.used}]"/> </c:forEach> <h:outputText value="]"/> <rich:tabPanel id="tabPanel" switchType="client"> <rich:tab id="obligor" name="obligor" label="Obligor"> <h:panelGrid id="obligorPanelGrid" columns="3"> <h:outputText id="field1Out" value="Field1"/> <h:inputText id="field1In" value="#{ratingRequest.field1}"/> <rich:message for="field1In" showDetail="true"/> </h:panelGrid> </rich:tab> <c:forEach items="#{ratingRequest.usedProperties}" var="property"> <rich:tab name="#{property.propertyID}" label="Property: #{property.propertyID} #{ratingRequest.loanID}" rendered="#{property.used}"> <h:outputText value="#{property.propertyID}"/> </rich:tab> </c:forEach> </rich:tabPanel> </a4j:form> </f:view> </body> </html>
package com.wamu.ais.tabpanel; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; public class RatingRequestBean { private String loanID; private Integer field1; private Integer field2; private Integer field3; private Integer rating; private List<PropertyInfo> propertyList; private Integer propertyIndex; public String getLoanID() { return loanID; } public Integer getField1() { return field1; } public Integer getField2() { return field2; } public Integer getField3() { return field3; } public Integer getRating() { return rating; } public List<PropertyInfo> getPropertyList() { return propertyList; } public Integer getPropertyIndex() { return propertyIndex; } public List<PropertyInfo> getUsedProperties() { List<PropertyInfo> result = new ArrayList<PropertyInfo>(); for (int ctr = 0; ctr < getPropertyList().size(); ++ ctr) { PropertyInfo property = getPropertyList().get(ctr); if (property.getUsed()) { property.setIndex(ctr); result.add(property); } } return (result); } public void setLoanID(String loanID) { this.loanID = loanID; } public void setField1(Integer field1) { this.field1 = field1; } public void setField2(Integer field2) { this.field2 = field2; } public void setField3(Integer field3) { this.field3 = field3; } public void setRating(Integer rating) { this.rating = rating; } public void setPropertyList(List<PropertyInfo> propertyList) { this.propertyList = propertyList; } public void setPropertyIndex(Integer propertyIndex) { this.propertyIndex = propertyIndex; } public RatingRequestBean() { setLoanID("abc"); List<PropertyInfo> propertyList = new ArrayList<PropertyInfo>(); for (int ctr = 0; ctr < 10; ++ ctr) { PropertyInfo property = new PropertyInfo(); property.setPropertyID("property " + (ctr + 1)); propertyList.add(property); } ((PropertyInfo) propertyList.get(0)).setUsed(true); ((PropertyInfo) propertyList.get(0)).setPropertyID("12345"); ((PropertyInfo) propertyList.get(0)).setValue(new BigDecimal(10)); ((PropertyInfo) propertyList.get(1)).setUsed(true); ((PropertyInfo) propertyList.get(1)).setPropertyID("54321"); ((PropertyInfo) propertyList.get(1)).setValue(new BigDecimal(99)); setPropertyList(propertyList); } }
package com.wamu.ais.tabpanel; import java.math.BigDecimal; public class PropertyInfo { private String propertyID; private BigDecimal value; private Integer index; private boolean checked; private boolean used; public String getPropertyID() { return propertyID; } public final BigDecimal getValue() { return value; } public Integer getIndex() { return index; } public final boolean isChecked() { return checked; } // public boolean getUsed() { return used; } public boolean isUsed() { return used; } public void setPropertyID(String propertyID) { this.propertyID = propertyID; } public final void setValue(BigDecimal value) { this.value = value; } public void setIndex(Integer index) { this.index = index; } public final void setChecked(boolean checked) { this.checked = checked; } public void setUsed(boolean used) { this.used = used; } public PropertyInfo() { setUsed(false); setValue(new BigDecimal(0)); } }
-
6. Re: a4j:repeat creates multiple h:outputText, but not rich:t
dkarr Feb 7, 2008 12:55 PM (in response to dkarr)I'm still no closer to solving this. My initial tests of this were with the Sun RI, but I've now tried it with MyFaces, and it fails in the same way, although in a different place because of the different JSF implementation. There is nothing wrong with my model that I can see. Debugging this was made a little more difficult because the HtmlTab class appears to be missing from the 3.1.4 source jar.
-
7. Re: a4j:repeat creates multiple h:outputText, but not rich:t
ilya_shaikovsky Feb 11, 2008 11:40 AM (in response to dkarr)could you please send me sample (in war with libs and your java sources). I'll answer in this thread after investigation.
-
8. Re: a4j:repeat creates multiple h:outputText, but not rich:t
dkarr Feb 11, 2008 11:47 AM (in response to dkarr)I created a JIRA report for this, with an attached Eclipse project. It doesn't include the lib jars, but the .classpath file specifies everything that I reference, and they are all commonly available. This project used the Sun RI, but I saw similar issues using MyFaces.
http://jira.jboss.com/jira/browse/RF-2215?page=all
Is that sufficient?
Thanks for the help.