Adicionar primefaces + jsf em projeto existente?

3 respostas
D

opa pessoal beleza?
e o seguinte, ja tenho um projeto web criado no netbeans e precisava colocar o primefaces e o jsf, eu coloco os jars nas bibliotecas mas nao rola
alguem poderia me explicar como eu posso fazer isso?

obrigado

3 Respostas

T

colocou o .jar do JSF2.x e do primefaces?
modificou o web.xml ?
adicionou o faces-config.xml?

C

jsf não é so colocar os jar que ja esta funcionando ha algumas configurações que precisam ser feitas, mas para isso procure algum tutorial na net ha boleiras…

F

danielswater, estou estudando jsf com esse livro aqui.

Crie um DynamicWebProject pra teste e configure o nosso amigo web.xml assim:

<?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" id="WebApp_ID" version="3.0">
  <display-name>TesteJSF</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <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>/faces/*</url-pattern>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
</web-app>

Adquira as libs abaixo e add no seu projeto:

commons-collections-3.2.1.jar
commons-discovery-0.2.jar
commons-logging.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.0.1.Final.jar
hibernate-entitymanager-4.0.1.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
javax.faces-2.1.4.jar
primefaces-3.4.2.jar

Crie uma pagina ola-mundo.xhtml.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html">
<h:body>

	<h1>
		<b>ola mundo </b>
	</h1>

</h:body>
</html>

Abs!

Criado 7 de março de 2013
Ultima resposta 8 de mar. de 2013
Respostas 3
Participantes 4