Pessoal, estou estudando jsf com primefaces, porém ao executar no tomcat 7 o index dá uma excessão do tipo HTTP Status 404. Estou me debulhando com esse problema. Aqui estão as classes index.xhtml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:body>
<h1>Novo Livro</h1>
<h:form>
<fieldset>
<legend>Dados do livro</legend>
<h:panelGrid columns="2">
<h:outputLabel value="Título" for="titulo" />
<h:inputText id="titulo" value="#{livroBean.livro.titulo}" />
<h:outputLabel value="ISBN" for="isbn" />
<h:inputText id="isbn" value="#{livroBean.livro.isbn}" />
<h:outputLabel value="Preço" for="preco" />
<h:inputText id="preco" value="#{livroBean.livro.preco}" />
<h:outputLabel value="Data de lançamento" for="dataLancamento" />
<h:inputText id="dataLancamento" value="#{livroBean.livro.dataLancamento}" />
<h:commandButton value="gravar" action="#{LivroBean.gravar}" />
</h:panelGrid>
</fieldset>
</h:form>
</h:body>
</html>
Fexx
Abril 23, 2013, 1:21am
#2
Como está o seu web.xml ? e como está chamando o index ?
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>jsf_livraria</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
e estou chamando o index de index.xhtml.
Da um Clean no servidor e tenta rodar novamente
localhost:porta/projeto/pagina.xhtml
Em qual diretorio está o seu arquivo index.xhtml?
Pessoal, muito obrigado pela atenção. Mas sem querer acabei resolvendo, rsrsrs.
Comentei o do jsf e criei outro normal, rodei, funcionou e depois tirei o comentario e simplesmente funcionaou. Vai entender…
Funfou, porém onde fica o <h:commandButton value="gravar" action="#{livroBean.gravar}" /> aparece um círculo vermelho com um X informando um erro. O que será?
bom no primeiro código que postou o “#{LivroBean.gravar}” está com letra maiúscula
devia está assim “#{livroBean.gravar}”
da uma olhada la no faces-config onde mapeou e posta o código (caso nao esteja mapeado com annotations)