0

I am trying to include facet and change the facet name using button action like this

            <h:form>
                <p:commandButton type="submit" value="Add" ajax="true"  update=":tabs"
                     actionListener="#{sideBar.setCurrentFaceltName('todolist')}">
                </p:commandButton>
            </h:form>

and this is the layout where the facet is included

<p:layoutUnit id="tabs" style=" position: relative;" position="center">
    <ui:include src="/WEB-INF/facelts/#{sideBar.currentFaceltName}.xhtml" />
</p:layoutUnit>

and i build the facet programmatically using binding

<h:body>
        <h:panelGroup binding="#{test.dynamicFormGroup}" />
</h:body>

just a child UI component for the panel for test and it works fine if i include the facet directly like this

<ui:include src="/WEB-INF/facelts/todolist.xhtml" />

can any one help me with this? thanks in advance

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
Ahmed Gamal
  • 1,666
  • 1
  • 17
  • 25
  • Just stop trying to build components in Java. You should use keep using XHTML for that. Food for read: http://stackoverflow.com/q/14911158 – BalusC Aug 18 '15 at 10:24
  • if i want to create pages dynamically because all pages are user dreiven (UDA), jsf will not support me to make that ? thanks @BalusC for your great effort – Ahmed Gamal Aug 18 '15 at 10:49
  • Check the links below "Using binding on a bean property is bad practice" for concrete examples, depending on your actual model. – BalusC Aug 18 '15 at 10:56
  • but you did not ansewer me for general is jsf will be the best choice in creating user driven page dynamically ? thanks :) – Ahmed Gamal Aug 18 '15 at 11:16
  • "Best" is subjective. It's at least definitely possible with JSF. Only a lot of starters fail in this by dynamically building the tree structure using verbose and hard to maintain Java code (`if(condition)parent.getChildren().add(new Child()`)` instead of clean and easy to maintain XHTML code ``. I'm just warning you before you fall in this trap too. Again, see the links for concrete examples. If you don't understand them either, it's wise to take a pause on the project and take some time apart to thoroughly go through a sane JSF book. – BalusC Aug 18 '15 at 11:21
  • i checked all of your answers in this tobic thanks alot man :) i understood what you want to say thank you – Ahmed Gamal Aug 18 '15 at 15:40

0 Answers0