In this post I will expalin, How to create your first web application with JSF framework.
We will use below tools and technologies -
Step 1. Create a new Dynamic Web Project. File -> New -> Dynamic Web Project.
Step 2. Enter application name (MyFIrstJSFApp). Select target runtime (Apache tomcat v8.0). Click the modify button after that and it will open a new pop up window to modify the default configuration.
Step 3. In below pop window select Java Server Faces latest version and click OK. It will automatically download the selected JSF jars for your application.
Put the name in text box and click the button. You will be redirected to the result page with a greeting message.
This is all about first JSF application. Now we can add more pages and managed beans to add more features.
In next posts I will try to focus on JSF in more details. If you have any doubt please put a comment below and I will try to solve it ASAP.
We will use below tools and technologies -
- JDK8 (To see the JDK installation check my post Java Installation Steps)
- Eclipse mars (current latest version)
- JSF 2.2.0
- Apache Tomcat 8.0
I hope you have above tools installed on your machine and Apache Tomact server is configured in eclipse to deploy the application.
Step 1. Create a new Dynamic Web Project. File -> New -> Dynamic Web Project.
Step 2. Enter application name (MyFIrstJSFApp). Select target runtime (Apache tomcat v8.0). Click the modify button after that and it will open a new pop up window to modify the default configuration.
Step 3. In below pop window select Java Server Faces latest version and click OK. It will automatically download the selected JSF jars for your application.
Step 4. That's all. Your basic JSF web application structure is ready and now you need to create create web pages and managed beans. Modify the generated web.xml, add welcome file to add applications default home page.
<welcome-file-list><welcome-file>faces/index.xhtml</welcome-file></welcome-file-list>
Step 5. Create an index.xhtml in MyFirstJSFApp/WebComponent .
Step 6. Create a file hello.xhtml in MyFirstJSFApp/WebComponent .
Step 7. Create a managed bean (using annotation, so no need to do any xml based configuration).
We are done with all the coding and configuration. Now its time to run the application.
Run The Application -
To run the application Right click on App -> Run As -> Run On Server. Default page index.xhtml will come .
In next posts I will try to focus on JSF in more details. If you have any doubt please put a comment below and I will try to solve it ASAP.
_________________________________________________
***********************Keep studying***********************
No comments:
Post a Comment