Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to retrieve values of textboxes in JSF managed bean which are generated through a loop?
    primarykey
    data
    text
    <p>I need to generate textboxes through a loop as follows.</p> <pre><code>&lt;p:panel id="dataPanel" closable="true" toggleOrientation="horizontal" toggleable="true" header="Data"&gt; &lt;h:panelGrid id="dataPanelGrid" columns="3" cellpadding="5"&gt; &lt;c:forEach var="row" items="#{zoneChargeManagedBean.list}"&gt; &lt;p:outputLabel for="txtCharge" value="#{row[1]}"/&gt; &lt;p:inputText id="txtCharge" value="#{row[2]}" converter="#{bigDecimalConverter}" onkeydown="return isNumberKey(event, this.value);" label="#{row[1]}" required="false" maxlength="45"&gt; &lt;f:validator validatorId="negativeNumberValidator"/&gt; &lt;f:attribute name="isZeroAllowed" value="false"/&gt; &lt;f:validator validatorId="bigDecimalRangeValidator"/&gt; &lt;f:attribute name="minPrecision" value="1"/&gt; &lt;f:attribute name="maxPrecision" value="33"/&gt; &lt;f:attribute name="scale" value="2"/&gt; &lt;/p:inputText&gt; &lt;p:message for="txtCharge" showSummary="false"/&gt; &lt;/c:forEach&gt; &lt;p:commandButton id="btnSubmit" update="dataPanel messages" actionListener="#{zoneChargeManagedBean.insert}" icon="ui-icon-check" value="Save"/&gt; &lt;p:commandButton value="Reset" update="dataPanel" process="@this"&gt; &lt;p:resetInput target="dataPanel" /&gt; &lt;/p:commandButton&gt; &lt;/h:panelGrid&gt; &lt;/p:panel&gt; </code></pre> <p>The value of the given textbox is a type of <code>BigDecimal</code> from the database. </p> <p>When the given command button is pressed, the values held by these textboxes should be retrieved from the corresponding JSF managed bean so that they can either be inserted or updated in the database.</p> <p>It would be even better, if it is possible to retrieve the values of all of these text fields at once in some kind of collection (like <code>java.util.List</code>), when the given button is pressed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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