Olá,
usando jsf 1.0,java 6,tomcat 6 , mysql …
queria um auxilio pois tenho uma enquete onde tenho 10 perguntas e cada pergunta coloco na mesma
página .
A cada resposta ponho a mensagem na tela Pergunta Respondida mais quando aparece a próxima pergunta
continua a amensagem na tela e queria que limpasse ou se tivesse outra forma de fazer isso.
Se alguém puder me ajudar agradeceria.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:demoiselle="http://www.frameworkdemoiselle.gov.br">
<ui:composition template="/public/templates/default.xhtml">
<ui:define name="body">
<h:form>
<demoiselle:useJs all="true">
</demoiselle:useJs>
<rich:panel styleClass="richPanelStyleClass" bodyClass="richPanelBodyClass" headerClass="richPanelHeaderClass">
<div>
<br/>
<br/>
<h:outputLabel value="Pergunta"/>
<br/>
<br/>
<h:inputText value="#{respostaAlunoMB.respostaAluno.perguntaAluno.pergunta}" />
<h:selectOneMenu value="#{respostaAlunoMB.pontuacao}" >
<f:selectItem itemLabel="Peso 1" itemValue="1" />
<f:selectItem itemLabel="Peso 2" itemValue="2"/>
<f:selectItem itemLabel="Peso 3" itemValue="3"/>
<f:selectItem itemLabel="Peso 4" itemValue="4"/>
</h:selectOneMenu>
</div>
</rich:panel>
<rich:panel styleClass="richPanelStyleClass" bodyClass="richPanelBodyClass" headerClass="richPanelHeaderClass">
<rich:tabPanel styleClass="richTabPanelStyleClass" headerClass="richTabPanelHeaderClass" tabClass="richTabPanelTabClass" activeTabClass="richTabPanelActiveTabClass" inactiveTabClass="richTabPanelInactiveTabClass" disabledTabClass="richTabPanelDisabledTabClass" contentClass="richTabPanelContentClass" switchType="client">
<rich:tab tabindex="2"/>
</rich:tabPanel>
</rich:panel>
<div style="padding: 10px; text-align: right;">
<t:commandButton title="Próxima Pergunta" value="Próxima Pergunta" action="#{respostaAlunoMB.incluir_resposta}"/>
</div>
</h:form>
</ui:define>
</ui:composition>
</html>
if (contador >0) {
WebMessageContext.getInstance().clear();
ContextLocator.getInstance().getMessageContext().addMessage(InfoMessage.INSERIR_OK);
}
/* Nova Pergunta */
perguntaAlunoUsado = new PerguntaAluno();
respostaAluno = new RespostaAluno();
contador = contador +1;
perguntaAlunoObject = respostaAlunoBC.buscar(contador);
/*verifica se existe pergunta*/
if (perguntaAlunoObject==null){
return AliasNavigationRule.ALIAS_RESPOSTA_ALUNO_FINAL_PERGUNTA;
}
BigInteger id= (BigInteger) perguntaAlunoObject[0];
String pergunta= (String) perguntaAlunoObject[1];
perguntaAlunoUsado.setId(id.longValue());
perguntaAlunoUsado.setPergunta(pergunta);
respostaAluno.setPerguntaAluno(perguntaAlunoUsado);
respostaAluno.setPerguntaAluno(perguntaAlunoUsado);
for (IMessage imsg : WebMessageContext.getInstance().getMessages()) {
addMessage(imsg);
}
} catch (ApplicationRuntimeException e) {
addMessage(e.getObjectMessage(), e);
}
WebMessageContext.getInstance().clear();
return AliasNavigationRule.ALIAS_RESPOSTA_ALUNO_RESPONDE;
}