uirepeat

JSF 2 ui:repeat: group every n items inside a div

匆匆过客 提交于 2019-11-30 15:35:38
问题 Given a collection that I want to arrange on a page like this: <!-- Group 0 --> <div style="float:left;"> <div><!-- Item 0 --></div> <div><!-- Item 1 --></div> <!-- ... --> <div><! -- Item n - 1 --></div> </div> <!-- Group 1 --> <div style="float:left;"> <div><!-- Item n --></div> <div><!-- Item n + 1 --></div> <!-- ... --> <div><! -- Item 2n - 1 --></div> </div> <!-- ... --> <!-- Group g --> <div><!-- Item gn --></div> <div><!-- Item gn + 1 --></div> <!-- ... --> <div><! -- Item (g + 1)n - 1

How to iterate a HashMap with primefaces selectable datatable

大城市里の小女人 提交于 2019-11-29 15:44:39
I have tried different solutions but none is working in my case. I want all the rows in this datatable to be selectable. The problem seems to be the <ui:repeat that is probably overriding the objects... My bean: @ManagedBean @ViewScoped public class Chat { private static Map<String, List<ChatObject>> chat = new LinkedHashMap<String, List<ChatObject>>(); private ChatObject selectedChatObject; public void onChatRowSelection(){ if(getSelectedChatObject() != null){ System.out.println("test"); } } public List<Map.Entry<String, List<ChatObject>>> getChatList() { Set<Map.Entry<String, List<ChatObject

Dynamically added input field in ui:repeat is not processed during form submit

别来无恙 提交于 2019-11-29 15:37:30
I am trying to make a input form for answers in my application and I start with four "empty" answers which the view loops over and make input fields for. I have an add answer button which I add one question to the array of answers and then the view render the answers again, but now with an additional input field. The backing bean is viewscoped. However if I submit the form without pressing the add answer button it all works. The data is saved in the database. But if I add an answer after the four is filled out the last one does not get the data from the inputfield (answer.description). If I

javax.el.PropertyNotFoundException when submitting ui:repeat with conditionally rendered properties of different subclasses

穿精又带淫゛_ 提交于 2019-11-28 09:31:48
In my backing-bean I have a collection of objects of different subclasses sharing a common interface. Inside the view, an ui:repeat iterates over this collection. Inside this loop, different properties have to be rendered depending on the concrete implementation of the interface. I reduced the problem to the following backing bean: @Named @SessionScoped public class DummyBean implements Serializable { private List<Type> objects = new ArrayList<Type>(); public void add1() { objects.add(new Type1()); } public void add2() { objects.add(new Type2()); } public void remove(Type o) { objects.remove(o

How to set submitted values of <h:inputText> inside <ui:repeat> into map, set or list

谁说胖子不能爱 提交于 2019-11-28 01:40:01
I would like to know if it possible to push a value from inside a <ui:repeat> to a map, a set or a list? I would like to pass the value of the <h:inputtext> to a set. Code: <ui:repeat var="_par" value="#{cmsFilterParameterHandler.normaleSuchParameter()}"> <p:outputLabel value="#{_par.bezeichnung}" /> <p:spacer width="5px" /> <p:inputText id="me" value="#{??? push me to a set ???}"/> <br /><br /> </ui:repeat> BalusC With a Set , it is not possible as it doesn't allow referencing items by index or key. It's however possible with a List and a Map by just specifying the list index and map key in

Collection of selectManyCheckbox inside a ui:repeat knows which element of the repeater it belongs to

泪湿孤枕 提交于 2019-11-27 16:29:10
I am developing a web app using JSF 2. My web app among other things contains a series of questions put one at a time (so one question is visible at a time) and have multiple answers (I use h:selectManyCheckbox). I store the questions and possible answers in a ArrayList ("gridQuestionListClone") and the users answers (before checking them at the end) in a HashMap ("allQuestionUserAnswerMap"). (I could change the storage modality if the answer demands it). When the user finishes answering all the questions I want to give the user the possibility to recheck all the questions and answers (I want

Using validator with a variable attribute in ui:repeat

…衆ロ難τιáo~ 提交于 2019-11-27 16:12:14
I'm using com.sun.faces version 2.1.18 . In my application I have a dynamic list of questions. I use <ui:repeat> to render each question. Depending on the type of question I render a type of input component and validation. In case of a number range question I use <h:inputText> with <f:validateLongRange> . The problem I run into is that the minimum and maximum attributes on the <f:validateLongRange> are always set to the first question's minimum and maximum value. So, when you use the validator on any other then the first question it fails. Is that supposed to happen? Is there a way to get

How to use <ui:repeat> to iterate over a nested list?

こ雲淡風輕ζ 提交于 2019-11-27 16:05:52
Using JSF 2.0, I need to display a table wherein each row contains a link which opens a popup. I have two models: A which has id and List<B> properties and B which has id and name properties. In my backing bean, I have a List<A> property. In my view, I am using <ui:repeat> to iterate over List<A> . The requirement is, depending on the row that the user clicks, the corresponding List<B> of A needs to be displayed. However, the <ui:repeat> does not accept a nested list to be assigned in the var attribute. Hence, I need to do a lot of workarounds which is not efficient. How do I efficiently solve

Validate order of items inside ui:repeat

痴心易碎 提交于 2019-11-27 15:44:37
I'm writing a validator method in JSF 2. I have a ui:repeat element in my page that renders a list of items. Each item has a date property, and I need to ensure the dates correspond to each other in a specific sequence, e.g. the date of the last item in the list doesn't come before the date of the first item. I was trying to get all the child elements inside the ui:repeat and iterate over them to do the comparison, but I don't really know where to start. I've seen how to get a specific element by ID: UIInput input = (UIInput) context.getViewRoot().findComponent(elementId); However, within the

input component inside ui:repeat, how to save submitted values

浪子不回头ぞ 提交于 2019-11-27 15:24:22
I'm displaying a list of questions from database and for each question I have to display a list of options, in this case radio buttons. <ui:repeat value="#{formData.questions}" var="question"> <div> <p:outputLabel value="#{question.name}" /> <p:selectOneRadio value="#{formData.selectedOption}"> <f:selectItems value="#{formData.options}" /> </p:selectOneRadio> </div> </ui:repeat> I need to save the checked option for each question. How can I do this? You need to associate the input value with the repeated variable var in some way. Right now you're not doing that anywhere and basically binding