Iam new to JSF.I created a form which contains panelgrid with rows and one command button.when i click on the command button it should display a new row(textboxes) dynamically.Can anyone help me on how to do this...
Hi, I'm not really answering your question, but have you considered using dataTable component instead of panelGrid?
The difference is that in dataTable you can bind its value to an array of inputTexts or whatever objects you need, then you can add inputText components to this array by a method binded in the action property of your commandButton.
I suggest you to read the book of 'JavaServer Faces in Action', the author of which is Kito Mann.
In this book, the first sample is very similar with the case you described.
1. Bind the GridPanel with the member variable of the backing-bean with 'binding' attribute of component Tag.
2. Write an method as actionListener.
3. When the button triggers the actionListener method, in this method, you can manipulate the GridPanel Java instance with Backing-Bean member varialbe, getting the child-component collection and adding the new component into it. In the following View-Restore phase, the new element will appear on page.