I am trying use the sample from showcase of commandButton.
But when I do this:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Rich Teste</title>
</h:head>
<h:body>
<h:outputStylesheet>
form {
background: #fee3ad
}
</h:outputStylesheet>
<h:form id="iddoform" >
<h:panelGrid columns="3">
<h:outputText value="Nome:" />
<h:inputText value="#{testeBean.nome}"/>
<a4j:commandButton value="Teste" render="iddoform:out" execute="@form" />
</h:panelGrid>
<br />
<a4j:outputPanel id="out">
<h:outputText value="Hello #{testeBean.nome} !"/>
</a4j:outputPanel>
</h:form>
<br />
<a4j:log />
</h:body>
</html>
It didn't work, so I changed to this:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:f="http://java.sun.com/jsf/core">
<h:outputStylesheet>
form {
background: #fee3ad
}
</h:outputStylesheet>
<h:form id="iddoform">
<h:panelGrid columns="3">
<h:outputText value="Nome:" />
<h:inputText value="#{testeBean.nome}" />
<a4j:commandButton value="Teste"
render="iddoform:out" execute="@form" />
</h:panelGrid>
<br />
<a4j:outputPanel id="out">
<h:outputText value="Hello #{testeBean.nome} !" />
</a4j:outputPanel>
</h:form>
</html>
enter code here
And it works!
The change was to remove the head and body from html.
My question is: 'Why doesn't work with head and body tags?'.
PS: I am try with render="iddoform:out", :iddoform:out and out; And i am try with immediate true too, but dont work.
When you say "it doesn't work" you have to say how are you expecting it to work.
It's not the <h:head>
and <h:body>
that makes it not work, it's the immediate="true"
. It makes the button action be processed before the name can be set. You don't have it in your second example, that's why it works.
Also you don't have to use iddoform:out
to point to the panel, just out
is enough, the engine will find it.