Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF values not being updated in bean
    text
    copied!<p>In JSF 1.1, I am having a lot of trouble with passing values. I pass values from bean to a JSF page, but they are not being passed back, causing a NullPointerException. declareFinishList in bean is populated by an initializing method to display on the page, but when I submit I get a nullpointer exception at <code>for (DeclareFinish df : declareFinishList)</code> showing that it is not being passed back. The map <code>declaredFinishMap</code> also comes out as null. I've done this before so I don't understand why this particular one is having trouble while my other similar tables are working fine.</p> <p>EDIT: I've managed to pass <code>declareFinishList</code> by placing it in session scope, but I still can't seem to pass <code>declaredFinishMap</code>.</p> <p>To note, the bean is defined by rsaleController in faces-config.xml. Entire page is wrapped in h:form that I didn't include.</p> <p>Bean:</p> <pre><code>public class RetailSaleController extends BaseBean { private List&lt;DeclareFinish&gt; declareFinishList; private Map&lt;DeclareFinish, Boolean&gt; declaredFinishMap = new LinkedHashMap&lt;DeclareFinish, Boolean&gt;(); public void saveDeclareFinishList(ActionEvent event) { List&lt;DeclareFinish&gt; list = new ArrayList&lt;DeclareFinish&gt;(); for (DeclareFinish df : declareFinishList) { if(declaredFinishMap.get(df)) { list.add(df); } } } } </code></pre> <p>Page:</p> <pre class="lang-or-tag-here prettyprint-override"><code>&lt;h:panelGroup id="declareFinishListPanel"&gt; &lt;rich:dataTable id="declareFinishItemTable" border="1" value="#{rsaleController.declareFinishList}" var="item" &lt;rich:column width="16"&gt; &lt;f:facet name="header"&gt; &lt;rich:spacer height="24px;" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{rowNo+1}" /&gt; &lt;/rich:column&gt; &lt;rich:column style="text-align:center;"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Locked" /&gt; &lt;/f:facet&gt; &lt;h:selectBooleanCheckbox id="reset" value="#{rsaleController.declaredFinishMap[item]}" /&gt; &lt;/rich:column&gt; &lt;rich:column sortBy="#{item.dealerId}" sortIcon="none;" width="110"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{labels.crmsFldLabDealer}" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{item.dealerId}" /&gt; &lt;/rich:column&gt; &lt;/rich:dataTable&gt; &lt;/h:panelGroup&gt; &lt;a4j:commandLink reRender="declareFinishItemTable" actionListener="#{rsaleController.saveDeclareFinishList}"&gt; &lt;h:graphicImage value="/images/save.gif" title="Save changes" style="height:16;width:16;border-style:none;vertical-align:middle" /&gt; &lt;/a4j:commandLink&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload