Note that there are some explanatory texts on larger screens.

plurals
  1. POparameter in ui:param is not passed
    text
    copied!<p>I'm new to JSF and trying to understand how include and param work, but have been stuck. Any help is much appreciated. </p> <p>I have 2 simple pages (for testing purpose), Page1.xhtml and Page2.xhtml. I want to include Page2 into Page1 with one parameter using and in Page1. When I call Page2 directly, I can see the parameter being passed properly, but when I call Page1, Page2 is being included without the parameter. Below is the code.</p> <p>Page1:</p> <pre><code>&lt;h:body&gt; &lt;h:form id="test"&gt; &lt;b&gt;Page 1&lt;/b&gt;&lt;br/&gt; &lt;ui:include src="Page2.xhtml"&gt; &lt;ui:param name="id" value="123" /&gt; &lt;/ui:include&gt; &lt;b&gt;End of Page 1&lt;/b&gt; &lt;/h:form&gt; </code></pre> <p>Page2: </p> <pre><code>&lt;h:head&gt; &lt;f:view contentType="text/html"&gt;&lt;/f:view&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;h:outputLabel for="ID" value="ID on Page2: "/&gt; &lt;h:outputText id="ID" value="#{pageTestBean.id}"/&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>PageTestBean: @ManagedBean @SessionScoped public class PageTestBean {</p> <pre><code>private Long id=new Long(11111); public void init() { //doesn't do anything yet; } // Getters and Setters public long getId() { return id; } public void setId(long id) { this.id = id; } } </code></pre> <p>I'm expecting to see "123" as the output Id on Page1, not "11111" which is the default value when no parameter is passed in. However, I always see 11111. Is my expectation wrong? </p>
 

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