uirepeat

Dynamic <ui:include src> depending on <ui:repeat var> doesn't include anything

只谈情不闲聊 提交于 2019-11-27 08:05:57
问题 I am new to JSF and I am struggling with dynamicaly rendering included pages. My code looks like this: MenuBean @ViewScoped public class MenuBean implements Serializable { private MenuItem[] menuItems = new MenuItem[] { new MenuItem("page_1", "/page_1.xhtml"), new MenuItem("page_2", "/page_2.xhtml"), }; private String selectedItemLabel; //... } MenuItem public class MenuItem implements Serializable { private String label; private String page; //... } index.xhtml <ui:repeat var="menuItem"

PropertyNotFoundException on conditionally rendered subclasses in ui:repeat

▼魔方 西西 提交于 2019-11-27 04:07:41
问题 I have a superclass Person : public class Person { public abstract Type getType(); } I have 2 subclasses of it: public class JuridicalPerson extends Person { public Type getType() { return Type.JP; } public List<JuridicalBelong> getJuridicalBelongs() { return juridicalBelongs; } } public class NaturalPerson extends Person { public Type getType() { return Type.NP; } public List<NaturalBelong> getNaturalBelongs() { return naturalBelongs; } } JuridicalBelong and NaturalBelong have different

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

六月ゝ 毕业季﹏ 提交于 2019-11-27 02:58: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

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

社会主义新天地 提交于 2019-11-27 02:11:48
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 = new ArrayList<Customer>(); customerList.add(new Customer("Daffy Duck", "daffy@example.com"));

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

牧云@^-^@ 提交于 2019-11-26 23:32:36
问题 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> 回答1: With a Set , it is not possible as it doesn't allow referencing items by index

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

放肆的年华 提交于 2019-11-26 22:55:11
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 remove the hard coded column_ I get an exception: java.lang.IllegalArgumentException: component identifier must

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

限于喜欢 提交于 2019-11-26 22:27:29
问题 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

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

為{幸葍}努か 提交于 2019-11-26 18:30:24
问题 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? 回答1: You need to associate the input value

Using validator with a variable attribute in ui:repeat

痞子三分冷 提交于 2019-11-26 17:25:57
问题 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

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

独自空忆成欢 提交于 2019-11-26 17:24:35
问题 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