Javatpoint Logo
Javatpoint Logo

JSF JDBC Connection

You can integrate JSF application to the jdbc. JDBC allows you to store data into the database table.

In this tutorial, we are creating an application and creating jdbc connectivity to store data input by the user.

This application contains a user input form, a managed bean, a response page and the following steps.


Create Database and Table

we have used mysql database to create database and table.

Create Database

JSF Jdbc 1

Select Database

Create table

JSF Jdbc 2

See Table Structure

JSF Jdbc 3

After creating database and table, now create a user form to get user input.

Creating a Form

// index.xhtml


Create a Manged Bean

This file contains properties, database connection and page navigation as well.

// User.java


Create a Response Page

// response.xhtml

Output:

User Form (Index Page)

JSF Jdbc 4

Response Page

JSF Jdbc 5

Now, you can see data into the table.

JSF Jdbc 6

All set! Data has been inserted.


Next TopicJSF CRUD Example




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA