Hello all,
i have following problem / usecase
in mydatabase i have a table called 'transfertypes', which contains 2 columns, id and description.
ideally, this is populated with 8 rows.
Now, in my JSF application, i should load the content of that table, and for each row i need to create following
input parameters
date / description / id (from db table) / amount
so, if i have 8 rows i will have 32 input parameters..
I decided to define following properties in my ManagedBean
date of type Date[]
description of type STring[]
id of type int[]
amount of type double[]
i am having huge problems in the JSP when i need to acually write the code, for example i am using following
<h:dataTable id="table"
value="#{savingsBean.transferList}"
var="expense"
rowClasses="oddRow, evenRow"
headerClass="tableHeader">
<h:column>
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
<h:inputText value="#{ savingsBean.descriptions}"/>
</h:column>
</h:dataTable>
value="#{savingsBean.transferList}"
var="expense"
rowClasses="oddRow, evenRow"
headerClass="tableHeader">
<h:column>
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
<h:inputText value="#{ savingsBean.descriptions}"/>
</h:column>
</h:dataTable>
This is a very simple case that i have tried, it results in 8 input parameters of type String (where 8 is thenumber of
entries in my database table
the problem is that i THOUGHT, since i will have 8 parameters with same name (description), it's safe to define a property
of type String[] named description.
looks it doesnoto work like that
i suspect i should somehow write, for each row,
<h:inputText value="#{savingsBean.descriptions[i]}"/>
but i dont know how to access the index of the row... nor if the above syntax is correct ..
can anyone help?
thanks in advance and regards
marco