Database Application in JSP Using Netbeans: Index
Database Application in JSP Using Netbeans: Index
NetBeans
INDEX
1. Basic
2. Creating application and adding drivers
3. Creating Database Connection
4. Creating Database Connection pool in application
5. Creating Insert page
6. Creating Update page
7. Creating Delete page
8. Final Screenshots
1. Basic:-
We make simple JSP application in NetBeans. It contains four jsp files.
o Index.jsp : contains link for other three pages.
o Insert.jsp : Insert data into STUDENT table and display.
o Update.jsp : Update data of STUDENT table and display.
o Delete.jsp : Delete data from STUDENT table and display.
STUDENT table contains three fields and database is made using JavaDB.
o You will see the above window. Here from categories choose Java Web.
o It will show you projects as shown in fig in right side tab.
o Select Web Application and give next.
o You will see next window as shown below.
o Here you can specify project name and path where to store project.
o When you give next it will show the web server settings.
o We are using GlassFish as web server.
o After giving next it will show window to choose framework.
o We are not using framework here so don’t select anyone and click finish
button. Our project is created.
o Index.jsp page is automatically created by default. Now, you have to
create other three JSP pages.
o To do it, in project window write click on Web pages -> New -> JSP.
o It will open new window which ask for page name. Give appropriate
name.
o Create Insert.jsp,Update.jsp and Delete.jsp.
o I have used JavaDB as database. So, I have to include driver for that into
my library. If you are using other database then you have to include
appropriate drivers.
o Right click on Libraries -> Add JAR/Folders….
o It will open a window, browse through your hard disk and select
appropriate JAR and click open.
o It will add drivers to access database into your project.
3. Creating Database Connection:
o Go to services tab.
o Right click on Databases and chose New Connection….
o You have to fill database details here.
o Above <form> tag, put three c:set tags to get value of id, name and text.
o First time when this page is called these values are null.
o When we come to this page after click on submit, we get parameters from
tax boxes that we want to enter into database.
<c:set var="id" value="${param.id}"/>
<c:set var="name" value="${param.name}"/>
<c:set var="branch" value="${param.branch}"/>
o For using standard tag library, you have to include following two lines at
top in JSP page.
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
8. Final Screenshots:
o Insert page
o Update Page
o Delete Page