1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Beginning JSF 2 APIs and JBoss Seam pptx

314 952 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 314
Dung lượng 8,14 MB

Nội dung

The eXperT’s Voice ® in JaVa ™ Technology Beginning JSF ™ 2 APIs and JBoss ® Seam Kent Ka Iok Tong     Begin using the new JavaServer ™ Faces (JSF ™ ) 2 APIs available in the new Java ™ EE 6 platform [...]... deploy, ctxPath=/ 14:47:06,9 02 INFO [TomcatDeployment] deploy, ­txPath=/jmx-­onsole c c 14:47:06,965 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on ­ttp- 127 .0.0.1-­080 h 8 14:47:06,9 92 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ­jp- 127 .0.0.1-­009 a 8 14:47:07,001 INFO [ServerImpl] JBoss (Microcontainer) [5.0.1.GA (build: SVNTag =JBoss_ 5_0_1_GA date =20 09 022 3 122 1)] Started in 26 s:587ms n Note  If your... isting 1‑1 Tell Web Beans Where JBoss Is jboss. home=c: \jboss java.opts= webbeans-ri-int.version=5 .2. 0-SNAPSHOT webbeans-ri.version=1.0.0-SNAPSHOT jboss- ejb3.version=1.0.0 Open a command prompt, make sure you’re connected to the Internet, and then issue the commands shown in ­ isting 1 2 L L ­ isting 1 2 Issue These Commands at the Command Prompt c:\>cd ­webbeans \jboss- ­s \ a c:\>set ANT_HOME=c:\ant c:\>ant... that fast, JBoss will take so long to start that Eclipse may think it has stopped responding In that case, ­ ouble-­ lick the JBoss instance, click Timeouts, set the timeout for starting to a longer d c value such as 100 seconds, and then start JBoss again To stop JBoss, click the red icon (as shown earlier in Figure 1‑10) ­ Installing a JSF Implementation JSF stands for JavaServer Faces and is an API... Output component “h” is a shorthand for the JSF HTML namespace It is called a “prefix.” The page object is called the “component view root.” Page Object (View Root) Such a hierarchical data structure is called the JSF component tree” or the JSF view.” UI Output Value:John F ­ igure 1 22 JSF component tree The component tree generates HTML code, as shown in ­ igure 1 23 In JSF, the pro‑ F cess is called... ­mlns:xsi="http://www.w3.org /20 01/XMLSchema-­nstance" i xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig _2_ 0.xsd" version= "2. 0"> To register your application with JBoss, ­ ight-­ lick the JBoss instance on the Servers r c tab, and choose Add and Remove Projects; then you’ll see ­ igure 1‑19 F F ­ igure 1‑19 Adding projects to the JBoss instance... ITH J S F Choose your Hello project to add to the JBoss instance Now, start JBoss, and try to access http://localhost:8080/Hello/hello.xhtml in a browser Note that this URL does not include the /faces prefix and thus will not be han‑ dled by the JSF engine Instead, JBoss will directly read the hello.xhtml page and return its content (see ­ igure 1 20 ) We’re doing this just to check whether the basic... the JAR files into JBoss, as shown in ­ igure 1‑14 F jboss jsf server lib ?????.jar ?????.jar default deploy jbossweb.sar jsf- libs F ­ igure 1‑14 Copying the JAR files into the JBoss C h a p t e r 1   ■  G ETT I N G S TARTE D W I TH JS F To see the Web Beans classes available to you at compile time, right-­ lick the project, ­ c choose Build Path ➤ Configure Build Path, and add ­: \jboss\ server\default\deployers\... in JBoss every 15 seconds after you make changes to the source files If you can’t wait, you can ­ ight-­ lick the JBoss instance and r c choose Publish to force it to do it immediately Anyway, the HTML page should look like F ­ igure 1 24 19 20 Ch apt er 1  ■  G ETT ING S TARTE D W ITH J S F F ­ igure 1 24 Generated HTML code Note that there is no space between “Hello” and “John.” This is because JSF. .. Static Code Block 2 View Root Static Code Block 1 Static Code Block 1 UI Output Value: John Static Code Block 2 1: Output the static code unchanged UI Output Value: John Static Code Block 2 2: Output the value John 3: Output the stuff unchanged F ­ igure 1 23 JSF component tree generating HTML code Now access the page again in the browser Do you need to start JBoss again? No By default Eclipse... Simply put, JSF will take path /hello.xhtml (the view ID) ­ from the URL and use it to load the XHTML file C h a p t e r 1   ■  G ETT I N G S TARTE D W I TH JS F 1: Read this path Browser HTTP Request GET /Hello/faces/hello.xhtml http://localhost:8080/Hello/hello.xhtml JBoss 2: Pass the path /hello.xhtml to JSF 4: Parse the xhtml file and create an object to represent the page (the “Page Object”) JSF 5: . y3c w3 h18" alt="" Beginning JSF ™ 2 APIs and JBoss ® Seam Kent Ka Iok Tong Beginning JSF ™ 2 APIs and JBoss ® Seam Copyright © 20 09 by Kent Ka Iok. Technology Beginning JSF ™ 2 APIs and JBoss ® Seam Kent Ka Iok Tong     Begin using the new JavaServer ™ Faces (JSF ™ ) 2 APIs

Ngày đăng: 19/02/2014, 20:20

TỪ KHÓA LIÊN QUAN

w