chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · jsf architecture 54 component...

12
327 Chapter A abbreviations, Editors 32 abstract method 12 abstraction 5 AbstractPageBean class 58, 184 action attribute 26, 31, 60 action event 57 and page navigation 36 action method and page navigation 98 for a button 174, 247 format of 106 add a web service to Creator 170 Add Data Source dialog, (table) 211 Add Table menu item, Query Editor 229 add XML document to project 274, 299 Admin Console 41 afterRenderResponse() method 187, 227 Ant build tool 18, 37 Application Outline view 28 as a target for dropping components 290 application scope 128, 130 application server 16, 18, 38 debug mode 307 log file 321 ApplicationBean1 129 architecture J2EE 15 JSF 54 argument list 8 asg.jar JAR file 134, 138, 282, 286 AssertionError 305 assertions 305 Auto-submit on change 62, 226, 278 Dropdown List 70 Listbox 78 Index Creator.book Page 327 Thursday, June 10, 2004 2:17 PM

Upload: others

Post on 29-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

327

Chapter

Aabbreviations, Editors 32abstract method 12abstraction 5AbstractPageBean class 58, 184action attribute 26, 31, 60action event 57

and page navigation 36action method

and page navigation 98for a button 174, 247format of 106

add a web service to Creator 170Add Data Source dialog, (table) 211Add Table menu item, Query Editor 229add XML document to project 274, 299Admin Console 41afterRenderResponse() method 187, 227

Ant build tool 18, 37Application Outline view 28

as a target for dropping components 290application scope 128, 130application server 16, 18, 38

debug mode 307log file 321

ApplicationBean1 129architecture

J2EE 15JSF 54

argument list 8asg.jar JAR file 134, 138, 282, 286AssertionError 305assertions 305Auto-submit on change 62, 226, 278

Dropdown List 70Listbox 78

Index

Creator.book Page 327 Thursday, June 10, 2004 2:17 PM

Page 2: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

328 Index

Multi Select Listbox 81, 82

Bbackground color 147, 219basename attribute, loadBundle tag 269beforeProcessValidations() method 186beforeRenderResponse() method 184bgcolor attribute 62, 101Bind Display to Data dialog

(figure) 216binding 127binding attribute 60Boolean Converter 93boolean property 127border attribute 62, 219breakpoints, setting 308–312

(figure) 311browser

configure for different locales 274, 299Build menu

Run Project command 37build output window 37build.xml 18, 37business logic, separation from presentation

logic 16Button 63, 169, 246, 293

with dynamic navigation 116with image file 192–194with simple navigation 101

Byte Converter 93

Ccall stack (debugging) 317–318cascadeDelete() method 257cascading deletes 250casting 5catch keyword 9cellpadding attribute 62, 219cellspacing attribute 62, 219Character Converter 93Checkbox 64Checkbox List 65class construct 7–8

class, setting breakpoint at 309Clips palette 35

accessing objects in different scopes 36Concatenate Strings 35

close() database connection 227code completion , Java source editor 33Color1 project 281color1.properties file 287ColorBean 279–296ColorBean.java 286columns attribute 62Component Label 66, 154, 242, 292

with secret field 115with text field 43, 113

componentsaction attribute 60bgcolor attribute 62binding attribute 60border attribute 62Button 63, 101, 116, 169, 192–194, 246, 293cellpadding attribute 62cellspacing attribute 62Checkbox 64Checkbox List 65columns attribute 62common attributes 59compare Link Action and Hyperlink 172Component Label 43, 66, 113, 115, 154,

242, 292composite 28converter attribute 61Data Table 67, 218–219, 228, 236data-aware 62, 216delete 188Dropdown List 69, 108, 214, 276Formatted Output 71Grid Panel 72, 100, 289Group Panel 73Hidden Field 74Hyperlink 75, 172id attribute 60Image 76, 167Inline Message 76, 155, 183, 243, 294Link Action 77, 121

Creator.book Page 328 Thursday, June 10, 2004 2:17 PM

Page 3: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

Index 329

Listbox 77, 215, 252localizing text 269maxlength attribute 61Message List 79, 116Multi Line Text Area 79Multi Select Listbox 80Multi Select Menu 82nested 44onchange attribute 62Output Text 83, 147, 159, 171, 219, 293Page Fragment Box 84Radio Button List 85required attribute 61resizing 44Secret Field 87, 115, 141style attribute 60Text Field 88, 114, 140, 154, 168, 219, 292title attribute (tooltip) 60, 154validator attribute 61value attribute 60valueChangeListener attribute 62

Components window 26composite components 28composite primary key 206Concatenate Strings clip 35, 47configure workspace 24constructors 7context root 38Continue command 314Continue debugging command 306conversion model 91converter attribute 61converters 56, 92, 146

Boolean Converter 93Byte Converter 93Character Converter 93Date Time Converter 93Double Converter 93, 155Float Converter 93Integer Converter 93, 158Long Converter 93Number Converter 93, 159Short Converter 93

Converters palette 27

create a new web page 103create new navigation rules 103Create New Project command 42, 147Creator windows 22

Application Outline view 28build output window 37Clips palette 35Debugger window 41, 307design canvas 23docking 24editor pane 24file tab 23Help System 42hiding 24JSF Standard Components 26JSF Validators/ Converters window 26palette 26Project Navigator window 29Properties window 25Server Navigator window 39

Creator, additional documentation 21CRUD database operations 249custom validate method 92, 294custom validation 279–300

validator tag 291

DData Source

add a 209–211add to project 215–217, 228Choose Target dialog 228configure alternate 211Test Connection 211

Data Sources node 39, 210Add Data Source 211, 212JDBC 3.0-compliant drivers 209Remove Data Source 210View Data 216

Data Table 67, 218–219, 228, 236bgcolor attribute 219Bind to Data 218, 236Choose Target dialog 218, 228, 236embedded column component 219

Creator.book Page 329 Thursday, June 10, 2004 2:17 PM

Page 4: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

330 Index

Input Text (editable) 237Output Text (read-only) 237Table Layout dialog 218, 231, 237

(figure) 69, 219Table Layout Paging dialog

(figure) 70data-aware components 216

and converters 62database

fundamentals 206–209metadata 206

database operationscascading deletes 250CRUD 249database joins 228–233dataTableModel 240deletions 249–258master-detail relationship 217row inserts 241–248updates 233–240

Database sampleMusic Collection database 206

dataTableModel 240Date Time Converter 93

pattern 93DateFormat class documentation 93DB2 JDBC driver 209Debug menu

Continue command 314Debug Project command 41Finish command 324New Breakpoint menu item 310

debug mode 307Debug Project debugging command 306Debugger window 41, 307debuggingAssertionError 305assertions 305call stack 317–318commands 306defensive programming 304exceptions 318–320local variables 304log file 321

log() method 323planning for 304–305setting breakpoints 308–312setting watches 315–316Step Over 312stepping 312System.out.println() method 321tracking variables 314Watch window 316

default constructor 13, 127default-locale element 273defensive programming 304delete component 188delete database operations 249–258Deployed Components node 41deployment 37Deployment Servers node 39derived property 145design canvas 23

Page Navigation context menu 36View Java Class context menu 31

docking windows 24documentation

Creator 21DateFormat class 93Google Web Service 175internationalization 265J2EE Tutorial 4Java API 4Java programming language 4JavaServer Faces 4MessageFormat class 71NetBeans 14

doGoogleSearch() methodparameters (table) 176

Double Converter 93, 155Double Range Validator 92, 155download examples 22drag and drop components 27Dropdown List 69, 276

Auto-submit on change 226database binding 214Fill the List 215specifying default items 108, 277

Creator.book Page 330 Thursday, June 10, 2004 2:17 PM

Page 5: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

Index 331

used with navigation 108value change event 108, 224

dynamic binding 11dynamic navigation 98, 111–122

EEcho project 42Edit Event Handler

action 121, 174processValueChange 110

editor pane 24Editors

abbreviations 32Java source 31JSP source 30line numbers 32NetBeans 32Page Navigation 36, 102–105Query 220–223XML source 150

encapsulation 5error message 183, 279escape attribute 171, 189event

action 57value change 57, 110value change vs. action 108

event handler codeand page navigation 105

event listener 56event model 56event object 56event source 56examples

download 22exception handling 6, 9–10

and debugging 318–320AssertionError 305NumberFormatException 9setting breakpoint at exception 309SQLException 248, 256

extends keyword 11

FFacesBean superclass 184faces-config.xml 273, 298FacesContext object 110facet tag, Data Table component 219fast import <Alt-Shift-I> editor short cut 32,

110, 136fields 5, 7file tab 23

Close option 30FileSystem View 29Finish command 324Finish Sessions debugging command 306Float Converter 93fora editor abbreviation 33foreign key 206Formatted Output 71from-outcome element 98from-view-id element 98

Ggarbage collection 6getNavigationHandler() method 110getter 126global variables 6Google logo 167Google Web Service 165

add to project 170documentation 175license key 179registration 166URL 166

Google1 project 166Google2 project 181Google3 project 187Google4 project 192GoogleSearchResult object

public methods (table) 177GoogleSearchService 165Grid Panel 72, 289

with nested button components 100Group Panel 73

Creator.book Page 331 Thursday, June 10, 2004 2:17 PM

Page 6: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

332 Index

HHelp menu

Help Contents 42Help System 42

Index 42Hidden Field 74hiding windows 24HTML table 189HTML tags 171

with Output Text 189Hyperlink 75, 172

compare with Link Action 172

Iid attribute 25, 60, 193Image 76

Google logo 167image attribute, Button 194image file, using with Button 192–194implements keyword 12Import Class dialog 110, 136import statement 8include file for JSP pages 84Index tab, Help System 42indexed property 126inheritance 10–12Inline Message 76, 155, 183, 243, 294INNER JOIN statement 230Integer class 10Integer Converter 93, 158interface 12internationalization 272–275, 298–300

configure browser 274, 299documentation 265

Internet Explorer 274, 299is-a relationship 10

JJ2EE

architecture 15Tutorial 4

J2EE application server 16administration console 41

JAR files 8, 29add to project 134

Java API documentation 4Java Data Base Connectivity See JDBCJava file

add to project 148double click to edit 29

Java packageadd to project 148

Java programming language 4, 5–12abstraction 5casting 5classes 7–8constructors 7encapsulation 5exception handling 6, 9–10fields 5, 7import statement 8inheritance 10–12interface 12methods 5, 7object oriented programming 5–6objects 5outside view 5package 8private 7public 7references 6static keyword 10this keyword 7void return type 8wrapper classes for primitive types 197

Java Servlet technology 16Java source editor 29, 31

code completion 33dropdown menu 32Editor Settings 32fast import short cut 32, 110, 136Javadoc retrieval 34Show Line Numbers 307toggle breakpoint 311

Java Sources folder 29add Java file 148

JavaBeans 13, 125–131

Creator.book Page 332 Thursday, June 10, 2004 2:17 PM

Page 7: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

Index 333

advantages of 132binding 127ColorBean 279–296default constructor 13, 127derived property 145getter 126LoanBean 144–160LoginBean 131–144preconfigured 129property 13, 126property binding 132scoping rules 129setter 126

Javadoc retrieval 34JavaScript element, this.form.submit() 62,

70, 78JavaServer Faces (JSF) 17, 53–59

See also JSFdocumentation 4

JavaServer Pages (JSP) 16JDBC 17

3.0-compliant drivers 209database server 39ResultSet object 208

JDBC RowSets 17, 208–209, 239close() 227concurrency attribute 239initialization code 255

JSFarchitecture 54component validation process 294conversion model 91converters 56, 92Creator-generated tags 55event model 56Expression Language (EL) 31, 55, 127facet tag 219Life Cycle Process 183–187

(figure) 185loadBundle tag 268, 288navigation model 98–99Standard Components window 26validation model 90validators 56, 91

Validators / Converters window 26JSF context

error messages 183, 279JSP 30JSP source editor 30

Kkey/value pairs in properties files 266

LLength Validator 92, 181, 182, 243libraries

in projects 29Library References node 29, 134

libraries 29Life Cycle Process 183–187

methods for tapping into (table) 186line numbers in source files 32

setting breakpoints 307, 309Link Action 77

compare with Hyperlink 172with page navigation 121

Listbox 77, 252database binding 215Fill the List 215, 252value change event 224

loadBundle tag 268, 288LoanBean 144–160LoanBean.java 151local variables, using in debugging 304locale 265

configure from application 275–279specify supported 273

localhost 38localization 263–271

properties file 266log file 321log() method 323Logical View 29Login1 project 22, 113Login2 project 133Login3 project 265login3.properties file 267

Creator.book Page 333 Thursday, June 10, 2004 2:17 PM

Page 8: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

334 Index

LoginBean 131–144LoginBean.java 138Long Converter 93Long Range Validator 92, 158

Mmanaged beans 125

add to project 148configuration 150preconfigured 129

Managed Beans node 150Managed Session Bean dialog 148managed-bean-class element 151managed-bean-name element 151managed-beans.xml 14, 150managed-bean-scope element 151Margin editor contextual menu 307master-detail relationship 217maximum, validator attribute 155, 182maxlength attribute 61Message List 79

validation errors for multiple components 116

MessageFormat class documentation 71metadata 206, 215method, setting breakpoint at 309methods 5, 7

abstract 12argument list 8signature of 8

minimum, validator attribute 155, 182model view 147Multi Line Text Area 79Multi Select Listbox 80Multi Select Menu 82Music Categories table 207Music Collection Database 206

(figure) 207schema 207SQL script 211

Music1 project 213Music2 project 228MusicDelete project 250MusicInsert project 241

MusicUpdate project 234

NNavigate1 project 100Navigate2 project 107navigation

handler 36labels 109model 98–99

navigation.xml 98NetBeans 13, 32Netscape Navigator 274, 299new 6, 130New Breakpoint menu item 310New Page menu item 103, 118New Property Pattern dialog 148non-command components and page naviga-

tion 107–111none, scope 128null return value

and page navigation 98Number Converter 93, 159

pattern 94, 159NumberFormatException 9

Oobject oriented programming 5–6

abstraction 5encapsulation 5outside view 5

objects 5onchange attribute 62Open an Existing Project 22Open Directory Project 177operator new 6, 130Oracle JDBC driver 209ORDER BY clause 222Output Text 83, 147, 171, 293

with Data Table 219, 237with HTML tags 171, 189with number converter 159

outside view 5override methods 11

Creator.book Page 334 Thursday, June 10, 2004 2:17 PM

Page 9: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

Index 335

Ppackage 8page bean 29, 129

Creator-generated Java code 57Page Fragment Box 84page navigation

action method 98dynamic navigation 111–122event handler code 105null return value 98simple 99–107UML activity diagram 99with non-command components 107–111

Page Navigation editor 36, 102–105create new page 103, 118create new rules 103editor pane (figure) 104, 118Properties window (figure) 104

Page Request Life Cycle 183–187Page1 129palette

Clips 35JSF Components 26JSF Validators/ Converters 26

parameter, SQL query 222, 230parseInt() method 9pattern, Number Converter 159Pause debugging command 306Payment1 project 147, 307PointBase 39, 209position attribute 25presentation view 147primary key 206, 215, 242private 7Process Validations life cycle phase 184processValueChange 110project

add Java file to 148add library to 134, 282add managed session bean to 148add package to 148add XML document to 274, 299Create New Project 42Open an Existing Project 22

Project Navigator window 29add XML file to project 274, 299FileSystem View 29Library References node 29, 134Logical View 29Managed Beans node 150References node 134, 282Resources node 29

ProjectsColor1 281Echo 42Google1 166Google2 181Google3 187Google4 192Login1 22, 113Login2 133Login3 265Music1 213Music2 228MusicDelete 250MusicInsert 241MusicUpdate 234Navigate1 100Navigate2 107Payment1 147, 307

properties file 266for project Color1 287for project Login3 266, 272, 273format 266

Properties window 25property 13, 126

add to bean component 148boolean 127indexed 126simple 126

property binding 46, 132, 140, 141, 146, 156concatenating with a string 143

Property Bindings dialog 45, 127, 140, 290(figure) 293

protected methods 184public 7Publish-Subscribe pattern 56

Creator.book Page 335 Thursday, June 10, 2004 2:17 PM

Page 10: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

336 Index

QQuery Editor 220–223, 229

(figure) 221Add Query Criteria dialog 222, 230Add Table 229INNER JOIN 230modify default query 254ORDER BY clause 222parameter 222, 230query text 221Sort Type 222spreadsheet view 221table view 220WHERE clause 222, 254

RRadio Button List 85read access 126Recording Artists table 207recordingartistsRowSet 229, 246, 252Recordings table 207, 215recordingsRowSet 215references 6Remove Data Source menu item 210Render Response life cycle phase 184request scope 128required attribute 61, 114, 181ResourceBundle 264, 294, 296Resources node 29ResultElement object

public methods (table) 178ResultSet object 208RowSets See JDBC RowSetsRun to Cursor debugging command 307

Sscope 128–129

accessing objects clips 36Secret Field 87, 141

collect password 115Server Navigator window 39

Data Sources node 39, 212

Deployed Components node 41Deployment Servers node 39Google Web Service 165log file 322Show Admin Console command 41Undeploy application 41Web Services node 39, 171

Servlets, Java 16session scope 128, 130

saving data in 192, 197SessionBean1 195, 223, 276

SessionBean1 129, 197add properties to 195, 223, 276

setter 126Short Converter 93Show Admin Console 41Show Line Numbers context menu item 32signature, method 8simple navigation 99–107Simple Object Access Protocol (SOAP) 18, 165simple property 126SOAP 18sort for SQL query 222SQL 17SQL query 220–223

add parameter 222, 230SQL Server JDBC driver 209SQLException 248, 256static keyword 10Step Into debugging command 306Step Out debugging command 307Step Over 312Step Over debugging command 306stepping (debugging) 312stepwise refinement 304style attribute 25, 60subclass 11superclass 11supported-locale element 273Sybase JDBC driver 209System.out.println() method 321

TTable Layout dialog

Creator.book Page 336 Thursday, June 10, 2004 2:17 PM

Page 11: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

Index 337

(figure) 69Table Layout Paging dialog

(figure) 70Table View database viewer 40Test Connection to Data Source 211Text Field 88, 140, 154, 168, 292

collect username 114required attribute 114, 181with Data Table 219, 237

thin clients 15this keyword 7thread, setting breakpoint at 309throw keyword 9throw point 10throws clause 257Title attribute 43title attribute (tooltip) 60, 154Toggle Breakpoint editor option 311Tools menu

Options 32tooltip 154to-view-id element 98tracking variables (debugging) 314Tracks table 207translations of text in properties file 272try keyword 9

UUDDI 18UML activity diagram, page navigation 99Undeploy application 41Universal Description, Discovery, and Inte-

gration (UDDI) 18, 165URL in browser 38

VvalidateHexString() custom validation

method 295validation model 90validator attribute 61validator tag 291validators 56, 91, 146

custom validate method 92

custom validation 279–300Double Range Validator 92, 155Length Validator 92, 181, 182, 243Long Range Validator 92, 158maximum 155minimum 155

Validators/Converters window 27value attribute 26, 60value binding

localizing components’ text 270Value Bindings dialog 293value change event 57, 62, 110, 224

vs. action event 108valueChangeListener 110, 224, 277valueChangeListener attribute 62var attribute, loadBundle tag 269VARCHAR data type 215, 242, 252variables

setting breakpoint at 309tracking (debugging) 314

View Data 216View Java Class context menu 31View menu 24

Debugger window 41, 307views, configure Creator’s workspace 24void return type 8

WWAR file 37Watch window (debugging) 316watches, setting (debugging) 315–316web services 18, 165

add to Creator 170nonvisual component tray 166

Web Services Description Language (WSDL) 165, 171

Web Services node 39, 171Welcome window 22WHERE clause 222, 254windows, configure Creator workspace 24workspace, configure 24write access 126

Creator.book Page 337 Thursday, June 10, 2004 2:17 PM

Page 12: Chapterptgmedia.pearsoncmg.com/images/0131491687/index/... · JSF architecture 54 component validation process 294 conversion model 91 converters 56, 92 Creator-generated tags 55

338 Index

XXML 14XML Document 274, 299XML editor 150XML file

build.xml 18, 37faces-config.xml 273, 298managed-beans.xml 14, 150navigation.xml 98

Zzero-length string 181

Creator.book Page 338 Thursday, June 10, 2004 2:17 PM