Display page title with jsf 2

Is there a way to include the page title inside the tag f:ajaxso that its content is also updated at run time? my f: ajax tag currently looks like this:

<f:ajax render="@form">

I tried adding an id to the h: head tag and adding this id to the "render" property of the f: ajax tag, but if I do, I get an error when loading the page -

<f:ajax> contains an unknown id 'pageHead' - cannot locate it in the context of the component B1

amuses, erese

+3
source share
1 answer

. , ajax (, @form), . , <title> <h:form> "" (, h:panelGroup, ) :

    <h:form id="titleForm">
        <title>#{fooBean.fooTitle}</title>
    </h:form>

ajax update, . :

        <h:commandButton immediate="true" value="Change title">
            <f:ajax event="click" render=":titleForm"  listener="#{fooBean.changeTitle}"/>
        </h:commandButton>

Bean:

  private String fooTitle;

  public void changeTitle() {
        this.fooTitle= "updatedTitle";
  }
// getter/setter

, , . , title <h:form id="...">, ajax.

+4

All Articles