3
good night.
I have a JSF page called simulated.xhtml on which implement a filter to generate the simulated and I’m also trying to display results from the database that have already been filtered on this page, but as a result I get these results:
[com.sisEnade.tcc.modelo.Questao@20, com.sisEnade.tcc.modelo.Questao@21, com.sisEnade.tcc.modelo.Questao@22]
I tried to implement in a datatable more whenever I click on generate Simulated I get a notfound, it’s like the datatable needs to reload right after clicking on the button. You can help me with that detail too?
I’m trying to exhibit the following way to test:
Page JSF:
<ui:define name="titulo">Gerar Simulado</ui:define>
<ui:define name="corpo">
<h1>Filtro para gerar Simulado</h1>
<h:form id="frmCadastro">
<br></br>
<h:panelGrid columns="2">
<p:outputLabel value="Curso" for="curso" style="font-weight:bold" />
<p:selectOneMenu id="curso"
value="#{gerarSimuladoBean.cursoSelecionado}"
converter="cursoConverter" required="true"
requiredMessage="Preencha o curso">
<f:selectItem itemLabel="Selecione..." />
<f:attribute name="collectionType" value="java.util.ArrayList" />
<f:selectItems value="#{cadastroQuestaoBean.cursos}" var="curso"
itemLabel="#{curso.nome}" itemValue="#{curso}" />
</p:selectOneMenu>
</h:panelGrid>
<h:panelGrid id="gridComplexidade" columns="2">
<p:outputLabel value="Complexidade da Questão" for="complexidade"
style="font-weight:bold" />
<p:selectOneMenu id="complexidade"
value="#{gerarSimuladoBean.complexidadeSelecionada}"
required="true"
requiredMessage="Por favor, preencha a complexidade.">
<f:selectItem itemLabel="Selecione..." />
<f:selectItem itemLabel="1" itemValue="1" />
<f:selectItem itemLabel="2" itemValue="2" />
<f:selectItem itemLabel="3" itemValue="3" />
<f:selectItem itemLabel="4" itemValue="4" />
<f:selectItem itemLabel="5" itemValue="5" />
</p:selectOneMenu>
</h:panelGrid>
<h:panelGrid id="gridNumeroQuestoes" columns="2">
<p:outputLabel value="Número de questoes" for="numeroDeQuestoes"
style="font-weight:bold" />
<p:selectOneMenu id="numeroDeQuestoes"
value="#{gerarSimuladoBean.numeroDeQuestoesSimulado}"
required="true"
requiredMessage="Por favor, preencha o numero de questoes.">
<f:selectItem itemLabel="Selecione..." />
<f:selectItem itemLabel="3" itemValue="3" />
<f:selectItem itemLabel="5" itemValue="5" />
<f:selectItem itemLabel="10" itemValue="10" />
<f:selectItem itemLabel="20" itemValue="20" />
<f:selectItem itemLabel="40" itemValue="40" />
</p:selectOneMenu>
</h:panelGrid>
<p:commandButton value="Gerar Simulado"
action="#{gerarSimuladoBean.gerarSimulado}" icon="ui-icon-search"
iconPos="right" update="frmCadastro">
</p:commandButton>
<br></br>
<br></br>
<br></br>
<br></br>
<p:panelGrid id="teste">
<h:outputText value="#{gerarSimuladoBean.questoes}">
</h:outputText>
</p:panelGrid>
</h:form>
</ui:define>
</ui:composition>
Snippet where you are displaying object addresses:
<p:panelGrid id="teste">
<h:outputText value="#{gerarSimuladoBean.questoes}">
</h:outputText>
</p:panelGrid>
Thanks friend, solved perfectly. However, I am with another problem. I posted further below as an answer, please can help me?
– Felipe Portela
@Felipeportela I don’t understand what you mean by "datatable console". If you are displaying the texts one after the other on a web page, they will not respect line breaks in the page code. To break lines in HTML you can use tags
<br/>
,<p>
or, better still in that context, list not listed with<ul>
and<li>
.– utluiz