Professional Documents
Culture Documents
EX - NO: 7 Date: Web Application Using JSP Aim
EX - NO: 7 Date: Web Application Using JSP Aim
NO: 7
DATE:
WEB APPLICATION USING JSP
AIM :
To develop a web application to select the author of a text book using JSP.
PROCEDURE:
1.Start Netbeans IDE, Go to file menu and select new project, the new project dialog box shown as below
opens. From the Categories select the option “java web” and from projects select “web Application”
and click Next.
2.Type the name of the project as “FirstJSP” and select a location to save the project and click Next.
3.In the server select default server “GlassFish Server” and click “Next”. Click “Finish”.
4.Right click the Web Pages folder from the workspace and select option “new” and select “JSP” and
type the name of the file as “First” and then click “Finish”. Type its code.
5.Run the first.jsp by right clicking the file and select run.
PROGRAM:
RESULT:
Thus the program has been executed successfully and output verified.
EX.NO: 8
DATE:
CREATE APPLICATIONS USING INCLUDE DIRECTIVE
AIM:
To create web applications using include Directive JSP Include Action
PROCEDURE :
1.Start Netbeans IDE, Go to file menu and select new project, the new project dialog box shown as
below opens. From the Categories select the option “java web” and from projects select “web
Application” and click Next.
2.Type the name of the project as “FirstJSP” and select a location to save the project and click Next.
3.In the server select default server “GlassFish Server” and click “Next”. Click “Finish”.
4.Right click the Web Pages folder from the workspace and select option “new” and select “JSP” and
type the name of the file as “Date” and then click “Finish”. Type its code.
5.Repeat the step 4 and name the file as “Order.jsp” and type its code.
6.Repeat the step 4 and name the file as “includedir.jsp” and type its code.
7.Run the includedir.jsp by right clicking the file and select run.
PROGRAM:
Date.jsp
<html>
<head>
<title>Date Display</title>
</head>
<body>
<%-- JSP comments --%>
<%@page import="java.util.Date"%>
<%! Date date; %>
<% date = new Date(); %>
<b> System date and time: </b> <%= date %>
</body>
</html>
Order.jsp
<HTML>
<HEAD>
<TITLE>A Catalog Order Form</TITLE>
</HEAD>
<BODY>
<H1> Invoice Form</H1>
<%! String item[] = {"Pen", "Sketch", "Marker"};
doubleprice[] = {20.50, 10.50, 15.50};
int quantity[] = {10, 15, 25}; %>
<TABLE BORDER="1" >
<TR><TD>Item</TD>
<TD>Price</TD>
<TD>Quantity</TD>
<TD>Total Price</TD>
</TR>
<% for (int i=0; i<3; i++) { %>
<TR><TD><%= item[i] %></TD>
<TD><%= price[i] %></TD>
<TD><%= quantity[i] %></TD>
<TD><%= price[i] * quantity[i] %></TD>
</TR>
<% } %>
</TABLE>
</BODY>
</HTML>
Includedir.jsp
<html>
<head>
<title>JSP Program using Include Directive</title>
</head>
<body>
<h1>Include the First File:</h1>
<br><br>
<%@ include file="Date.jsp"%>
<br><br><br>
<h2>Include the Second File:</h2>
<br>
<%@ include file="Order.jsp"%>
</body>
</html>
OUTPUT:
RESULT:
Thus the program has been executed successfully and output verified.
EX.NO: 9
DATE:
CREATE A JSP BASED WEB APPLICATION USING DATABASE
AIM :
To write a JSP Program for retrieving the Employee Details through JDBC
Connectivity.
PROCEDURE :
1. Open mysql command line and create a database and table as given below:
2. Start Netbeans IDE, Go to file menu and select new project, the new project dialog
box opens. From the Categories select the option Java Web and from projects select
Java Web Application and click Next.
3. Type the name of the project as “persondatajsp” and select a location to save the
project and click Finish.
4. In the project tab right click the library folder of your application and select the
option “Add JAR/Folder” and go to the location where we have saved our mysql
connector JAR file. Select the JAR file and it will be added to your project.
5. Right Click the project name and select the option new and JSP and give name for
jsp file and click finish.
6. Type the following code and run the code by clicking the run tool or by selecting
run option from run menu.
PROGRAM:
Persondatajsp.jsp
OUTPUT
RESULT:
Thus the program has been executed successfully and output verified.