1

Now I work with JSF and Primefaces, how can I reduce code when I use panel to show list member edit, delete and add? I have 10 panels in 1 page, because I want to create application the same desktop (Ubuntu desktop, Windows desktop, Mac desktop). If I have 10 panels in one page, then I must repeat the same code 10 times to create and handle 10 panels.

How can I reduce this code?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Kency
  • 660
  • 5
  • 15
  • 30

1 Answers1

0

Put that code in an include or a tag file and then render it in a <c:forEach> or <ui:repeat> loop which is feeded by a list containing 10 items providing the model for those panels.

Basic kickoff example with a tag file in an <ui:repeat>:

<ui:repeat value="#{bean.panels}" var="panel">
    <my:panel value="#{panel}" />
</ui:repeat>
Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555