2

I am trying to figure out a way to get h:messages to display with the JQuery UI highlight box around it. But by putting it the f:verbatim tag it isn't rendering. If I try anything like splitting it out into 2 f:verbatim tags around the HTML I will get:

javax.servlet.ServletException: Error Parsing /index.xhtml: Error Traced[line: 25] The element type "p" must be terminated by the matching end-tag "

".
<f:verbatim rendered="#{uploadBean.hasMessage}">
    <div class="ui-widget">
    <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
            <p>
        <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
            **<h:messages />**
    </p>
    </div>
 </div>
</f:verbatim>
dthollis
  • 35
  • 5

1 Answers1

3

Don't use <f:verbatim> to render partials containing JSF components. There it is not for. The <f:verbatim> is a leftover of old and dark JSF 1.0/1.1 ages when it was not possible to inline plain HTML tags in a JSF page. Even more, the <f:verbatim> is deprecated since JSF 2.0.

Use <h:panelGroup> instead.

<h:panelGroup rendered="#{uploadBean.hasMessage}">
    ...
</h:panelGroup>

When looking for JSF 2.x resources/answers, make sure that you're reading JSF 2.x targeted ones, not JSF 1.x targeted ones. The change is too big and a lot of things are done differently/better in JSF 2.x than in JSF 1.x.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555