Hi, I'm writing an application that serves as an admin panel using JSF 2.0 and Hibernate. I have a JSP page with a JSF form which elements are added dynamically using javascript (jQuery to be specific). So I cannot make any assumption on how much data do I have to process. I have a managed bean but I don't know how to put the getters and setters for the dynamic fields that I want to save in a database. The solution seems to use a list rather than a single element but how do I use the value tag of the JSF element? Could it be something like this:
<h:form>
<h:inputText id="i1" value="#{UserBean.list}" />
<h:inputText id="i2" value="#{UserBean.list}" />
<h:commandbutton id="submit" value="Submit" action="#{UserBean.submit}"/>
</h:form>
And the managed bean:
@ManagedBean(name="UserBean")
@RequestScoped
public class UserBean {
public UserBean() {
List<String> list = null;
}
public List getList() {
return list;
}
public List setList(List<String> newlist) {
list = newList;
}
}
However, the above code does not seem correct and certainly does not work. I need to bind two or more values of the inputtext to the same list. Does anyone have any suggestions how to solve it? Thanks in advance. Regards, sass.