1Z0-900 · Question #10
1Z0-900 Question #10: Real Exam Question with Answer & Explanation
Options C and D are correct. D works because the pt: prefix is the JSF pass-through attributes namespace (xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"), which explicitly tells JSF to render any prefixed attribute as a native HTML attribute on the output element - making pt:pla
Question
Exhibit
Options
- B<h:inputText value="#(searchMB.query)" placeholder="Search here"/>
- C<input jsf:id="search" placeholder="Search here" jsf:value="# (searchMB.query)"></input>
- D<h:inputText pt:placeholder="Search Here" value="#(searchMB.query)"/>
- E<input id="search" jsf:placeholder="Search Here" value="$(searchMB.query)"></input>
Explanation
Options C and D are correct.
D works because the pt: prefix is the JSF pass-through attributes namespace (xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"), which explicitly tells JSF to render any prefixed attribute as a native HTML attribute on the output element - making pt:placeholder appear as placeholder in the final HTML. C works because it uses a JSF pass-through element: a plain HTML <input> tag gains JSF component behavior via the jsf: namespace (e.g., jsf:id, jsf:value), while non-prefixed attributes like placeholder are rendered as-is, giving you full HTML5 attribute support.
A is wrong because <f:param> injects URL query parameters, not HTML element attributes. B is wrong because JSF component tags like <h:inputText> only recognize their own declared attributes; arbitrary HTML attributes like placeholder are silently ignored and not passed through to the rendered HTML. E is wrong for two reasons: jsf:placeholder is not valid (the jsf: namespace is for component bindings like jsf:value/jsf:id, not HTML attributes), and it uses the invalid $() EL syntax instead of #{}.
Memory tip: When you need to add HTML5 attributes to JSF components, remember "PT = Pass-Through" - either use pt:attribute on JSF tags, or write plain HTML tags with jsf: bindings and drop native HTML attributes directly.
Topics
Community Discussion
No community discussion yet for this question.
