您的位置:首页 >> 编程开发 >> Java >> Java基础 >> Eclipse >> 正文
Eclipse RSS
 

MyEclipse 下开发JSF教程

http://www.rdxx.com 05年07月27日 22:25 CSDN 我要投稿

关键词: MyEclipse , JSF , 开发 , 教程 , IP
 

First step with JavaServer Faces using Eclipse

This tutorial facilitates the first steps with the quite new framework JavaServer Faces (JSF). Step by step an example application (a library) will be created, which illustrate the different elements of the framework.

The example application will provide the following functionality.

  • Display a book overview (list of books)

  • Add, edit and delete a book

Generals

Author:

Sascha Wolski

http://www.laliluna.de/tutorials.html Tutorials for Struts, EJB, xdoclet, JSF, JSP and eclipse.

Date:

December, 21 2004


Source code:

The sources do not contain any project files of eclipse or libraries. Create a new project following the tutorial, add the libraries as explained in the tutorial and then you can copy the sources in your new project.

http://www.laliluna.de/assets/tutorials/first-java-server-faces-tutorial.zip

PDF Version des Tutorials:

http://www.laliluna.de/assets/tutorials/first-java-server-faces-tutorial-en.pdf

Development Tools

Eclipse 3.x

MyEclipse plugin 3.8

(A cheap and quite powerful Extension to Eclipse to develop Web Applications and EJB (J2EE) Applications. I think that there is a test version availalable at MyEclipse.)


Application Server

Jboss 3.2.5

You may use Tomcat here if you like.




Create a JavaServer faces project

Create a new web project. File > New > Project.




Set a nice name and add the JSTL Libraries to the project.




Add the JavaServer faces Capabilities. Right click on the project and choose MyEclipse > Add JSF Capabilities.







The class Book

Add an new package de.laliluna.tutorial.library und create a new class named Book.







Open the class and add the following private properties:

  • id

  • author

  • title

  • available

Generate a getter- and setter-method for each property. Right click on the editor window and choose Source > Generate Getter- and Setter Methods.






Furthermore you have to add a constructor, which set the properties if you initialisize the instance variable of the newly object.

The following source code show the class book.

public class Book implements Serializable {

// ------------------ Properties --------------------------------
private long id;
private String author;
private String title;
private boolean available;

// ------------------ Constructors --------------------------------
public Book(){}
public Book(long id, String author, String title, boolean available){
this.id = id;
this.author = author;
this.title = title;
this.available = available;
}

// ------------------ Getter and setter methods ---------------------

public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public boolean isAvailable() {
return available;
}
public void setAvailable(boolean available) {
this.available = available;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {

共6页  1 2 3 4 5 6


 
 
标签: MyEclipse , JSF , 开发 , 教程 , IP 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站