BCA

WEB PROGRAMMING LAB

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10 PROGRAM 11 PROGRAM 12 PROGRAM 13 PROGRAM 14 PROGRAM 15 . . .

12. Write a multilayered JSP application to accept and store student information. Accept student name, register number, course, combination, semester , marks obtained in five subjects as input through a proper user interface .Design course, combination and semester as combo boxes. Store the accepted details in the MS Access table.

OUTPUT: Student information

Enter the student details

NAME:

REG no:

COURSE:

COMBINATION:

SEMESTER:

sub1:

sub2:

sub3:

sub4:

sub5:


PAGE 1: program12startpage.html

 
 
 
<html>
<head>
<title>Student information</title>
</head>
<body>
<h3>Enter the student details</h3>
<form action="program12endpage.jsp" method="POST">

NAME:<input type="text" name ="sname" autofocus><br><br>
REG no: <input type ="text" name="regno"><br><br>
COURSE: <select name="course">
<option value="BCA">BCA</option>
<option value="BCA">BSc</option>
</select>
<br><br>
COMBINATION:<select name="comb">
<option value="COMPUTER APPLICATIONS">COMPUTER APPLICATIONS</option>
<option value="PMCs">PMCs</option>
<option value="EMCs">EMCs</option>
<option value="PCM">PCM</option>
<option value="CBZ">CBZ</option>
</select>
<br><br>

SEMESTER:<select name="sem">
<option value="FIRST">FIRST</option>
<option value="SECOND">SECOND</option>
<option value="THIRD">THIRD</option>
<option value="FOURTH">FOURTH</option>
<option value="FIFTH">FIFTH</option>
<option value="SIXTH">SIXTH</option>
</select>
<br><br>
sub1:<input type="text" name="sub1"><br><br>
sub2:<input type="text" name="sub2"><br><br>
sub3:<input type="text" name="sub3"><br><br>
sub4:<input type="text" name="sub4"><br><br>
sub5:<input type="text" name="sub5"><br><br>

<input type="submit" value="SUBMIT">
<input type="reset" value="reset"><br>
</form>
</body>
</html>


PAGE 1: program12endpage.jsp

 
 

<html>
<head><title>PERSON INFORMATION</title>
<%@ page import="java.sql.*"%>
</head>
<body>
<%
int ID=Integer.parseInt(request.getParameter("regno"));
String NAME=request.getParameter("sname");

String CNAME=request.getParameter("course");

int s1=Integer.parseInt(request.getParameter("sub1"));

int s2=Integer.parseInt(request.getParameter("sub2"));

int s3=Integer.parseInt(request.getParameter("sub3"));

int s4=Integer.parseInt(request.getParameter("sub4"));

int s5=Integer.parseInt(request.getParameter("sub5"));

int s6=Integer.parseInt(request.getParameter("sub6"));

int sum=s1+s2+s3+s4+s5+s6;

//int ID=12;
//String NAME="OPPP";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:person");
PreparedStatement p;

  p=con.prepareStatement("insert into table1 values('"+ID+"','"+NAME+"','"+CNAME+"','"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"')");
int rs=p.executeUpdate();
if(rs>0)
{
	out.print("DATA INSERTED SUCCESSFULLY");
}
else
{
	out.print(" NOT CONNECTED");
}
}
catch(Exception e)
{
	out.println(e);
}
%>




</body>

<style>

.table, th, td{
	border: 1px solid black;
	
}

 
	
</style>
<table>


<tr><td>
<center>College Name :</td><td><label type="text" name="cname"><%= CNAME %></label>

</td></tr>


<tr><td>
<center>STUDENT NAME:</td><td><label type="text" name="pname"><%= NAME %></label>

</td></tr>
<tr><td>
<center>Register Number:</td><td><label type="number" name="pid"><%= ID %></label>

</td></tr>
</table>

<table class="table">
<tr><th>SUBJECT</th> <th>OBTAINED</th></tr>
<tr><td>
<center>Subject 1 :</td>

<td>100</td>
<td>40</td>
<td><label type="text" name="s1"><%= s1 %></label>

</td></tr>

<tr><td>
<center>Subject 2 :</td>

 <td><label type="text" name="s2"><%= s2 %></label>

</td></tr>

<tr><td>
<center>Subject 3 :</td>

 <td><label type="text" name="s3"><%= s3 %></label>

</td></tr>

<tr><td>
<center>Subject 4 :</td>

 <td><label type="text" name="s4"><%= s4 %></label>

</td></tr>

<tr><td>
<center>Subject 5 :</td>

 <td><label type="text" name="s5"><%= s5 %></label>

</td></tr>

<tr><td>
<center>Subject 6 :</td>

 <td><label type="text" name="s6"><%= s6 %></label>
</td></tr>
</td></tr>
 <tr><td>
</td><td></td><td></td>
<td>
SUM=<%= sum %>

</td></tr>
</table>
</html>