how can I dynamically create html components in Jsf2. I have to make a dynamic form which is to be filled by user, so I am not getting how can I manage, I have to use JavaScript or what?? I am using richfaces too.
A:
yes. use javascript. one way using js could be to have the various 'dynamic' html elements already on the page, but set to hidden via CSS: display:none;
when an element triggers a hidden element to be show, use js: document.getElementById('xyz').style.display = 'block';
Moin Zaman
2010-09-09 05:36:38
this can't be used in my case suggest another one..
taher
2010-09-09 06:50:15
A:
Here, you can use panelGrid component, specify no of columns dynamically. You can then add other stuff into the panelGrid.
Page Code:
<ice:inputText value="#{bean.noOfColumns}"
<ice:panelGrid columns="#{bean.noOfColumns}" binding="#{bean.gridComponent}">
Backing Bean Code :
//---
for(int i=0; i < noOfColumns; i++)
gridComponent.getChildren().add(uiComponent);
//---
You can add any uiComponent accordingly.
Nayan Wadekar
2010-09-11 16:19:42
Then you can use <h:panelGrid> as it is core JSF component, if it fits well according to your need.
Nayan Wadekar
2010-09-13 16:05:53