İpucu

Eclipse Jetty Plugin ve JSF 2.2 Web Projesi

Bu projede JSF 2.2 web uygulaması yaratıyoruz. Bu uygulamayı Eclipse Jetty plugin ile çalıştırıyoruz. (Eclipse Jetty plugin ile bir web projesi örneğine www.fibiler.com/Jetty-ile-Eclipse-Uzerinde-Web-Uygulamasi-Gelistirme_Ipucu_147334 sayfasından bakabilirsiniz.)

Öncelikle JSF ile ilgili bağlantıları pom.xml e ekliyoruz :

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>javax.servlet-api</artifactId>
	<version>3.1.0</version>
</dependency>
<dependency>
	<groupId>com.sun.faces</groupId>
	<artifactId>jsf-api</artifactId>
	<version>2.2.20</version>
</dependency>
<dependency>
	<groupId>com.sun.faces</groupId>
	<artifactId>jsf-impl</artifactId>
	<version>2.2.20</version>
</dependency>


web.xml aşağıdaki gibi :

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" 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>HelloJSF2_2</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.xhtml</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>*.xhtml</url-pattern>
  </servlet-mapping>
</web-app>


Aşağıdaki gibi örnek bir index.xhtml sayfası yaratalım ve hemen ana dizine koyalım :

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
   <head>
      <meta charset="ISO-8859-9"/>
      <title>Merhaba JSF 2.2</title>
   </head>
   <body>   
   		<h:outputText value="Merhaba JSF 2.2"></h:outputText>   
   </body>
</html>


Proje üzerinde sağ tıklayıp Run As - Run with Jetty ile çalıştırılır. Artık localhost:8080 yazıldığında index.xhtml sayfası görülecektir.
zafer.teker , 03.07.2020

Bu Sayfayı Paylaş:

Fibiler Üyelerinin Yorumları


Tüm üyeler içeriklere yorum ekleyerek katkıda bulunabilir : Yorum Gir

Misafir Yorumları




Bu Sayfayı Paylaş:

İletişim Bilgileri

Takip Et

Her Hakkı Saklıdır. Bu sitede yayınlanan tüm bilgi ve fikirlerin kullanımından fibiler.com sorumlu değildir. Bu sitede üretilmiş , derlenmiş içerikleri, fibiler.com'u kaynak göstermek koşuluyla kendi sitenizde kullanılabilirsiniz. Ancak telif hakkı olan içeriklerin hakları sahiplerine aittir