Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One possibility might be to use the <code>binding</code> attribute to access a container component from inside your managed bean and build the component tree from the java side. That way you could include only the needed components, unneeded components won't be evaluated at all.</p> <p>JSP:</p> <pre><code>&lt;h:panelGroup binding="#{managedBean.panel}"/&gt; </code></pre> <p>Managed Bean:</p> <pre><code>private UIPanel panel; // getter and setter // Action method, might also work in a @PostConstruct public String showComponent() { if (showComponent1) { UIOutput component1 = new HtmlOutputText(); component1.setValue("Hello world!"); getPanel().getChildren().add(component1); } return "viewId"; } </code></pre> <p>I haven't used this together with composite components yet, <a href="https://stackoverflow.com/questions/5370184/how-to-programmatically-or-dynamically-create-a-composite-component-in-jsf-2">this question</a> seems to have some more details and an <a href="http://confluence.highsource.org/display/Hifaces20/Dynamic+Faces+-+sample+demonstrating+dynamic+or+programmatic+UI+creation+with+JSF+2.0+and+Facelets" rel="nofollow noreferrer">example application</a> regarding using this with composite components.</p> <p><strong>Edit:</strong> Regarding your edit, you can also evaluate EL expressions in your managed bean like this:</p> <pre><code>FacesContext facesContext = FacesContext.getCurrentInstance(); ELContext elContext = facesContext.getELContext(); ExpressionFactory exprFactory = facesContext.getApplication().getExpressionFactory(); ValueExpression expr = exprFactory.createValueExpression(elContext, "#{expr}", String.class); String value = (String) expr.getValue(elContext); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload