Ola pessoal, estou com um problema por causa de uma migraçao que fiz de JSP para XHTML.
O problema é na ActionListener de Alterar e Excluir, que com o jsf funcionavam, agora naum funcionam mais…
os métodos
[code] public String excluir(ActionEvent event) {
System.out.println("Excluindo: " + perguntas.getCod_perguntas());
UIComponent link = event.getComponent();
UIParameter param = (UIParameter) link.findComponent(“excluir”);
Long id = (Long) param.getValue();
Session session = HibernateUtil.currentSession();
Dao<Perguntas> perguntasDao = new Dao<Perguntas>(session,
Perguntas.class);
this.perguntas = perguntasDao.load(id);
perguntasDao.delete(this.perguntas);
this.perguntas = new Perguntas();
return "excluido";
}
public void escolhePerguntas(ActionEvent event) {
UIComponent link = event.getComponent();
UIParameter param = (UIParameter) link.findComponent("editCod");
Long id = (Long) param.getValue();
Session session = HibernateUtil.currentSession();
Dao<Perguntas> dao = new Dao<Perguntas>(session, Perguntas.class);
this.perguntas = dao.load(id);
}[/code]
O XHTML da pergunta:
[code]<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition template="/pages/template/template.xhtml">
<ui:define name=“corpo”>
<h:outputText value="Descrição: " />
<h:inputText value="#{perguntasHandler.perguntas.descricao}" required="true" validator="#{perguntasHandler.validaCase}">
<f:validateLength minimum="5" />
</h:inputText>
<h:outputText value="Tipo: " />
<h:inputText value="#{perguntasHandler.perguntas.tipo}" required="true" validator="#{perguntasHandler.validaCase}">
<f:validateLength minimum="2" />
</h:inputText>
<h:commandButton value="Salvar" action="#{perguntasHandler.salva}" />
<rich:spacer height="10"/>
<rich:separator height="1" lineType="dotted"/>
<rich:spacer height="10"/>
<ui:include src="listaperguntas.xhtml" />
</h:panelGrid>
</h:form>
</f:view>
[/code]
O XHTML da listapergunta que tem as chamadas alterar e excluir:
[code]<?xml version="1.0" encoding="ISO-8859-1"?>
<h:column>
<f:facet name="header">
<h:outputText value="Alterar"/>
</f:facet>
<h:commandButton value="Alterar" actionListener="#{perguntasHandler.escolhePerguntas}">
<f:param id="editCod" name="cod_perguntas" value="#{f.cod_perguntas}"/>
</h:commandButton>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Excluir"/>
</f:facet>
<h:commandButton value="Excluir" actionListener="#{perguntasHandler.excluir}" />
<f:param id="excluir" name="cod_perguntas" value="#{f.cod_perguntas}"/>
</h:column>
<f:facet name="footer">
<rich:datascroller/>
</f:facet>
</rich:dataTable>
</h:form>
</f:subview>
[/code]A diferença básica foi o include da listapergunta.xhtml na pergunta.xhtml:
era assim:
<f:include page="listaperguntas.xhtml" />
ficou assim:
<ui:include src="listaperguntas.xhtml" />
se eu deixar da primeira forma, me dá esse erro na hora de abrir a pagina:
An Error Occurred:
/pages/questionario/perguntas.xhtml @41,43 <f:include> Tag Library supports namespace: http://java.sun.com/jsf/core, but no tag was defined for name: include
Eae galera, alguma sugestão??
