Pessoal
Estou tendo problema para implantar o sistema de busca usando JSP, JSF e Hibernate segue abaixo:
pacote LivrariaDAO
public List consultarTitulos (String titulo){
session = ConnectionLivrariaFactory.getInstance();
Query query = session.createQuery("from Livros l where l.titulo like :titulo");
List list = query.setString("titulo", "%"+titulo+"%").list();
return list;
}
pacote meupacote.dao.InterfaceLivrosDAO
public abstract List consultarTitulos(String titulo);
pacote meupacote.controller.LivrosController
[code]public String getKeysearch(){
return keysearch;
}
public void setKeysearch(String keysearch){
this.keysearch = keysearch;
}
public DataModel getBuscaLivros(){
InterfaceLivrosDAO idao = new LivrariaDAO();
model =
new ListDataModel(idao.consultarTitulos(keysearch));
return model;
}
[/code]
menu.jsp
<f:view>
<h:form id="buscar">
<h:panelGrid columns="2">
<f:facet name="header">
<h:outputText value="Busca de Livros" />
</f:facet>
<h:outputText value="Titulo: " />
<h:inputText size="30" id="titulo" value = "#{LivrosView.keysearch}" />
<%-- METODO QUE CHAMA MEUPACOTE.CONTROLLER --%>
</h:panelGrid>
<h:commandButton value="Buscar" action="buscar" />
</h:form>
</f:view>
mostrarLivrosPesquisado.jsp
[code]<f:view>
<h:messages />
Livros Encontrados
<h:form>
<h:dataTable value=’#{livrosView.BuscarLivro}’
var=‘item’ border=“1”
cellpadding=“2” cellspacing=“0”>
<h:column>
<f:facet name=“header”>
<h:outputText value=“ISBN” />
</f:facet>
</h:column>
<h:column>
<f:facet name=“header”>
<h:outputText value=“Título” />
</f:facet>
<h:outputText value="#{item.titulo}"/>
</h:column>
<h:column>
<f:facet name=“header”>
<h:outputText value=“Publicacao em” />
</f:facet>
<h:outputText value="#{item.publicacao}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Excluir Livros" />
</f:facet>
</h:column>
</h:dataTable>
<h:commandLink action="#{livrosView.novoLivro}"
value="Cadastrar novo livro" />
</h:form>
</f:view>
</body>
[/code]
faces-config
<faces-config>
<!--- O Bean LivrosController -->
<managed-bean>
<managed-bean-name>livrosView</managed-bean-name>
<managed-bean-class>
meupacote.controller.LivrosController
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<!-- Cadastro de novo livro -->
<navigation-rule>
<display-name>formLivros</display-name>
<from-view-id>/formLivros.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso_ins</from-outcome>
<to-view-id>/mostrarLivros.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- Chamada ao formulario de cadastro de livro -->
<navigation-rule>
<display-name>menu</display-name>
<from-view-id>/menu.jsp</from-view-id>
<navigation-case>
<from-outcome>novo</from-outcome>
<to-view-id>/formLivros.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!--Sucesso da exclusão do Livro -->
<navigation-rule>
<display-name>mostraLivros</display-name>
<from-view-id>/mostrarLivros.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso_exc</from-outcome>
<to-view-id>/mostrarLivros.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- Mostrando livro pesquisado -->
<navigation-rule>
<navigation-case>
<from-outcome>buscar</from-outcome>
<to-view-id>/mostrarLivrosPesquisado.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
e apresenta esse erro
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Target Unreachable, identifier ‘LivrosView’ resolved to null
root cause
javax.el.PropertyNotFoundException: Target Unreachable, identifier ‘LivrosView’ resolved to null
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.0.1 logs.
alguém poderia me ajudar ?
Obrigado
[/quote]