Seam Tools Tutorial. Version: Final-SNAPSHOT

Similar documents
Getting Started Guide. Version: GA

Getting Started with JBoss Developer Studio. ISBN: Publication date: April 2008

JSF Tools Reference Guide. Version: M5

BEAWebLogic. Portal. Tutorials Getting Started with WebLogic Portal

Setting Up the Development Environment

Introduction to Eclipse Rich Client Platform Support in IBM Rational HATS. For IBM System i (5250)

Introduction to Eclipse Rich Client Platform Support in IBM Rational HATS For IBM System i (5250)

Installing and Configuring hopto Work. System Requirements Be sure you have these system requirements to install and use hopto Work.

open source community experience distilled

At the shell prompt, enter idlde

JBoss SOAP Web Services User Guide. Version: M5

IBM. IBM WebSphere Application Server Migration Toolkit. WebSphere Application Server. Version 9.0 Release

Enterprise Generation Language (EGL) for IBM i operating system Create a web application using EGL and the Data Access Application Wizard

TIBCO LiveView Web Getting Started Guide

Seam 3. Pete Muir JBoss, a Division of Red Hat

Installing and Configuring hopto Work for Citrix. System Requirements Be sure you have these system requirements to install and use hopto Work.

Creating a new CDC policy using the Database Administration Console

Just Enough Eclipse What is Eclipse(TM)? Why is it important? What is this tutorial about?

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

Using Eclipse for Java. Using Eclipse for Java 1 / 1

AquaLogic BPM Enterprise Configuration Guide

BlueMix Hands-On Workshop Lab A - Building and Deploying BlueMix Applications

Developing Applications with Java EE 6 on WebLogic Server 12c

Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat

Customizing DAZ Studio

JBoss WS User Guide. Version: CR1

BEAWebLogic. Portal. Tutorials Getting Started with WebLogic Portal

Product Documentation. ER/Studio Portal. User Guide. Version Published February 21, 2012

Creating your first JavaServer Faces Web application

IBM DB DB2 application development Hands-On Lab. Information Management Cloud Computing Center of Competence. IBM Canada Lab

TIBCO LiveView Web Getting Started Guide

Getting Started with Web Services

IBM. Developing with IBM Rational Application Developer for WebSphere Software V6

i2b2 Workbench Developer s Guide: Eclipse Neon & i2b2 Source Code

Web-enable a 5250 application with the IBM WebFacing Tool

JBoss WS User Guide. Version: GA

BEA WebLogic. Server. MedRec Clustering Tutorial

Using the IMS Universal Drivers and QMF to Access Your IMS Data Hands-on Lab

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

[ Getting Started with Analyzer, Interactive Reports, and Dashboards ] ]

Hibernate Tools Reference Guide. Version: GA

JSF Tools Reference Guide. Version: beta1

Cupid Documentation. Release 0.2 (ESMF v7) Rocky Dunlap

Just Get It Written: Deploying Applications to WebLogic Server Using JDeveloper and WLS Console Hands on Practice

JDK-WildFly-NetBeans Setup Local

Eclipse Setup. Opening Eclipse. Setting Up Eclipse for CS15

CSCI 201 Lab 1 Environment Setup

Portlet Application Development Webinar exercise using JSF and JPA with Rational Application Developer

Model Driven Development with EMF and EclipseLink (experiences in MDD and generating user interfaces)

Dreamweaver MX The Basics

Kendo UI. Builder by Progress : Using Kendo UI Designer

object/relational persistence What is persistence? 5

In this Tutorial we present tips and trick for the development enviroment eclipse and the extension MyEclipse.

CHAPTER 6. Organizing Your Development Project. All right, guys! It s time to clean up this town!

Introduction to IBM Rational HATS For IBM System i (5250)

Improve and Expand JavaServer Faces Technology with JBoss Seam

EUSurvey Installation Guide

Getting Started with Web Services

Module 3: Working with C/C++

Product Documentation. ER/Studio Portal. User Guide 2nd Edition. Version 2.0 Published January 31, 2013

Policy Commander Console Guide - Published February, 2012

Skyway Builder Developer's Guide

User Guide. Web Intelligence Rich Client. Business Objects 4.1

Rational Application Developer 7 Bootcamp

ROCK-POND REPORTING 2.1

Parallels Remote Application Server

Table of Contents. VMware AirWatch: Technology Partner Integration

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. RichFaces

Secure Mobile Access Module

Quick-start guide for installing the client software and starting your first review

Databases in Azure Practical Exercises

SAP NW CLOUD HANDS-ON WORKSHOP

SharePoint General Instructions

BlueMix Hands-On Workshop

EMC Documentum Composer

Lab 1: Getting Started with IBM Worklight Lab Exercise

CTC Accounts Active Directory Synchronizer User Guide

SymmetricDS Pro 3.0 Quick Start Guide

APAR PO06620 Installation Instructions

Creating Domain Templates Using the Domain Template Builder 11g Release 1 (10.3.6)

31 Working with Documents in Web Intelligence Rich Client

Workshop for WebLogic introduces new tools in support of Java EE 5.0 standards. The support for Java EE5 includes the following technologies:

BPM 7.5 Creating a Hello World iwidget

EUSurvey OSS Installation Guide

Appendix A: Courseware setup

Oracle Enterprise Manager Oracle Database and Application Testing. Application Testing Suite Lab. Session S318966

Newforma Contact Directory Quick Reference Guide

SAS AppDev Studio TM 3.4 Eclipse Plug-ins. Migration Guide

Talend Open Studio for Data Quality. User Guide 5.5.2

HP-UX for the Itanium Processor Family Architecture. 215 MB Approx

Using IBM Rational Business Developer wizards to create a Web application

AutomaTech Application Note July 2015

Managing your content with the Adobe Experience Manager Template Editor. Gabriel Walt Product Manager twitter.com/gabrielwalt

IBM DB Getting started with Data Studio Hands-On Lab. Information Management Cloud Computing Center of Competence.

McMaster Service-Based ehealth Integration Environment (MACSeie) Installation Guide July 24, 2009

Online Demo Guide. Barracuda PST Enterprise. Introduction (Start of Demo) Logging into the PST Enterprise

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

EMC Documentum Composer

BASIC USER TRAINING PROGRAM Module 4: Topology

(Introduction Title slide) (Forward engineering) [Start demo]

Transcription:

Seam Tools Tutorial Version: 4.2.0.Final-SNAPSHOT

1. Create a Seam Application... 1 1.1. Start Development Database... 1 2. 3. 4. 5. 1.2. Create and deploy Seam Web Project... 3 1.3. Start JBoss Application Server... 19 1.4. Workshop Project Code Overview... 25 Seam Action Development... 27 2.1. Create a New Seam Action... 27 2.2. Test Seam Action... 29 2.3. Modify Seam Action User Interface... 31 Declarative Security... 35 3.1. Edit Login Authentication Logic... 35 3.2. Secure Seam Page Component... 35 Browsing Workshop Database... 39 4.1. Database Connectivity Setup... 39 4.2. Browse Workshop Database... 40 Database Programming... 43 5.1. Reverse Engineer CRUD from a Running Database... 43 5.2. Use Hibernate Tools to Query Data via JPA... 5.3. Use Hibernate Tools to visualize the Data Model... 6. Rich Components... 6.1. Add a Richfaces component to the CRUD Application... 47 54 57 57 iii

iv

Chapter 1. Create a Seam Application In this section you will learn how to create a Seam project in JBoss Developer Studio, how to start the server and what structure your project has after it is created. 1.1. Start Development Database Before opening the JBoss Developer studio you need to download and start the Workshop Database [http://docs.jboss.org/tools/resources/gsg_database.zip]. To start the database just run./rundbserver.sh or rundbserver.bat from the database directory. The end result should be a console window that looks like: 1

Chapter 1. Create a Seam Appl... Figure 1.1. Starting the Database Tip You may need to set the rundbserver.sh executable flag with the following command: chmod +x rundbserver.sh 2

Create and deploy Seam Web Project 1.2. Create and deploy Seam Web Project Minimize the terminal window and run JBoss Developer Studio from Applications Menu or from the desktop icon. First you will see the Workspace Launcher. Change the default workspace location if it's needed. Click the OK button. Figure 1.2. Workspace Launcher Dialog After startup, you see the welcome page. Select Create New... icon and then press on Create Seam Project link. The New Seam Project wizard is started. You need to enter a name (e.g., "workshop") and a location for your new project. The wizard has an option for selecting the actual Server (and not just WTP runtime) that will be used for the project. This allows the wizard to correctly identify where the destination folder for the required datasource and driver libraries. 3

Chapter 1. Create a Seam Appl... Figure 1.3. New Seam Project Wizard 4

Create and deploy Seam Web Project All settings are already specified here, you can just modify the Configuration. Click on the Modify... button to configure your custom facet options: 5

Chapter 1. Create a Seam Appl... Figure 1.4. Project Facets Specifying 6

Create and deploy Seam Web Project On the whole the dialog allows to select the "features" you want to use in your project. JBoss Developer Studio will then setup the appropriate tooling for your project. Since JBoss Seam integrates all popular Java EE frameworks, you can select any combination of technologies from the list. Here, for the default configuration, Dynamic Web Module, Java, JavaServer Faces (JSF), and Seam Facet are already selected for a typical database-driven web application. The default project facets should suffice. In the Project Facets form you can also bring up server runtimes panel by clicking Runtimes tab on the right corner. This panel shows available server runtimes. 7

Chapter 1. Create a Seam Appl... Figure 1.5. Runtimes Selecting 8

Create and deploy Seam Web Project Click the OK and then the Next button to proceed to the next step. A dynamic web application contains both web pages and Java code. The next wizard will ask you where you want to store Java files. Figure 1.6. Java Build Path Following page provides you Web Module Settings.You can just leave the default values or choose another folder. 9

Chapter 1. Create a Seam Appl... Figure 1.7. Web Module Settings On the next form, you will be able to select where those library JARs come from. The easiest is just to select the JARs provided by the JBoss AS runtime associated with this project. That is why it is important to chose the right JBoss AS 4.2 runtime in the project setup window. Select Library Provided by Target Runtime as Type of JSF Implementation Library. We will use the JSF implementation that comes with JBoss server. 10

Create and deploy Seam Web Project Click the Next button Figure 1.8. JSF Capabilities Adding Next wizard step needs more settings that previous. Let's start with General section. Leave the default Seam runtime and check a WAR deployment. 11

Chapter 1. Create a Seam Appl... Figure 1.9. Seam Facet Setting The Database section is a little tricky. The Connection Profile needs to be edited so that the new project works properly with the external HSQLDB server. By default the project wizard tries to use the JBoss embedded HSQLDB, but the tutorial uses an external database to replicate a more real world development scenario. Click on the Edit button to modify the Connection Profile. Figure 1.10. DataBase Setting Select HSQLDB Profile Properties. Make sure the Database location is set to hsql://localhost:1701 12

Create and deploy Seam Web Project Figure 1.11. JDBC Connection Properties 13

Chapter 1. Create a Seam Appl... Click the Test Connection button. At this point it probably won t work. This happens if the HSQL JDBC driver is not exactly the same. This can be solved by modifying the HSQLDB database driver settings. To modify the settings, click the Edit Driver Definition Driver button. 14

Create and deploy Seam Web Project Figure 1.12. Driver Details The proper Driver JAR File should be listed under Jar List. Select the hsqldb.jar file found in the jbdevstudio/jboss-eap/jboss-as/common/lib/ directory and click the OK button. 15

Chapter 1. Create a Seam Appl... Figure 1.13. Driver Details Now, the Test Connection should succeed. After testing the connection, click the OK button. 16

Create and deploy Seam Web Project Figure 1.14. Connection Testing You can leave the Code Generation section as is. It refers to Java packages in which the generated code will be placed. Figure 1.15. Code Generation Setting Tip: If you want to name your web project "MyProject-war" note that the Test project name should not be "MyProject-war-test", it should be "MyProject-test". Click on Finish button. Now, there should be a new Seam project called workshop listed in the Package Explorer view. 17

Chapter 1. Create a Seam Appl... Figure 1.16. "workshop" Project in the Package Explorer 18

Start JBoss Application Server 1.3. Start JBoss Application Server Start the server by clicking on the Start the server icon ( ) in the Servers view. Then run the project by selecting the project then selecting Run As... Run on Server. 19

Chapter 1. Create a Seam Appl... Figure 1.17. "workshop" Run As 20

Start JBoss Application Server Select the server you want to run the project on, and click the Finish button. 21

Chapter 1. Create a Seam Appl... Figure 1.18. "workshop" Run On Server 22

Start JBoss Application Server Note: If the project does not show up, then you can use a normal browser and use http:// localhost:8080/workshop/home.seam as the URL. Your project looks like this: 23

Chapter 1. Create a Seam Appl... Figure 1.19. "workshop" Project Started 24

Workshop Project Code Overview 1.4. Workshop Project Code Overview Now let's examine the project and its structure. Go back to the Package Explorer view in JBoss Developer Studio. It seems like it's not much for a project but this shell application contains a login screen with default login logic, a menu template that can be further modified, and other layout templates. It's important to note that the business logic will reside in the src/hot folder, by default. And, the package naming conventions that were used in New Seam project wizard could have been changed to something different from org.domain.workshop.session. Also, notice that there is a default Authenticator.java file. This is where custom security logic can be added. Seam has a nice declarative security model that we will explore in more detail later on. The src/main folder is a model directory. It stores the project's JPA entity beans. Figure 1.20. Project Structure The view tier of the application is also important. Seam uses facelets and there is a built-in facelets GUI editor that includes nice WYSIWYG and component drag/drop functionality. Try this out by opening home.xhtml from WebContent folder. 25

Chapter 1. Create a Seam Appl... Figure 1.21. Facelets GUI Editor Notice that the templates reside in the WebContent/layout folder. There is a stylesheet in the WebContent/stylesheet folder. There is also a login and default error page. The Facelet editor will be explored in more detail later in the lab. The project already has a datasource that was created via the Seam project wizard database settings. All of the Seam specific configuration files and JAR dependencies are included and located in their proper locations. On last noteworthy line item is related to the build script. There isn t a build script because the Eclipse WTP (Web Tools Project) plugin is used to publish web application changes. As you can see, JBoss Developer Studio is removing a great deal of complexity from the enterprise Java project setup and deployment process. The end result is the developer is writing code, not spending time trying to figure out how to get a decent development environment and project build process. 26

Chapter 2. Seam Action Development Now it s time to write some code. The good news is that JBoss Developer Studio can also help out in this respect. In this section, we will create a new Seam Action POJO and facelet with some custom business logic and some GUI changes. 2.1. Create a New Seam Action Go to main menu bar and click on File New New Seam Action to start the New Seam Action wizard. Specify a Seam component name (e.g., "myaction"). The other properties will be auto-completed for you so there is no need to change them. Click on the Finish button. 27

Chapter 2. Seam Action Develo... Figure 2.1. New Seam Action Wizard Now, open the MyAction.java file and replace the "myaction" method with this logic: public void myaction() { Calendar cal = Calendar.getInstance(); log.info("myaction.myaction() action called"); statusmessages.add("myaction Executed on:" + cal.gettime()); } 28

Test Seam Action You also need to import the java.util.calendar class by clicking CTRL+Shift+O. 2.2. Test Seam Action The new action can be tested by browsing the workshop-test project. JBoss Developer Studio has already created a TestNG test case for you. Figure 2.2. "workshop-test" Project Tip You may have to refresh the project to see the new files. The test case simulates a Seam method execution for the MyAction.myAction() logic. To run the test case, right click on MyActionTest.xml and click Run As TestNG Suite or use the Run As... toolbar shortcut as shown below. 29

Chapter 2. Seam Action Develo... Figure 2.3. TestNG Running With any luck, the test case will pass. Look at the TestNG view. Figure 2.4. TestNG Results 30

Modify Seam Action User Interface Now, it s safe to test the new Seam Action in a web browser. The fastest way to do that is to right click on myaction.xhtml and use Run As... Run On Server which will show the appropriate URL in the browser. Alternatively you can manually enter http://localhost:8080/ workshop/myaction.seam into a browser. Figure 2.5. Seam Action in a Web Browser 2.3. Modify Seam Action User Interface Browse to http://localhost:8080/workshop/myaction.seam and click on the myaction button. This executes the myaction method. This looks pretty good, but we could make this page look a little better. Open WebContent/myAction.xhtml in JBoss Developer Studio to use the nice facelets editor. 31

Chapter 2. Seam Action Develo... Figure 2.6. Open Seam Action with Editor Right click on the "myaction!" button in the visual part of editor and select <h:commandbutton> Attributes. 32

Modify Seam Action User Interface Figure 2.7. Seam Action Editing Change the value of the button to something different. If desired, you can change any other text on the page. Then, type CTRL+S to save the facelet. Figure 2.8. Attributes Dialog Refresh http://localhost:8080/workshop/myaction.seam and now you should see your changes. Notice that you did not have to publish the application. JBoss Developer Studio auto-published it for you. 33

Chapter 2. Seam Action Develo... Figure 2.9. Seam Action Is Modified 34

Chapter 3. Declarative Security In this section you will see how easy it is to secure the facelets and facelet components in Seam. Let s go ahead and secure the action button, then we will secure the entire page. 3.1. Edit Login Authentication Logic There is a class called Authenticator.java. The login page will execute the Authenticator.authenticate() method by default, so we ll start by viewing the authentication logic. Open Authenticator.java in JBoss Developer Studio and you will see that it contains the authenticate() method with this code: public boolean authenticate() { log.info("authenticating {0}", credentials.getusername()); //write your authentication logic here, //return true if the authentication was //successful, false otherwise if ("admin".equals(credentials.getusername())) { identity.addrole("admin"); return true; } return false; } 3.2. Secure Seam Page Component Open myaction.xhtml and add a new secured command button: <h:commandbutton id="myactionsecured" value="secured Action Button" action="#{myaction.myaction}" rendered="#{s:hasrole('admin')}"/> Refresh http://localhost:8080/workshop/myaction.seam If you are not logged in you will only see one button. If you are logged in, there will be two buttons. 35

Chapter 3. Declarative Security Figure 3.1. One Button on a Page The secured button is not visible because the user isn t logged in as "admin". 36

Secure Seam Page Component Figure 3.2. Secured Button is Visible The user is logged in as "admin". Securing components is easy but securing pages is pretty simple as well. Open WebContent/WEB-INF/pages.xml. Then add this markup directly underneath the <pages> element: <page view-id="/myaction.xhtml" login-required="true"/> Refresh http://localhost:8080/workshop/myaction.seam If you are not logged in you will get bounced back to the login page. 37

Chapter 3. Declarative Security Figure 3.3. Login Page Thus, if you enter login credentials for the "admin" user, you will be re-directed to the secured page and secured component. If you enter different login credentials, page access will be granted, but the secured component will not be displayed. Congratulations! You have secured your new action both at the facelet component and page level. You also added custom authentication logic to the login action. 38

Chapter 4. Browsing Workshop Database In this section you get to know how to use the workshop database that was started at the beginning of the lab. 4.1. Database Connectivity Setup The workshop data can be browsed inside of JBoss Developer Studio. To open the Data Source Explorer, click on Window Open Perspective Other Database Development. In the Data Source Explorer, expand the Databases node and select the Default database. Right click on it, select Connect from the context menu. Figure 4.1. Data Source Explorer 39

Chapter 4. Browsing Workshop... 4.2. Browse Workshop Database Then in the current view, drill down to the CUSTOMERS table. 40

Browse Workshop Database Figure 4.2. "CUSTOMERS" Table 41

Chapter 4. Browsing Workshop... Right click on CUSTOMERS, select Data Sample Contents to view the data in the table. There should be a SQL Results view on the workbench, but it could be hidden. Click on the "Result1" tab in the right side and you should see the data in the CUSTOMERS table. Figure 4.3. SQL Results View Note: If you can t find the SQL Results view tab, click on Window Show View Other SQL Development SQL Results. Congratulations! You just connected to the workshop database and queried the content using Database Explorer tools. 42

Chapter 5. Database Programming Now, it s time to reverse engineer the workshop database into a fully functioning Seam CRUD (Create Read Update Delete) application. 5.1. Reverse Engineer CRUD from a Running Database In JBoss Developer Studio, switch to the Seam perspective, and then right-click the project and select New Seam Generate Entities. The "workshop" project in the Seam Generate Entities wizard will be selected automatically. There is no need to change something more, click the Next button to proceed to the next step. 43

Chapter 5. Database Programming Figure 5.1. Generate Seam Entities On the next page use the Refresh button to display the database, then click the Include button to include all the tables from the database, and finally click the Finish button. 44

Reverse Engineer CRUD from a Running Database Figure 5.2. Selecting Tables After running the Generate Entities action, you will see new org.domain.workshop.entity classes. These classes represent insert/update/delete/query logic. 45

Chapter 5. Database Programming Figure 5.3. org.domain.workshop.entity Classes There is also the org.domain.workshop.entity package that contains the JPA classes. These are the entity beans that are mapped to database tables. Note that you can use Seam refactoring tools with Seam components. Read more about it in Seam refactoring tools chapter [http://download.jboss.org/jbosstools/nightly-docs/en/seam/html_single/ index.html#seam_refactoring] of Seam Dev Tools Reference Guide. Last, but not least, there are facelets for all of the CRUD screens. The best way to get a feel for the generated code is to open a browser and play around with the application. Go to http:// localhost:8080/workshop and insert/update/delete/query a few records. There is quite a bit of AJAX in this application, but we will explore that later on in the lab. For now, take note of the page tabs, required field logic and data table sorting in the list pages. Tip If you see the error java.lang.classnotfoundexception: org.jboss.seam.servlet.seamlistener in the console output from the Application Server, you may need to copy the jboss-seam.jar file from the lib subdirectory in the Seam library (which can be downloaded from here [http://seamframework.org/seam2/seam2distributiondownloads]) into the /server/default/deploy/workshop.war/web-inf/lib/ subdirectory in your Application Server (where "default" refers to the server profile that you are using). 46

Use Hibernate Tools to Query Data via JPA Tip If you see the error Could not instantiate Seam component: org.jboss.seam.security.rulebasedpermissionresolver, copy the mvel2.jar file from the Seam library to the same destination directory mentioned in the tip above. Figure 5.4. CustomersList.xhtml in the Editor Congratulations! You now have a fully functioning CRUD application that is AJAX enabled. 5.2. Use Hibernate Tools to Query Data via JPA Now, it's time to write some JPA queries using the Hibernate perspective in JBoss Developer Studio. In the upper right corner of the workbench there is a small icon (see the figure below), click on it and select Hibernate. 47

Chapter 5. Database Programming Figure 5.5. Hibernate Perspective Look at the Hibernate Configurations view. In the "workshop" project, drill down on the Session Factory and notice that the JPA entities/attributes are listed in a nice tree view. 48

Use Hibernate Tools to Query Data via JPA Figure 5.6. Hibernate Configurations View Right click on the Session Factory and select HQL Editor. This will open a JPA query scratch pad window. Write your query and click on the "Hibernate Dynamic SQL Preview" tab. You should see the SQL that will be executed if this JPA query is run. 49

Chapter 5. Database Programming Figure 5.7. JPA Query Editor Run the query by clicking on the green run icon. The results are listed in the "Hibernate Query Result" view. There is a "Properties" tab in the workbench that can be used to see a specific JPA result. These results represent the JPA objects because our query did not specify column names. 50

Use Hibernate Tools to Query Data via JPA Figure 5.8. Hibernate Query Result View The query can be refined, and take note that there is nice code completion in the JPA query editor. 51

Chapter 5. Database Programming Figure 5.9. Code Completion A refined query will return results that are more ResultSet oriented. Notice the join logic that JPA supports. 52

Use Hibernate Tools to Query Data via JPA Figure 5.10. The Hibernate Query Result There was no need to specify an Employees table in the from part of the JPA query because JPA supports reference traversal via Java class attribute references. Not only are JPA and HQL queries fully supported, but Criteria based queries can also be written in the Criteria Editor. You should spend some time tinkering with different queries and possibly Criteria based queries, even though the instructions are not provided in this lab. 53

Chapter 5. Database Programming Figure 5.11. Criteria Editor 5.3. Use Hibernate Tools to visualize the Data Model Now, it s time to view the data model for the workshop database. In the Hibernate Configurations view, select "workshop" project and expand the Configuration node. Select the Customers entity, right click on it, choose Mapping Diagram. 54

Use Hibernate Tools to visualize the Data Model Figure 5.12. Mapping Diagram Opening You see a Diagram tab for the CUSTOMERS table and any tables that have FK references. This is a handy way to view the data model and JPA mappings. Now, you ve got access to something that the Erwin Data Modeler can t do. 55

Chapter 5. Database Programming Figure 5.13. Diagram Tab 56

Chapter 6. Rich Components This lab will conclude with one last AJAX twist. In this section we add a RichFaces inputnumberslider to the Order Details edit screen. 6.1. Add a Richfaces component to the CRUD Application Switch to Seam perspective, and open WebContent/OrderdetailsEdit.xhtml in JBoss Developer Studio. Change the form field values using the visual editor. Seam has generated the form field names that match the database column names. This is not ideal for business users. Figure 6.1. Form Fields Editing Also, replace the QTY Ordered input field with a inputnumberslider. You can use the JBoss Developer Studio palette or right click on the form and insert the RichFaces component. 57

Chapter 6. Rich Components Figure 6.2. Insert RichFaces Component from Context Menu One the last option is to use the source view and manually copy the inputnumberslider markup listed below: <rich:inputnumberslider id="quantityordered" required="true" value="#{orderdetailshome.instance.quantityordered}"/> 58

Add a Richfaces component to the CRUD Application Figure 6.3. Manually copying Source Code The end result is an edit page that has better form labels and a new RichFaces control. 59

Chapter 6. Rich Components Figure 6.4. The Result Page Congratulations! You have completed the JBoss Developer Studio lab. 60