is there any way to include the page's title inside an f:ajax
tag, so that its content is also updated at run time? currently my f:ajax tag looks like this -
<f:ajax render="@form">
i tried to add an id to the h:head tag, and add that id to the 'render' property of the f:ajax tag, but if i do so i get an error when the page loads -
<f:ajax> contains an unknown id 'pageHead' - cannot locate it in the context of the component B1
cheers, eRez
Interesting question. I think there is no such command in render of ajax (like @form) to re-render the page title. What you can do is to wrap <title>
with <h:form>
or other "grouping" component (eg. h:panelGroup
as Daniel said) like this :
<h:form id="titleForm">
<title>#{fooBean.fooTitle}</title>
</h:form>
And then call ajax update eg. with button :
<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
I don't know what else could you do, this should work. So wrap your title
with <h:form id="...">
and then render it from ajax.