dynamic-forms

How to Dynamically add a row in a table in JSF?

蓝咒 提交于 2019-11-27 05:10:38
In my application i need to add a row on a click of a button and this button will be in all the rows. Need help to do this? Item Class public class Item { public Item() { } private String value; public Item(String value) { this.value = value; } public void setValue(String value) { this.value = value; } public String getValue() { return value; } } Manage Bean Class public class MyMB { private List<Item> list; public void addItem() { // JSF action method list.add(new Item("Default")); Iterator<Item> iterator = list.iterator(); while(iterator.hasNext()) { Item item = (Item)iterator.next(); System

How to implement a dynamic list with a JSF 2.0 Composite Component?

余生颓废 提交于 2019-11-26 18:51:04
I asked this question and although the answer directly satisfied my needs I am left with a feeling that there has to a simpler solution for this specific problem. I would like to have a composite component that accepts a list of items (The type of the items agreed upon so the members can be used freely within the composite component) The CC (composite component) display the list of items and allows for addition and subtraction of items. I would like to do this in the most simple and efficient manner. To illustrate the problem, an example: The definition should be rather simple (unless of

focus() not working in safari or chrome

我只是一个虾纸丫 提交于 2019-11-26 12:46:52
问题 I have a div that has been given a tabindex, when the div is focused(click or tabbed to) it does the following: inserts an input into itself, gives the input focus this works great in FF, IE and Opera but in Chome/Safari it gives the input focus but fails to actually put the cursor inside the input (I know it gives it focus because the safari/chrome focus borders appear). Any suggestions as to what is going on? I have to fix the key handler after this so the arrow keys and backspace keys work

How to implement a dynamic list with a JSF 2.0 Composite Component?

让人想犯罪 __ 提交于 2019-11-26 06:37:29
问题 I asked this question and although the answer directly satisfied my needs I am left with a feeling that there has to a simpler solution for this specific problem. I would like to have a composite component that accepts a list of items (The type of the items agreed upon so the members can be used freely within the composite component) The CC (composite component) display the list of items and allows for addition and subtraction of items. I would like to do this in the most simple and efficient

How to uncheck a radio button?

ぃ、小莉子 提交于 2019-11-26 02:53:38
I have group of radio buttons that I want to uncheck after an AJAX form is submitted using jQuery. I have the following function: function clearForm(){ $('#frm input[type="text"]').each(function(){ $(this).val(""); }); $('#frm input[type="radio":checked]').each(function(){ $(this).checked = false; }); } With the help of this function, I can clear the values at the text boxes, but I can't clear the values of the radio buttons. By the way, I also tried $(this).val(""); but that didn't work. David Hedlund either (plain js) this.checked = false; or (jQuery) $(this).prop('checked', false); // Note

How to dynamically add JSF components

。_饼干妹妹 提交于 2019-11-25 22:38:15
问题 Can I add JSF components dynamically? I need to have a form with a button which should add one <h:inputText> to the form. Is this possible? I know this should be possible in JavaScript somehow. Do anybody know how to do this in JSF? I think the major problem is how do I get or set values of new inputs via #{value} . 回答1: Use an iterating component like <h:dataTable> or <ui:repeat> to display a dynamically sized List of entities. Make the bean @ViewScoped to ensure that the list is remembered