• Complain

Michael Müller - Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise

Here you can read online Michael Müller - Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: Apress, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Michael Müller Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise
  • Book:
    Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise
  • Author:
  • Publisher:
    Apress
  • Genre:
  • Year:
    2018
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Master the Java EE 8 and JSF (JavaServer Faces) APIs and web framework with this practical, projects-driven guide to web development. This book combines theoretical background with a practical approach by building four real-world applications. By developing these JSF web applications, youll take a tour through the other Java EE technologies such as JPA, CDI, Security, WebSockets, and more. In Practical JSF in Java EE 8, you will learn to use the JavaServer Faces web framework in Java EE 8 to easily construct a web-based user interface from a set of reusable components. Next, you add JSF event handling and then link to a database, persist data, and add security and the other bells and whistles that the Java EE 8 platform has to offer. After reading this book you will have a good foundation in Java-based web development and will have increased your proficiency in sophisticated Java EE 8 web development using the JSF framework. What You Will Learn Use the Java EE 8 and the JavaServer Faces APIs to build Java-based web applications through four practical real-world case studies Process user input with JSF and the expression language by building a calculator application Persist data using JSF templating and Java Persistence to manage an inventory of books Create and manage an alumni database using JSF, Ajax, web services and Java EE 8s security features. Who This Book Is For Those new to Java EE 8 and JSF. Some prior experience with Java is recommended.

Michael Müller: author's other books


Who wrote Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise? Find out the surname, the name of the author of the book and a list of all author's works by series.

Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Part I
TinyCalculator
Michael Mller 2018
Michael Mller Practical JSF in Java EE 8
1. TinyCalculator
Michael Mller 1
(1)
Brhl, Nordrhein-Westfalen, Germany
TinyCalculator is the first and simplest application discussed in this book. Its nothing more than a simple calculator for basic arithmetic. But it is useful to show some fundamental concepts of web applications with Java and JSF.
As a kind of appetizer, and unlike how Ill handle the other applications, Ill first show you the whole application, with a little explanation afterwards. Then, as a kind of restart, I talk about the foundations of web applications and explain TinyCalculator and different approaches.
You can access the source code for TinyCalculator by clicking the Download Source Code button at www.apress.com/9781484230299 . You can also find the source code at http://webdevelopment-java.info .
Creating the Application
A web application with Java and JSF uses an application server to run. Dont be afraidyour IDE usually deals with that. Later on, Ill discuss that in more detail. Well start with the application.
For this book, I had to decide which IDE to use in the tutorial parts. NetBeans, either the Java EE or All edition, comes with GlassFish. At the time of writing, the direct link to the download page is https://netbeans.org/downloads/index.html . Because NetBeans has been donated to Apache, this location may change. If that link isnt available anymore, refer to https://apache.netbeans.org . Just install it, and no further configuration is needed to start with simple applications. Its quite easy.
Many of this books basic examples are based on NetBeans 8 (English), which is bundled with GlassFish 4. GlassFish 4 is the reference implementation of Java EE 7, which is fine for TinyCalculator. To enable the brand new Java EE 8 features, you need GlassFish 5 or any other Java EE 8compliant server, once available. GlassFish 5 will be bundled with NetBeans 9. Since the first donation (IDE) is still in progress, and Java EE is part of the second Java EE 8 donation, this may be a lengthy process. Ill describe how to update to Java EE 8 just after TinyCalculators explanation.
All applications in this book are built with Apache Maven ( ). Depending on your IDE, you may open Maven projects directly (for example, with NetBeans) or you may need to perform a simple import (for example, with Eclipse).
As a novice to JSF or Java EE, you may not have created any Java-based web application before. So, Ill start this one from scratch in the form of a step-by-step tutorial. Unlike in future chapters, Ill cover the whole application here without detailed explanation, and then well catch up after the tutorial:
  1. Launch NetBeans.
  2. From the File menu, choose New Project. NetBeans displays the New Project wizard , as shown in Figure .
    Figure 1-1 New Project wizard Click the category Maven click Web - photo 1
    Figure 1-1
    New Project wizard
  3. Click the category Maven, click Web Application, and then click Next. NetBeans displays the New Web Application wizard , as shown in Figure .
    Figure 1-2 New Web Application wizard For the Project Name enter - photo 2
    Figure 1-2
    New Web Application wizard
  4. For the Project Name, enter TinyCalculator . You may adapt the other fields as desired, or just keep them unchanged. Its good practice to set the Group Id to the reverse notation of your domain. Click Next, keep the settings in the next dialog unchanged, and click Finish.
    NetBeans creates a skeleton of a new web application for you and displays it within the projects tree , as shown in Figure .
    Figure 1-3 Projects tree Right-click secondary click TinyCalculator in - photo 3
    Figure 1-3
    Projects tree
  5. Right-click (secondary click) TinyCalculator in the projects tree and choose Properties from the context menu. The Project Properties screen appears, as shown in Figure .
    Figure 1-4 Framework configuration Choose the Frameworks category - photo 4
    Figure 1-4
    Framework configuration
  6. Choose the Frameworks category. Choose JavaServer Faces and click the Add button. Click the Configuration tab and change the contents of the JSF Servlet URL Pattern box to *.xhtml . Click OK.
    While adding JSF to your project, NetBeans creates a web page called index.xhtml within the web pages, keeping the formerly created index.html file.
  7. On the projects tree open the Web Pages node (if its not already open), as shown in Figure . Select index.html and delete it.
    Figure 1-5 Projects tree From the File menu choose New Fileor press the - photo 5
    Figure 1-5
    Projects tree
    From the File menu , choose New Fileor press the shortcut key shown in the menu, which is faster than clicking. The IDE opens the New File wizard, as shown in Figure .
    Figure 1-6 New File wizard Choose the category JavaServer Faces and - photo 6
    Figure 1-6
    New File wizard
  8. Choose the category JavaServer Faces and then choose JSF Managed Bean. Click Next.
    The New JSF Managed Bean window appears, as shown in Figure .
    Figure 1-7 New JSF Managed Bean Enter TinyCalculator as the Class Name - photo 7
    Figure 1-7
    New JSF Managed Bean
  9. Enter TinyCalculator as the Class Name and from Scope select request. Click Finish.
    NetBeans creates and opens a Java class file named TinyCalculator .
  10. Now, edit this class. Key in or paste the code shown in Listing .
    1 package de.muellerbruehl.tinycalculator ;
    3 import javax.inject.Named ;
    4 import javax.enterprise.context.RequestScoped ;
    6 /**
    7 *
    8 * @author mmueller
    9 */
    10 @Named
    11 @RequestScoped
    12 public class TinyCalculator {
    14 public TinyCalculator() {
    15 }
    17 private double _param1;
    18 private double _param2;
    19 private double _result;
    21 public double getParam1() {
    22 return _param1;
    23 }
    25 public void setParam1( double param1) {
    26 _param1 = param1;
    27 }
    29 public double getParam2() {
    30 return _param2;
    31 }
    33 public void setParam2( double param2) {
    34 _param2 = param2;
    35 }
    37 public double getResult() {
    38 return _result;
    39 }
    41 public void setResult( double result) {
    42 _result = result;
    43 }
    45 public String add(){
    46 _result = _param1 + _param2;
    47 return "";
    48 }
    50 public String subtract(){
    51 _result = _param1 - _param2;
    52 return "";
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise»

Look at similar books to Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise»

Discussion, reviews of the book Practical JSF in Java EE 8: Web Applications ​in Java for the Enterprise and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.