Etiket arşivi: ilk jsf projesi

JSF’e Giriş.

Gereksinimler:
1-Eclipse WTP(Web Tool Platform)
2-Apache Tomcat Application Server v6.0
3-Gerekli Jarlar.(myfaces-api,myfaces-impl,jstl) (//Jar dosyalarına buradan ulaşabilirsiniz.)

İlk JSF Projesi(Adım Adım)

1)Eclipse içerisinde dynamic web project oluşturuyoruz.
2)WebContent>WEB-INF>lib dizinin altına gerekli jar dosylarını ekliyoruz.
3)WebContent klasörünün altına index.jsp sayfasını oluşturuyoruz.(İçine verilen kod bloğunu ekleyin)

<%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%>
<%@ taglib prefix=”f”  uri=”http://java.sun.com/jsf/core”%>
<%@ taglib prefix=”h”  uri=”http://java.sun.com/jsf/html”%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>JSF Start</title>
</head>
<body>
<f:view>
<h:outputText value=”Hello World”/>
</f:view>
</body>
</html>

4)WebContent>WEB-INF dizininin altındaki web.xml dosyasını açıp içine gerekli satırları ekliyoruz.

<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>*.jsf</url-pattern>
</servlet-mapping>

5)Son olarak da index.jsp sayfasına sağ tıklayıp RunAs > RunOnServer seçip çalıştırabiliriz.
6)Tebrikler ilk jsf projenizi geliştirdiniz.