开发者

how can I dynamically create html components in Jsf2

开发者 https://www.devze.com 2023-01-15 04:14 出处:网络
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 开发者_JAVA技巧to use JavaScript or what

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 开发者_JAVA技巧to use JavaScript or what?? I am using richfaces too.


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';


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消