com.ibm.etools.egl.jsfsearch.tutorial.doc.ps

Similar documents
provider_020524_2.PDF

: ORDER BY

1 SQL Server SQL Oracle SQL SQL* Plus PL/SQL 2 SQL Server SQL Server SQL Oracle SQL SQL*Plus SQL Server GUI 1-1 osql 1-1 Transact- SQL SELECTFROM 058

生活設計レジメ

44 4 I (1) ( ) (10 15 ) ( 17 ) ( 3 1 ) (2)

I II III 28 29


橡実践Oracle Objects for OLE

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200,

tkk0408nari

AP_12_15_yonezawa.indd

i


Wide Scanner TWAIN Source ユーザーズガイド

java_servlet2_見本

ストラドプロシージャの呼び出し方

1 ex01.sql ex01.sql ; user_id from (select user_id ;) user_id * select select (3+4)*7, SIN(PI()/2) ; (1) select < > from < > ; :, * user_id user_name


第1部 一般的コメント

untitled

表1票4.qx4

福祉行財政と福祉計画[第3版]

第1章 国民年金における無年金

Gray [6] cross tabulation CUBE, ROLL UP Johnson [7] pivoting SQL 3. SuperSQL SuperSQL SuperSQL SQL [1] [2] SQL SELECT GENERATE <media> <TFE> GENER- AT

ValueHolder... 9 Customer.java Oracle TopLink 10g(10.1.3) È Volume3 2

PDF Information

橡ミュラー列伝Ⅰ.PDF

PR映画-1

II III I ~ 2 ~

中堅中小企業向け秘密保持マニュアル


- 2 -



1 (1) (2)

o 2o 3o 3 1. I o 3. 1o 2o 31. I 3o PDF Adobe Reader 4o 2 1o I 2o 3o 4o 5o 6o 7o 2197/ o 1o 1 1o

SML#³«È¯ºÇÁ°Àþ

untitled

Microsoft Word - Win-Outlook.docx

1,.,,,., RDBM, SQL. OSS,, SQL,,.

2 Java 35 Java Java HTML/CSS/JavaScript Java Java JSP MySQL Java 9:00 17:30 12:00 13: 項目 日数 時間 習得目標スキル Java 2 15 Web Java Java J

1 I EViews View Proc Freeze


Wiki Wiki Wiki...

TopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç..

State Committee of Russian Federation on Statistics State Committee of Russian Federation on Statistics 53

Caché SQL に関するよくある質問

,, create table drop table alter table

「産業上利用することができる発明」の審査の運用指針(案)

Lotus Domino XML活用の基礎!




hands_on_4.PDF

n n n ( ) n Oracle 16 PostgreSQL 3 MySQL

K227 Java 2

Oracle Locator Oracle Database 10g Standard Edition Standard Edition One Oracle Database 10g Release 1 Oracle Locator : Enterprise Edition Oracle Loca

tert-tert 4. Enter 5. Delete Delete 8. Delete 9. [] [] ID 40

ACS電子ジャーナル利用マニュアル

PowerPoint Presentation

Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac

"CAS を利用した Single Sign On 環境の構築"

1. IEEE Xplore 1.1. IEEE Xplore Institute of electrical and Electronics Engineers (IEEE) Institution of Electrical Engineers (IEE) 12, IEEE Xpl

Microsoft Word - ネオコピー修正(1月11日2013年).doc

1 VisBAR edu H 2 O.....

CodeIgniter Con 2011, Tokyo Japan, February

by CASIO W61CA For Those Requiring an English/Chinese Instruction

178 5 I 1 ( ) ( ) ( ) ( ) (1) ( 2 )

haskell.gby

rzamhpdf.ps

122.pdf

IBM Software Group DB2 Information Management Software DB2 V8 XML SQL/XML 2 XML XML UDF XMLExtender XML XML XMLCollection, XMLColumn XML UDF Informati

BC4J...4 BC4J Association JSP BC4J JSP OC4J


GET Vol.8

Advantage CA-Easytrieve Plus

FileMaker Server Getting Started Guide

,,,, : - i -

MOMW_I_,II 利用ガイド.PDF

untitled

28 Docker Design and Implementation of Program Evaluation System Using Docker Virtualized Environment

Ver.1 1/17/2003 2

s

: Name, Tel name tel (! ) name : Name! Tel tel ( % ) 3. HTML. : Name % Tel name tel 2. 2,., [ ]!, [ ]!, [ ]!,. [! [, ]! ]!,,. ( [ ], ),. : [Name], nam

Q&A集

Web Web Web Web i

untitled

Ruby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=>

9iAS_DEV.PDF

22 (266) / Web PF-Web Web Web Web / Web Web PF-Web Web Web Web CGI Web Web 1 Web PF-Web Web Perl C CGI A Pipe/Filter Architecture Based Software Gener

Copyright c 2008 Zhenjiang Hu, All Right Reserved.

5 ISMS 5 4 PC PC USB PDA 2

橡挿入法の実践

Oracle9i

FileMaker Server 9 Getting Started Guide

FileMaker Server 9 Getting Started Guide

untitled

IT IBM Corporation

Microsoft Word - sample_adv-programming.docx

ADSLモデム設定マニュアル

Transcription:

EGL JSF

ii EGL JSF

EGL JSF.. 1................. 1 1:.... 3 Web.......... 3........... 3........ 4......... 7 2:...... 7..... 7 SQL.... 8 JSF.... 10 Web.... 12......... 13 3: OR....... 14 OR... 14.15 OR..... 16......... 17 4: 18...... 18 JSF..... 19.... 20......... 22 5:...... 23...... 23.24.25......... 26................ 26............... 27 2 SearchLibrary.egl.. 27 2 customersearch.egl.. 28 3 SearchLibrary.egl.. 29 3 customersearch.egl.. 29 4 SearchLibrary.egl.. 30 4 customersearch.egl.. 31 5 SearchLibrary.egl.. 32 5 customersearch.egl.. 33 iii

iv EGL JSF

EGL JSF EGL JSF EGL ( ) v SQL v EGL v JSF 60 EGL ( ) EGL Hello world PDF EGL JSF EGL ( ) EGL JSF Web Web Web Web Web v SQL v EGL v JSF 1

60 EGL ( ) 2 (AND ) AND 2 (OR ) 2 EGL JSF

1: EGL EGL-JSF Web 1. Web 2. EGL 3. EGL JSF 4. EGL EGL 3 4 Web 1. EGLWeb WebContent 2. 3. Web Web 4. Web 5. ( ) customersearch.jsp 6. /EGLWeb/WebContent 7. 8. A_gray.htpl 9. 10. Customer Search 11. Enter 3 3 EGL 2 searchterms searchterms searchresults[] 1. EGL Customer Search EGL 2. 3. Customer 4. searchterms 5. 6. EGL Web EGL JSF 3

7. OK 8. Customer Search EGL 9. 10. Customer 11. searchresults 12. 13. EGL Web 14. OK 2 1. JSF 2. Customer Search searchterms - Customer 3. 4. 5. LastName State 6. 7. 8. Submit 9. 10. OK 11. 4 EGL JSF

12. Submit { } Enter Submit 1 13. Faces 14. Faces Submit 2 5 Customer(s) found. Search again? ( 5?) 15. Submit 2 searchresults - Customer[] 16. ( ) 17. 18. LastName EmailAddress State EGL JSF 5

19. 20. 6 EGL JSF

v EGL Web v EGL v Web EGL 2: 2: Web EGL EGL Web JSF 1. EGLWeb EGLSource EGL EGL JSF 7

2. EGL SearchLibrary 3. libraries EGL 4. EGL 5. EGL 6. package libraries; library SearchLibrary type BasicLibrary JSF SQL 1. SearchLibrary End function NameAndStateSearch_And(lname string in, state char(2) in, customer Customer[]) get customer; 3 v lname v state v customer lname state SQL 2. package libraries; import import eglderbyr7.data.customer; 3. get customer customer get customer customer SQL 4. get customer customer SQL SQL get customer EGL get customer SQL SQL 8 EGL JSF

get customer 5. from EGL.CUSTOMER Enter 1 6. from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname and EGL.CUSTOMER."STATE" = :state EGL SQL EGL.CUSTOMER.LAST_NAME eglderbyr7.data :lname :state SQL EGL STATE state EGL SQL EGL ID EGL JSF 9

where SQL where defaultselectcondition 7. 8. Ctrl+G ( X ) 27 2 SearchLibrary.egl JSF 1. customersearch.jsp 2. 3. customersearch.jsp JSF ( ) searchresults Customer[0]; searchterms Customer; 4. 2 resultmessage char(80); numberofresults int; Web searchterms searchresults 5. JSF function searchfunction() searchterms.lastname = searchterms.lastname::"%"; SearchLibrary.NameAndStateSearch_And( searchterms.lastname, searchterms.state, searchresults); resultmessage = " customer(s) found."; numberofresults = searchresults.getsize(); 6. package jsfhandlers; import import libraries.searchlibrary; onprerer 7. JSF function onprerer() if (searchresults.getsize() == 0) resultmessage = "No customers found or no search criteria entered."; 8. onprererfunction JSF 10 EGL JSF

handler customersearch type JSFHandler {onconstructionfunction = onconstruction, onprererfunction = onprerer, view = "customersearch.jsp"} v searchterms searchresults Customer v searchfunction Submit NameAndStateSearch_And v Sm Sm% Smith Smiley v / 9. EGL JSF 11

customersearch.egl ( X ) 28 2 customersearch.egl Web JSF 1. customersearch.jsp 2. JSF 3. Submit numberofresults 4. resultmessage 5. Submit searchfunction() 12 EGL JSF

6. 7. a. customersearch.jsp b. Web LastName State Submit / LastName F State NJ AND OR State EGL v EGL v EGL JSF v JSF Web 3: OR EGL JSF 13

3: OR AND OR OR AND OR 1. SearchLibrary.egl 2. function NameAndStateSearch_Or(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname or EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; 14 EGL JSF

NameAndStateSearch_And where AND OR 3. 4. Java Ctrl+G 5. SearchLibrary.egl ( X ) 29 3 SearchLibrary.egl 2 1. customersearch.jsp 2. Enter 3. Faces 4. 5. 6. 7. 8. AND 9. AND 10. 11. 2 EGL JSF 15

OR 12. OR JSF 1. customersearch.egl 2. 16 EGL JSF

andor char(3); AND OR 3. searchfunction function searchfunction() searchterms.lastname = searchterms.lastname+"%"; if (andor == "AND") SearchLibrary.NameAndStateSearch_And( searchterms.lastname, searchterms.state, searchresults); else SearchLibrary.NameAndStateSearch_Or( searchterms.lastname, searchterms.state, searchresults); resultmessage = "Customer(s) found. Search again?"; numberofresults = searchresults.getsize(); v andor (AND OR) v searchfunction if AND NameAndStateSearch_And NameAndStateSearch_Or 4. 5. customersearch.jsp 6. andor - char(3) 7. searchfunction() 8. 9. State customersearch.egl ( X ) 29 3 customersearch.egl 2 EGL JSF 17

v EGL OR v v OR JSF v 4: 4: State 1 1 1. SearchLibrary.egl 2. function getallcustomerstates(listofstates string[]) customers Customer[0]; counter int; get customers with #sql{ select EGL.CUSTOMER."STATE" from EGL.CUSTOMER group by EGL.CUSTOMER."STATE" order by EGL.CUSTOMER."STATE" asc }; listofstates.removeall(); for (counter from 1 to customers.getsize() by 1) listofstates.appelement(customers[counter].state); 3. 4. getallcustomerstates v getallcustomers getallcustomerstates Customer STATE 18 EGL JSF

v group by EGL.CUSTOMER."STATE" 1 v order by EGL.CUSTOMER."STATE" asc v for state SearchLibrary.egl ( X ) 30 4 SearchLibrary.egl JSF 1. customersearch.jsp 2. customersearch.jsp 3. andor char(3); customerstates string[0]; 4. Function onprerer() 1 SearchLibrary.getAllCustomerStates(customerStates); 5. 6. customersearch.egl ( ) EGL JSF 19

v customerstates 1 v onprerer customerstates getallcustomerstates customersearch.egl ( X ) 31 4 customersearch.egl JSF 2 EGL 20 EGL JSF

v customerstates v searchterms.state 1. customersearch.jsp 2. STATE Delete 3. Faces 4. STATE 5. searchterms - Customer 6. searchterms - Customer State - State 7. 8. #{customersearch.searchterms.state} searchterms State 9. <selectitems> <selectitems> JSF 10. <selectitems> 11. customerstates - string[] EGL JSF 21

12. OK customerstates searchterms 13. 14. Web v v JSF v Web v 5: 22 EGL JSF

5: Web JSF Customer State (Customer ) (2 ) (State ) EGL EGL 3 v email Customer v fullname Customer v State Customer State 1. SearchLibrary.egl 2. function getonestate(state Statetable) get state; statetable Statetable.egl 3. SearchLibrary.egl package libraries; import eglderbyr7.data.statetable; 4. Record customizedresult type basicrecord fullname string {displayname = "Full Name"}; email string {displayname = "Email Address"}; statename string {displayname = "State"}; EGL JSF 23

: customizedresult 5. 6. SearchLibrary.egl ( X ) 32 5 SearchLibrary.egl 1. customersearch.jsp 2. customersearch.jsp 3. JSF customerstates string[0]; allrecords customizedresult[0]; 4. JSF package jsfhandlers; import import libraries.customizedresult; 5. JSF function generatecustomresults(passedresults Customer[]) allrecords.removeall(); onerecord customizedresult; counter int = 1; state Statetable; // 1 while (counter <= (passedresults.getsize())) onerecord.fullname = passedresults[counter].firstname :: " " :: passedresults[counter].lastname; onerecord.email = passedresults[counter].emailaddress; state.stateabbrev = passedresults[counter].state; SearchLibrary.getOneState(state); onerecord.statename = state.statename; allrecords.appelement(onerecord); counter = counter + 1; searchfunction 6. JSF searchfunction generatecustomresults (searchresults); 7. JSF 1. 2. 24 EGL JSF

3. 4. 5. allrecords customersearch.egl ( X ) 33 5 customersearch.egl 1. customersearch.jsp 2. a. b. c. Delete 3. allrecords - customizedresult[] 4. ( ) 5. 6. 7. EGL JSF 25

FirstName LastName Fullname State 2 v v v JSF v Web v 5: EGL JSF v v EGL 26 EGL JSF

v EGL v EGL SQL v Java Server Faces Web v v v updatecustomer.jsp allcustomers.jsp v JavaServer Faces Web (Display dynamic information on Web pages with JavaServer Faces) Web (Design the layout and structure of your Web site) v 2 SearchLibrary.egl v 28 2 customersearch.egl v 29 3 SearchLibrary.egl v 29 3 customersearch.egl v 30 4 SearchLibrary.egl v 31 4 customersearch.egl v 32 5 SearchLibrary.egl v 33 5 customersearch.egl 2 SearchLibrary.egl 2 SearchLibrary.egl ( X ) package libraries; import eglderbyr7.data.customer; library SearchLibrary type BasicLibrary function NameAndStateSearch_And(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL JSF 27

EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname and EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; 7 2: 2 customersearch.egl 2 customersearch.egl ( X ) package jsfhandlers; import eglderbyr7.data.*; import libraries.searchlibrary; handler customersearch type JSFHandler {onconstructionfunction = onconstruction, onprererfunction = onprerer, view = "customersearch.jsp"} searchterms Customer; searchresults Customer[0]; resultmessage char(80); numberofresults int; function searchfunction() searchterms.lastname = searchterms.lastname::"%"; SearchLibrary.NameAndStateSearch_And( searchterms.lastname, searchterms.state, searchresults); resultmessage = " customer(s) found."; numberofresults = searchresults.getsize(); function onprerer() if (searchresults.getsize() == 0) resultmessage = "No customers found or no search criteria entered."; function onconstruction() 7 2: 28 EGL JSF

3 SearchLibrary.egl 3 SearchLibrary.egl ( X ) package libraries; import data.customer; library SearchLibrary type BasicLibrary function NameAndStateSearch_And(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname and EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; function NameAndStateSearch_Or(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname or EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; 14 3: OR 3 customersearch.egl 3 customersearch.egl ( X ) package jsfhandlers; import eglderbyr7.data.*; import libraries.searchlibrary; handler customersearch type JSFHandler EGL JSF 29

{onconstructionfunction = onconstruction, onprererfunction = onprerer, view = "customersearch.jsp"} searchterms Customer; searchresults Customer[0]; resultmessage char(80); numberofresults int; andor char(3); customerstates string[0]; function searchfunction() searchterms.lastname = searchterms.lastname + "%"; if (andor == "AND") SearchLibrary.NameAndStateSearch_And( searchterms.lastname, searchterms.state, searchresults); else SearchLibrary.NameAndStateSearch_Or( searchterms.lastname, searchterms.state, searchresults); resultmessage = " customer(s) found."; numberofresults = searchresults.getsize(); function onprerer() if (searchresults.getsize() == 0) resultmessage = "No customers found or no data entered."; function onconstruction() 14 3: OR 4 SearchLibrary.egl 4 SearchLibrary.egl ( X ) package libraries; import data.customer; library SearchLibrary type BasicLibrary function NameAndStateSearch_And(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname and EGL.CUSTOMER."STATE" = :state order by 30 EGL JSF

}; EGL.CUSTOMER.CUSTOMER_ID asc function NameAndStateSearch_Or(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname OR EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; function getallcustomerstates(listofstates string[]) customers Customer[0]; counter int; get customers with #sql{ select EGL.CUSTOMER."STATE" from EGL.CUSTOMER group by EGL.CUSTOMER."STATE" order by EGL.CUSTOMER."STATE" asc }; listofstates.removeall(); for (counter from 1 to customers.getsize() by 1) listofstates.appelement(customers[counter].state); 18 4: 4 customersearch.egl 4 customersearch.egl ( X ) package jsfhandlers; import eglderbyr7.data.*; import libraries.searchlibrary; handler customersearch type JSFHandler {onconstructionfunction = onconstruction, onprererfunction = onprerer, view = "customersearch.jsp"} searchterms Customer; searchresults Customer[0]; resultmessage char(80); numberofresults int; andor char(3); customerstates Customer[]; EGL JSF 31

function searchfunction() searchterms.lastname = searchterms.lastname+"%"; if (andor == "AND") SearchLibrary.NameAndStateSearch_And(searchTerms.LastName, searchterms.state, searchresults); else SearchLibrary.NameAndStateSearch_Or(searchTerms.LastName, searchterms.state, searchresults); resultmessage = "Customer(s)found. Search again?"; numberofresults = syslib.size(searchresults); function onprerer() SearchLibrary.getAllCustomerStates(customerStates); if (searchresults.getsize() == 0) resultmessage = "No customers found or no search criteria entered."; function onconstruction() 18 4: 5 SearchLibrary.egl 5 SearchLibrary.egl ( X ) package libraries; import data.customer; library SearchLibrary type BasicLibrary function NameAndStateSearch_And(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname and EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; function NameAndStateSearch_Or(lname string in, state char(2) in, customer Customer[]) get customer with #sql{ select EGL.CUSTOMER.CUSTOMER_ID, EGL.CUSTOMER.FIRST_NAME, EGL.CUSTOMER.LAST_NAME, EGL.CUSTOMER.PASSWORD, EGL.CUSTOMER.PHONE, EGL.CUSTOMER.EMAIL_ADDRESS, EGL.CUSTOMER.STREET, 32 EGL JSF

EGL.CUSTOMER.APARTMENT, EGL.CUSTOMER.CITY, EGL.CUSTOMER."STATE", EGL.CUSTOMER.POSTALCODE, EGL.CUSTOMER.DIRECTIONS from EGL.CUSTOMER where EGL.CUSTOMER.LAST_NAME like :lname OR EGL.CUSTOMER."STATE" = :state order by EGL.CUSTOMER.CUSTOMER_ID asc }; function getallcustomerstates(listofstates string[]) customers Customer[0]; counter int; get customers with #sql{ select EGL.CUSTOMER."STATE" from EGL.CUSTOMER group by EGL.CUSTOMER."STATE" order by EGL.CUSTOMER."STATE" asc }; listofstates.removeall(); for (counter from 1 to customers.getsize() by 1) listofstates.appelement(customers[counter].state); Function getonestate(state Statetable) get state; Record customizedresult type basicrecord fullname string {displayname = "Full Name"}; email string {displayname = "Email Address"}; statename string {displayname = "State"}; 23 5: 5 customersearch.egl 5 customersearch.egl ( X ) package jsfhandlers; import eglderbyr7.data.*; import libraries.searchlibrary; import libraries.customizedresult; handler customersearch type JSFHandler {onconstructionfunction = onconstruction, onprererfunction = onprerer, view = "customersearch.jsp"} searchterms Customer; searchresults Customer[0]; resultmessage char(80); numberofresults int; andor char(3); customerstates Customer[]; EGL JSF 33

allrecords customizedresult[]; function searchfunction() searchterms.lastname = searchterms.lastname+"%"; if (andor == "AND") SearchLibrary.NameAndStateSearch_And(searchTerms.LastName, searchterms.state, searchresults); else SearchLibrary.NameAndStateSearch_Or(searchTerms.LastName, searchterms.state, searchresults); resultmessage = "Customer(s)found. Search again?"; numberofresults = syslib.size(searchresults); generatecustomresults (searchresults); function onprerer() SearchLibrary.getAllCustomerStates(customerStates); if (searchresults.getsize() == 0) resultmessage = "No customers found or no search criteria entered."; function onconstruction() function generatecustomresults(passedresults Customer[]) allrecords.removeall(); onerecord customizedresult; counter int = 1; state statetable; //loop once for each search result returned while (counter <= (passedresults.getsize())) onerecord.fullname = passedresults[counter].firstname :: " " :: passedresults[counter].lastname; onerecord.email = passedresults[counter].emailaddress; state.stateabbrev = passedresults[counter].state; SearchLibrary.getOneState(state); onerecord.statename = state.statename; allrecords.appelement(onerecord); counter = counter + 1; 23 5: 34 EGL JSF