Sunteți pe pagina 1din 3

Chapter 44 JavaServer Faces 2.

0
1. JSF enables you to develop Web applications by separating
Web UI from Java code so that the application developed
using JSF is easy to debug and maintain. The UI part can
be created using a tool. NetBeans supports visual Web
development based on JSF.

2. TocreateaJSFprojectinNetBeans,createaWebproject
withtheVisualWebComponentsselected.

3. TocreateaJSFpage,chooseVisualWebJSFPagefromthe
contextmenuoftheproject.

4. The init method is called whenever the page is navigated


to, either by directly via a URL, or indirectly via page
navigation. The preprocess method is called after the
component tree has been restored, but before any event
processing takes place. The prerender method is called
just before rendering takes place. This method will only
be called for the page hat will actually be rendered. The
destroy method is called after rendering is completed for
this request.

5. TheJSFfileisautomaticallycreatedtodescribetheUI
componentsandtheirrelationships.Wheneveryouadd,
remove,orchangetheUIcomponentsintheDesignpane,
thecontentsintheJSParealsoupdated.Itispossible
tomodifytheJSPfiledirectly,butitisnot
recommendedforthenewusers.ModifyingtheJSPfile
mistakenlycouldcorrupttheentireproject.Youcan
completelyignoretheJSPfilewhenusingthistool.

6. ClickingtheJavatabinthecontentpane,youwillsee
theJavasourcefile,knownasthepagebeanfile.This
filecontainsseveralmethods.Amongthemarethefour
JSFlifecyclemethodsinit,preprocess,prerender,and
destroy.

7. Right-click the list in the Design to display its context


menu, choose Configure Default Options to display the
Options Customizer dialog box.

8. DroparadiobuttongroupcomponenttotheUIandsetthe
namesoftheradiobuttonsfromtheOptionsCustomizer
dialogbox.
9. DropacheckboxcomponenttotheUIandsetthenamesof
theradiobuttonsfromtheOptionsCustomizerdialogbox.

10. Settherenderedpropertytofalse.ForaFormobject,
youhavesetthevisiblepropertytofalse.

11. getText().

12. getSelected().

13. Yes.

14. GridPanel,LayoutPanel,GroupPanel.

15. Thebestwaytoreorderthemistomovethecomponents
fromtheNavigatorpane.

16. In the Runtime pane, right-click the Database node and


choose New Connection in the context menu to display the
New Database Connection dialog box.

17. Droppingatablefromthedatabaseconnectioninthe
RuntimepanetotheUIwillcreateadataprovider.

18. DoubleclickingtheRowSetundertheSessionBean1nodein
theRuntimewilldisplaythequeryvisuallyintheDesign
pane.YoucanmodifytheunderlyingqueryfortheRowSet.

19. YoucanmodifytheunderlyingqueryfortheRowSet.

20. JSFsupportssessiontrackingusingJavaBeansatthe
applicationscope,sessionscope,andrequestscope.When
youcreateavisualWebproject,RequestBean1,
SessionBean1,andApplicationBean1areautomatically
created.

21. Youcancodeitmanuallyorvisuallyfromthetool.

22. UsinggetSessionBean1().getProperty()

23. MessageComponent

24. UsetheforpropertyoftheMessageComponenttoseta
messagecomponentwithaninputcomponent.

25. Settherequiredpropertytotrue.

26. Rightthecomponent(e.g.,atextfield)intheDesign,
chooseEditEventHandlervalidatetogeneratethe
methodnamedtfSSN_validateintheJavasourcepage.
Implementthemethodusingregularexpressions.

S-ar putea să vă placă și