240 likes | 357 Views
WELCOME. Developing JSF Project With WebSphere. hagin@tai.com.tr. Creating Project. Starting Point File > New > Other…. Selecting Project Type. From the Project Panel, choose Web Item In the right pane, some project types will appear, choose “ Dynamic Web Project ” Click Next button.
E N D
WELCOME Developing JSF Project With WebSphere hagin@tai.com.tr
CreatingProject • Starting Point • File>New>Other…
Selecting Project Type • From the Project Panel, choose Web Item • In the right pane, some project types will appear, choose “Dynamic Web Project” • Click Next button
Determining Project Name And Location • Choose a unique project name • Choose a location for project files • Check configure advanced option box • Lastly, click Next
J2EE Settings • Choose an EAR project to store the Dynamic Web Projectin it • Choose a Context Root name which construct the fully qualified name with the server address • Choose a J2EE specification level where the Dynamic Web Project will obey
Creating EAR Project • Choose a unique name which will store the Dynamic Web Project • Choose a location for EAR project • Choose a server where the EAR project will be deployed in
Adding Supports For Project • Add supports selected in the right figure for your Dynamic Web Project • Don’t add Struts Support, otherwise you will have trouble
Selecting A Template Page • Do not choose a template page • Click finish • In the Dialog Box, click No • The creation process of a JSF Project is finished.
Configuring Project Properties • In the project Navigation Pane, There are two project: JSFTutorial and JSFTutorialEAR • Right click on the JSFTutorial and select properties item
Configuring Java Build Path • In properties editor, select Java Build Path Item • In the Order And Export Tab, push Select All button
Configuring Project References • In properties editor, select Project References Item • In the References List, select JSFTutorialEAR
Adding JSF Features To Project • In properties editor, select Web Project Features Item • In the Feature Pane, check out 2 faces component • Push OK button
Default Properties of Faces Configuration File • The picture shows default Faces properties in the file of faces-config.xml.
Default Properties Of Web.xml • Web.xml file should consists the Faces configurations in the region pointed by the red lines.
Creating A Java Package • Move mouse on to Java Resources directory and right click • Go on with “New>>Package”
Entering Package Name • Enter the package name guessnumber and click the Finish button
Creating Managed Beans • Create a java package named as pagecode • Add UserNumberBean.java under guessnumber package from Resources directory • Add PageCodeBase.java under pagecode package from Resources directory • UserNumberBean should extends PageCodeBase class
Creating JSP Files • Right click on Web Content directory and select New and JSP File, successively • By this way, create the below files: • index.jsp • greeting.jsp • response.jsp
Determining JSP File Names • Enter the JSP file name and do not touch other properties • Click finish button • By this way, create the below files: • index.jsp • greeting.jsp • response.jsp
Constructing Navigation Rules • The right figure explains navigation rules between jsp files in faces-config.xml • The first rule indicates that when greeting.jsp returns success, the response.jsp will be loaded • The second rule indicates that when response.jsp returns success, the greeting.jsp will be loaded response.jsp: <h:commandButton id="back" value="Back" action="success"/> greeting.jsp: <h:commandButton id="submit" action="success" value="Submit" />
Initializing Managed Beans • Managed-bean declaration identifies following properties of UserNumberBean in faces-config.xml • class definition is guessnumber.UserNumberBean • Scope is Session • Minimum property’s type is integer and default value is 0 • Maximum property’s type is integer and default value is 10
Running Project On Server • Point mouse on the root directory of the project JSFTutorial • Left click and choose Run on Server…
Creating An Application Server • Check out Create a new Server box • Finally, click the finish button • JSFTutorial project will run on Application Server…
Finish Thanks… Halil AGIN hagin@tai.com.tr