Opa pessoal? beleza?
Estou com um problema, tentei algumas soluções mais não consegui fazer,
estou estudando o RichFaces e não estou conseguindo limpar o meu form quando ele é fechado:
Pagina:
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich" %>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<html>
<body>
<f:view>
<rich:modalPanel id="panel" width="500" height="500">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Cadastar Usuário"></h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/images/modal/close.png" styleClass="hidelink" id="hidelink"/>
<rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
<h:form>
<table>
<tr>
<td>
<h:outputText value="Nome: "></h:outputText>
</td>
<td>
<h:inputText id="nome" value="#{UserManaged.user.name}">
<rich:ajaxValidator event="onkeydown"></rich:ajaxValidator>
</h:inputText>
</td>
<td>
<rich:message for="nome"></rich:message>
</td>
</tr>
<tr>
<td>
<h:outputText value="Sobrenome: ">
</h:outputText>
</td>
<td>
<h:inputText required="true" requiredMessage="Valor Obrigatório." id="sobrenome" value="#{UserManaged.user.sobrenome}">
<rich:ajaxValidator event="onblur"></rich:ajaxValidator>
</h:inputText>
</td>
<td>
<rich:message for="sobrenome"></rich:message>
</td>
</tr>
</table><br>
<table width="100%">
<tr>
<td align="center"><a4j:commandButton value="Cadastrar Usuário"></a4j:commandButton></td><td></td><td></td><td></td>
</tr>
</table>
</h:form>
</rich:modalPanel>
<h:outputLink value="#" id="link" onclick="#{UserManaged.clean()}">
Cadastrar Cliente
<a4j:support action="onclick" reRender="nome"></a4j:support>
<a4j:support action="onclick" reRender="sobrenome"></a4j:support>
<rich:componentControl for="panel" attachTo="link" operation="show" event="onclick" />
</h:outputLink>
</f:view>
</body>
</html>
ManagedBean:
package manageds;
import beans.User;
public class UserManaged {
private User user = new User();
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String clean(){
user = new User();
return "clean";
}
}
Por que meus componentes não renderizam? Está faltando algo?
Abraço, obrigado desde já.