uirepeat

Validate order of items inside ui:repeat

試著忘記壹切 提交于 2019-11-26 17:17:09
问题 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

Specify conditional rendering of element inside <ui:repeat>? The <c:if> does not seem to work

廉价感情. 提交于 2019-11-26 16:44:55
I am trying to conditionally build a custom list using <ui:repeat> . On every occurrence of -1 as item-value in list, I need to add a line break. I tried to use <c:if> inside <ui:repeat> for that, but it does not seem to work. It always evaluates false . <ul> <ui:repeat value="#{topics.list}" var="topicId" > <li>#{topicId}</li> <c:if test="#{topicId eq -1}"> <br/> </c:if> </ui:repeat> </ul> Is this possible? BalusC Not with JSTL tags, no. They runs during view build time, not during view render time. You can visualize it as follows, when JSF builds the view, JSTL tags runs from to bottom first

JSF 2 dataTable row index without dataModel

微笑、不失礼 提交于 2019-11-26 16:36:28
问题 I've been using ui:repeat to generate tables. With ui:repeat it's easy to get the rows numbered using the varStatus . I'm depending on the row id's from varStatus when calling the backing bean to handle list navigation, for example moving an item up or down in the list. Now I'd like to create a composite component that builds a customizable table with all functionality needed for marking rows, moving them up/down etc. To do this, the ui:repeat won't work as I can't see a way of handling

How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 16:28:34
I was trying to display a panel where user can see a list of items category(displayed as images) and on clicking they can view products within the category(images will be displayed) For displaying the item category, i used the ui:repeat nad the supporting bean calss Below is my xhtml code <ui:repeat id="repeat" value="#{getData.images}" var="img" varStatus="loop"> <h:panelGroup> <p:graphicImage id="img1" value="#{img}" alt="image not available" > </p:graphicImage> </h:panelGroup> </ui:repeat> And the Managed Bean Code parts private ByteArrayOutputStream baos = new ByteArrayOutputStream();

<h:form> within <ui:repeat> not entirely working, only the last <h:form> is processed

房东的猫 提交于 2019-11-26 10:00:45
问题 I will like to edit a list of items in the same page. Each item should be edited using a separate form. I am creating a h:form within ui:repeat. Only when the last form is submitted, the user input is applied to the managed bean. For all other forms, user input is not applied to the model. @ManagedBean public class Controller { Logger logger = Logger.getLogger(\"TestWeb\"); private List<Customer> customerList; public List<Customer> getCustomerList() { if (customerList == null) { customerList

How can I set id of a component/tag inside ui:repeat

荒凉一梦 提交于 2019-11-26 09:03:25
问题 I\'m trying to assign an id to a component inside a <ui:repeat> like that: <ui:repeat value=\"#{bean.columns}\" var=\"column\"> <h:panelGroup layout=\"block\" id=\"column_#{column.id}\" styleClass=\"#{column.id} dashboard_column\"> The thing is that #{column.id} value is being placed properly inside the styleClass value but its not being set inside the id attribute. All that is being set inside the id attribute is the automatically generated id by the JSF + my hard coded value column_ . If I

How to use <h:selectBooleanCheckbox> in <h:dataTable> or <ui:repeat> to select multiple items?

亡梦爱人 提交于 2019-11-26 08:23:45
I have a Facelets page with a <h:dataTable> . In each row there is a <h:selectBooleanCheckbox> . If the checkbox is selected the object behind the corresponding row should be set in the bean. How do I do this? How to get the selected rows or their data in a backing bean? Or would it be better to do it with <h:selectManyCheckbox> ? Your best bet is to bind the h:selectBooleanCheckbox value with a Map<RowId, Boolean> property where RowId represents the type of the row identifier. Let's take an example that you've a Item object whose identifier property id is a Long : <h:dataTable value="#{bean

Specify conditional rendering of element inside <ui:repeat>? The <c:if> does not seem to work

不羁的心 提交于 2019-11-26 04:55:37
问题 I am trying to conditionally build a custom list using <ui:repeat> . On every occurrence of -1 as item-value in list, I need to add a line break. I tried to use <c:if> inside <ui:repeat> for that, but it does not seem to work. It always evaluates false . <ul> <ui:repeat value=\"#{topics.list}\" var=\"topicId\" > <li>#{topicId}</li> <c:if test=\"#{topicId eq -1}\"> <br/> </c:if> </ui:repeat> </ul> Is this possible? 回答1: Not with JSTL tags, no. They runs during view build time, not during view

How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat?

久未见 提交于 2019-11-26 04:47:05
问题 I was trying to display a panel where user can see a list of items category(displayed as images) and on clicking they can view products within the category(images will be displayed) For displaying the item category, i used the ui:repeat nad the supporting bean calss Below is my xhtml code <ui:repeat id=\"repeat\" value=\"#{getData.images}\" var=\"img\" varStatus=\"loop\"> <h:panelGroup> <p:graphicImage id=\"img1\" value=\"#{img}\" alt=\"image not available\" > </p:graphicImage> </h:panelGroup

Using <ui:repeat><h:inputText> on a List<String> doesn&#39;t update model values

随声附和 提交于 2019-11-26 01:01:53
问题 Here is the scenario (simplified): There is a bean (call it mrBean ) with a member and the appropriate getters/setters: private List<String> rootContext; public void addContextItem() { rootContext.add(\"\"); } The JSF code: <h:form id=\"a_form\"> <ui:repeat value=\"#{mrBean.stringList}\" var=\"stringItem\"> <h:inputText value=\"#{stringItem}\" /> </ui:repeat> <h:commandButton value=\"Add\" action=\"#{mrBean.addContextItem}\"> <f:ajax render=\"@form\" execute=\"@form\"></f:ajax> </h