Using <ui:repeat><h:inputText> on a List<String> doesn't update model values
By : Praks
Date : March 29 2020, 07:55 AM
Does that help The String class is immutable and doesn't have a setter for the value. The getter is basically the Object#toString() method. You need to get/set the value directly on the List instead. You can do that by the list index which is available by . code :
<ui:repeat value="#{mrBean.stringList}" varStatus="loop">
<h:inputText value="#{mrBean.stringList[loop.index]}" />
</ui:repeat>
|
Values of h:inputText inside ui:repeat are not processed
By : Andres Martinez
Date : March 29 2020, 07:55 AM
Any of those help Your problem is not connected with PrimeFaces 's behaviour, but rather with a scoping problem that is implicilty created when using the tag. First of all, let's depart from your example. Basically, you've got code :
<ui:repeat value="#{bean.strings}" var="s">
<h:inputText value="#{s}"/>
</ui:repeat>
public class MString {
private String string;//getter+setter+constructor
}
<ui:repeat value="#{bean.mstrings}" var="ms">
<h:inputText value="#{ms.string}"/>
</ui:repeat>
<ui:repeat value="#{bean.strings}" var="s" varStatus="status">
<h:inputText value="#{bean.strings[status.index]}"/>
</ui:repeat>
|
<h:inputText> doesn't seem to work within <ui:repeat>, only the last entry is submitted
By : Rui Filipe Costa Car
Date : March 29 2020, 07:55 AM
around this issue It's caused because you're (re)creating the list in the getter method behind . This method is invoked during every iteration round. So, every next iteration will basically trash the values set during the previous iteration. In the action method, you end up with the list as created during the last iteration round. That's why the last entry seems to work fine. This approach is indeed absolutely not right. You should not be performing business logic in getter methods at all. Make the list a property and fill it only once during bean's (post)construction. code :
@ManagedBean(name = "genproducts")
@ViewScoped
public class Genproducts{
private List<Product> list;
@PostConstruct
public void init() throws SQLException {
list = new ArrayList<>();
// ...
}
public List<Product> getList() {
return list;
}
}
<ui:repeat value="#{genproducts.list}" var="itemsBuying">
|
Using inputText inside ui:repeat to update ArrayList of values is not working
By : Vince
Date : March 29 2020, 07:55 AM
wish help you to fix your issue As BalusC reported here String is immutable. Use the varStatus attribute to access directly the list member by the index. code :
<ui:repeat varStatus="loop" value="#{user.emails}">
<td><h:inputText value="#{user.emails[loop.index]}"/> </td>
</ui:repeat>
<ui:repeat varStatus="loop" value="#{user.numbers}">
<td><h:inputText value="#{user.numbers[loop.index]}" converter="javax.faces.BigDecimal"/> </td>
</ui:repeat>
|
input component inside ui:repeat, how to save submitted values
By : Rabail
Date : March 29 2020, 07:55 AM
|