Documente Academic
Documente Profesional
Documente Cultură
COM
Ex. No. : 1
Date:
Car Show Room Inventory Web Application Using JSP and JDBC
Aim
To develop a car show room inventory web application using JSP and JDBC.
Algorithm
Step 1: Choose File > New Project from the main menu. Under categories select java web,
under the project select web application then click Next.
Step 2: Give a name to the project and specify the project location to a directory on the
computer.
Step 3: In the server and setting panel, specify the Glassfish Server on Tomcat as server
which will be used to run the application.
Step 4: In the java EE version field, select Java EE5 click Finish.
Step 5: Create pages index.jsp and response.jsp and insert code for user interface.
Step 6: Create a style sheet to enhance to the design of the web page.
Step 7: Insert code to prepare communication between the application and database.
SOURCE CODE
index.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>CarShowRoom Inventory</title>
1
WWW.VIDYARTHIPLUS.COM
</head>
<body>
<table border="0">
<thead>
<tr>
<th> Honda car India is a subsidiary of the honda of japan for the
production, marketing and export of passenger car in india</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
<tr>
<td>
<strong>select an option:</strong>
<select name="car_id">
<option>Honda City</option>
<option>Honda civic</option>
</select>
</form> </td>
</tr>
</tbody>
</table>
2
WWW.VIDYARTHIPLUS.COM
</body>
</html>
response.jsp
<%@page import="java.sql.DriverManager"%>
<!DOCTYPE html>
<html>
<head>
<title>Car Details</title>
</head>
<body>
<table border="0">
<thead>
<tr>
</tr>
</thead>
<tbody>
<tr>
<td>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
3
WWW.VIDYARTHIPLUS.COM
Connection con =
DriverManager.getConnection("jdbc:odbc:HondaCar", "", "");
String name=request.getParameter("car_id");
ResultSet r = stmt.executeQuery(s);
if (r.next()) {
out.println("</td></tr>");
out.println("<tr><td>");
out.println("Cost:" + r.getString("cost"));
out.println("</td></tr>");
out.println("<tr><td>");
out.println("Milage:"+r.getString("milage"));
out.println("</td></tr>");
out.println("<tr><td>");
out.println("Color:"+r.getString("color"));
con.close();
out.println(ex);
%>
</tbody>
</table>
</body>
</html>
4
WWW.VIDYARTHIPLUS.COM
style.css
body
font-family:Veranda,Arial,Sans-serif;
font-size: smaller;
padding:50px;
color:#555;
h1{
text-align: left;
letter-spacing: 6px;
font-size: 1.4em;
color:#be7429;
font-weight:normal;
widht:450px;
table{ widht:580px;
padding:10px;
background-color: #c4e7e0;
th{
text-align: left;
5
WWW.VIDYARTHIPLUS.COM
}
td{
padding: 10px;
OUTPUT:-
6
WWW.VIDYARTHIPLUS.COM
Result
Thus the above program car show room inventory was executed successfully
using JSP and JDBC connectivity.
Ex. No. : 2
Date:
Aim
TO develop a real estate web application using JSP and JDBC connectivity.
Algorithm
Step 1: Choose File > New Project from the main menu. Under categories select java web,
under the project select web application then click Next.
Step 2: Give a name to the project and specify the project location to a directory on the
computer.
Step 3: In the server and setting panel, specify the Glassfish Server on Tomcat as server
which will be used to run the application.
Step 4: In the java EE version field, select Java EE5 click Finish.
Step 5: Create the index.jsp and then select server database the select new connection and
name as 172.18.1.279 & port number 1521.
Step 6: Select the jar file and open and provider service id as orcl & username: HR &
Password: HR.
Step 7: Create table Suitable name and to give the Field name.
Step8: TO Sort the code to prepare communication between the application and
databases.
7
WWW.VIDYARTHIPLUS.COM
Source code
Index.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<table border="0">
<thead>
<tr>
</tr>
</thead>
<tbody>
<tr>
<option>Rental</option>
8
WWW.VIDYARTHIPLUS.COM
<option>Own</option>
</select>
</td>
</tr>
<tr>
<option>Individual</option>
<option>Apartment</option>
</select>
</td>
</tr>
<tr>
<option>Duplex</option>
<option>Semi-Duplex</option>
</select>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
Table creation
select * from realestate17;
9
WWW.VIDYARTHIPLUS.COM
insert into realestate17
(OWNER_NAME,RENTAL,APARTMENT,DUPLEX,LOCATION,SECURITY,WATE
R- FACILITY)
values('Ranjini','Rental','Apartment','Duplex','Tirupur'available,Available);
(OWNER_NAME,RENTAL,APARTMENT,DUPLEX,LOCATION,SECURITY,WATE
R- FACILITY)
(OWNER_NAME,RENTAL,APARTMENT,DUPLEX,LOCATION,SECURITY,WATE
R-FACILITY)
Myservlet.jsp
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
PrintWriter pw = response.getWriter();
try
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:@172.18.1.249:1521:orcl",
"hr", "hr");
while (rs.next())
response.setContentType("text/html");
pw.println("<HTML>");
pw.println("<head><title>location</title>");
pw.println("<head><body>");
11
WWW.VIDYARTHIPLUS.COM
pw.println("<b>Duplex/SemiDuplex:" + duplex + "</b><br>");
pw.println("</body></html");
pw.close();
con.close();
catch (Exception e)
System.out.println(e);
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<servlet>
<servlet-name>realestate</servlet-name>
<servlet-class>MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>realestate</servlet-name>
<url-pattern>/realestate</url-pattern>
</servlet-mapping>
12
WWW.VIDYARTHIPLUS.COM
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Stylesheet.css
body{
font-family: verdana,Arial,sans_serif;
font-size: smaller;
padding:50px;
color: #555; }
h1{
text-align: legt;
letter-spacing: 6px;
font-size: 1.4em;
color:#be7249;
font-weight: normal;
width:450px; }
table{
width: 580px;
padding: 10px;
background-color: #555; }
13
WWW.VIDYARTHIPLUS.COM
th{
text-align: left;
td{
padding:10px;
Output
Index.jsp
Myservlet.jsp
14
WWW.VIDYARTHIPLUS.COM
Result
Thus the above program was executed and appropriate output has been verified
successfully.
Ex. No. : 3
Date:
Aim
To Develop a Login Web Application Authenticates Using LDAP attributes.
Algorithm
Step 1: Start OpenDS Software by clicking Control Panel .bat.
Source code
Index.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<title>JSP Page</title>
</head>
<table border="0">
<tr><td>
</form></td></tr>
</table>
</body>
</html>
Response.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
16
WWW.VIDYARTHIPLUS.COM
<%@page import="java.util.Hashtable"%>
<%@page import="javax.naming.Context"%>
<%@page import="java.util.Enumeration"%>
<%@page import="javax.naming.directory.*"%>
<%@page import="javax.naming.*"%>
<!DOCTYPE html>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<div id="page-wrap">
try {
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://Localhost:389");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_CREDENTIALS, pwd);
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
17
WWW.VIDYARTHIPLUS.COM
NamingEnumeration r = ctx.search("dc=example,dc=com",
"(sn=James Holms)", constraints);
while (r != null) {
String dn = sr.getName();
out.println("</td></tr>");
} catch (Exception e) {
System.out.println(e);
%>
</table>
</div>
</body>
</html>
Stylesheet.css
body {
background:#2c3381;
color:#FF86c1;
font-family: verdana,Arial,sans-serif;
margin:0;
#page-wrap {
margin-left: 30em;
margin-right: 6em;
18
WWW.VIDYARTHIPLUS.COM
margin-top: 13em;
tr {
margin-top: 20em;
background-color: #cd6889;
border-radius: 0px3px3px0px;
color:white;
margin-bottom: 1em;
padding:0 16px;
width:300px;
td {
padding-left: 5px;
text-align: center;
Output
Index.jsp
19
WWW.VIDYARTHIPLUS.COM
Response.jsp
Result
Thus the above program was executed and appropriate output has been verified
successfully.
Ex. No. : 4
Date:
Algorithm
Step 1: Start OpenDS Software by clicking Control Panel .bat.
Step 6: To write the coding for add in attr.add (Jamesholmes) in the email ID.
Source Code:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="javax.naming.Context"%>
<%@page import="java.util.Enumeration"%>
<%@page import="javax.naming.directory.*"%>
<%@page import="javax.naming.*"%>
<!DOCTYPE html>
<html>
<head>
<title>Login Details</title>
21
WWW.VIDYARTHIPLUS.COM
</head>
<body>
<table>
<tr><td>
<%
try {
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_CREDENTIALS, pwd);
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration r = ctx.search("dc=example,dc=com",
"(sn=Holmes)", constraints);
while (r != null) {
String dn = sr.getName();
out.println("</td></tr><tr><td>" );
Attributes attrs=sr.getAttributes();
for(NamingEnumeration ne =
attrs.getAll();ne.hasMoreElements();)
if(attrID.equals("telephoneNumber"))
attr.clear();
out.println("</td></tr>");
if(attrID.equals("mail"))
attr.add("jamesholmes@gmail.com");
out.println("</td></tr><tr><td>");
out.println(attrID+":");
for(Enumeration vals=attr.getAll();vals.hasMoreElements();)
out.println("\t"+vals.nextElement());
out.println("</td></tr>");
out.println("</td></tr><tr><td>");
out.println("</td></tr>");
} catch (Exception e) {
System.out.println(e); } %>
background:#2c3381;
color:#FF86c1;
font-family: verdana,Arial,sans-serif;
margin:0;
#page-wrap {
margin-left: 30em;
margin-right: 6em;
margin-top: 13em;
tr {
margin-top: 20em;
background-color: #cd6889;
border-radius: 0px3px3px0px;
color:white;
margin-bottom: 1em;
padding:0 16px;
width:300px;
td {
padding-left: 5px;
text-align: center; }
24
WWW.VIDYARTHIPLUS.COM
Output: Details of the user
After adding an addition attribute value to Email and deleting the value of telephone
number.
Result
Thus the above program was executed and appropriate output has been verified
successfully.
Ex. No. : 5
25
WWW.VIDYARTHIPLUS.COM
Date:
Aim
To create a student Identity management web application using struts classes.
Algorithm
Step 1: Choose File > New Project from the main menu. Under categories select java web,
under the project select web application then click Next.
Step 2: Give a name to the project and specify the project location to a directory on the
computer.
Step 3: In the server and setting panel, to select the Struts framework to create login.jsp.
Step 4: To create the struts pages for success.jsp and success1.jsp and final to create
ActionForm
Step 5: To type the Login form in the class name to select the com.myapp.struts.packages
to add files and to create the access method to user ALT+ Insert.
Step 6: To create the Actionclass to give the name for login Action to create the package
in dropdown list.
Step 7: To delete the Back Forward slash and resource filed and set scope request,
Deselect the validation form Bean.
Step 8: To open the struts.config.xml in source editor to choose any places in the struts >
Add forward
26
WWW.VIDYARTHIPLUS.COM
Login.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<table border="0">
<tbody>
<tr>
<td><html:text property="id"/></td>
</tr>
<tr>
<td><html:text property="password"/></td>
</tr>
27
WWW.VIDYARTHIPLUS.COM
<tr>
<td></td>
<td><b><html:submit value="LOGIN"/></b></td>
</tr>
</tbody>
</html:form>
</body>
</html>
Success.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1><b>Congratulations!!!</h1></b>
<table>
<tr>
<td>
Personal details
</td>
28
WWW.VIDYARTHIPLUS.COM
</tr>
<tr>
<td>
Name:Ranjitha
</td>
</tr>
<tr>
<td>
Class:3rd Year
</td>
</tr>
<tr>
<td>
Branch:MCA
</td>
</tr>
<tr>
<td>
College Name:Dr.N.G.P.IT
</td>
</tr>
<tr>
<td>
Place:Coimbatore
</td>
29
WWW.VIDYARTHIPLUS.COM
</tr>
<tr>
<td>
Pin code:605701
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</body>
</html>
Success1.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<I><h1>Congratulations!!!</h1></I>
</body>
<table border="0">
<tr>
30
WWW.VIDYARTHIPLUS.COM
<td>
<b><center>LIBRARY DETAILS</center></b>
</td>
</tr>
<tr>
<td>
Name:ranjitha
</td>
</tr>
<tr>
<td>
Baranch:MCA
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
31
WWW.VIDYARTHIPLUS.COM
Name of the Book:Java complete reference
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</html>
Login form
package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
32
WWW.VIDYARTHIPLUS.COM
public class LoginForm extends org.apache.struts.action.ActionForm {
return id;
this.id = id;
return password;
this.password = password;
return error;
return name;
33
WWW.VIDYARTHIPLUS.COM
}
name = string;
public LoginForm() {
super();
return errors;
Login action
package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
34
WWW.VIDYARTHIPLUS.COM
private static final String SUCCESS = "success";
throws Exception {
String id=formBean.getId();
String password=formBean.getPassword();
String sub=id.substring(2,5);
formBean.setId(sub);
if(sub.equals("MCA"))
return mapping.findForward(SUCCESS);
else if(sub.equals("LIB"))
return mapping.findForward(SUCCESS1);
else
return mapping.findForward(FAILURE);
} }
Struts config.xml
35
WWW.VIDYARTHIPLUS.COM
<?xml version="1.0" encoding="UTF-8" ?>
<struts-config>
<form-beans>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
</action>
</action-mappings>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
</plug-in>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
36
WWW.VIDYARTHIPLUS.COM
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in> </struts-config>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
37
WWW.VIDYARTHIPLUS.COM
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
Stylesheet.jsp
body{
font-family:bjpr;
font-size: larger;
padding: 50px;
color: darkviolet
background-color beige;
h1{
text-align:center;
letter-spacing: 6px;
frnt: size.1.4em;
color: #be7429;
font-weight: normal;
width: 450px;
38
WWW.VIDYARTHIPLUS.COM
font-style: italic;
table{
width: 580px;
padding: 10px;
background-color: burlywood;
th{
text-align: center;
td{
padding: 10px;
OUTPUT
Login Page
39
WWW.VIDYARTHIPLUS.COM
Personal Details
Login Library
Library Details
40
WWW.VIDYARTHIPLUS.COM
Result
Thus the above program was executed and appropriate output has been verified
successfully.
Ex. No. : 6
Date:
Aim
To write a program for online book store application using ASP.Net
Algorithm
Step 1: Start => Microsoft visual studio 2008 => New Project => VC# and Asp.Net
application => to give a name for Name Panel Online.aspx.
Step 2: To create the design page for student information to using the validation control,
like
Custom Validator
41
WWW.VIDYARTHIPLUS.COM
Compare Validator
Step 3: All the validation control should be using the control to validate key.
Step 4: If the validation is successful then go to book.aspx &The book details shown the
book page.
Step 5: Tamil book and English book details the coding for Button click in
Response.Redirect.Tamil.aspx & Response.Redirect.English.aspx
Source Code
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="online._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
#form1
{
font-size: small;
font-weight: 700;
font-style: italic;
text-align: center;
}
.style1
{
font-size: x-large;
font-style: normal;
}
.style3
{
font-style: normal;
font-size: large;
}
.style4
{
text-decoration: underline;
}
42
WWW.VIDYARTHIPLUS.COM
</style>
</head>
<body bgcolor="#66ffcc" style="font-size: large">
<form id="form1" runat="server">
<span class="style1">
<br />
<span class="style4">ONLINE BOOK STORE</span><br />
<br />
<br />
</span>
Default.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace bookstore
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Student.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="studinfo.aspx.cs"
Inherits="online.studinfo" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
text-align: center;
font-size: xx-large;
44
WWW.VIDYARTHIPLUS.COM
}
</style>
</head>
<body bgcolor="#ffff99" style="font-weight: 700; font-size: medium">
<form id="form1" runat="server">
<div class="style1">
Student Information</div>
<asp:Panel ID="Panel1" runat="server" BorderStyle="Solid" Height="317px"
style="margin-left: 247px; margin-top: 135px" Width="491px">
<p>
Register
No:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="To Enter Your Register no"
ControlToValidate ="TextBox1"></asp:RequiredFieldValidator>
</p>
<p>
Name: &n
bsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Enter your valid Name"
ControlToValidate ="TextBox2"></asp:RequiredFieldValidator>
</p>
<p>
Dept mail:
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ErrorMessage="Enter the correct dept" ControlToValidate ="TextBox3"
ValidationExpression ="\S+@\S+\.\S+"></asp:RegularExpressionValidator>
</p>
<p>
Login Password:
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ErrorMessage="Password does not correct" ControlToValidate ="TextBox4"
ControlToCompare ="TextBox2"></asp:CompareValidator>
</p>
<p>
Retype password
<asp:TextBox ID="TextBox5" runat="server" ontextchanged
="TextBox5 _TextChanged"> </asp:TextBox>
45
WWW.VIDYARTHIPLUS.COM
<asp:CustomValidator ID="CustomValidator1" runat="server"
ErrorMessage="Invalid user"
onservervalidate="CustomValidator1_ServerValidate"
ControlToValidate="TextBox5"></asp:CustomValidator>
</p>
<p style="margin-left: 160px">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="font-weight: 700; font-style: italic; height: 26px"
Text="Book Details" />
</p>
</asp:Panel>
<p>
</p>
</form>
</body>
</html>
StudentInfo.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace Online
{
public partial class StudentInfo: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("bookdetails.aspx");
}
}
Bookdetails.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="book.aspx.cs"
Inherits="online.WebForm1" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
#form1
{
text-align: center;
font-weight: 700;
font-style: italic;
font-size: x-large;
}
.style1
{
font-size: xx-large;
}
</style>
</head>
<body bgcolor="#ffff66" style="font-weight: 700; font-size: medium;">
<form id="form1" runat="server">
<span class="style1"
style="background-repeat: repeat; border-style: dashed; border-width: thin">Book
Details</span><br /><br /><br />
namespace online
{
public partial class bookdetails : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Tamildetails.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Englishdetails.aspx");
}
}
Tamildetails.aspx
Englishdetails.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="English.aspx.cs"
Inherits="online.English" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body bgcolor="#99FFCC" style="font-weight: 700; font-size: large" >
<form id="form1" runat="server">
<p>
49
WWW.VIDYARTHIPLUS.COM
<asp:Label ID="Label1" runat="server" BorderStyle="Ridge" Font-Bold="True"
Height="27px" style="text-align: right; font-size: x-large; margin-left: 370px"
Text="English Book Details" Width="213px"></asp:Label> </p>
<p>
</p>
<p> </p>
<asp:Panel ID="Panel1" runat="server" BackColor="#FFCCFF" Height="214px"
style="margin-left: 86px" Width="264px">
<br />
<br /><br />
<br /><br />
<br />
<asp:Button ID="Button1" runat="server"
style="margin-left: 85px; font-weight: 700;" Text="Details" Width="90px"
BorderStyle="Groove" ForeColor="#CC0000" onclick="Button1_Click1" />
</asp:Panel>
</form>
</body>
</html>
OUTPUT
50
WWW.VIDYARTHIPLUS.COM
Login
Page
51
WWW.VIDYARTHIPLUS.COM
Student Information
52
WWW.VIDYARTHIPLUS.COM
Enter Your dept Email ID
53
WWW.VIDYARTHIPLUS.COM
Enter Your Login
password
54
WWW.VIDYARTHIPLUS.COM
Book Details
55
WWW.VIDYARTHIPLUS.COM
Book Details
Result
56
WWW.VIDYARTHIPLUS.COM
Thus the above program was executed and appropriate output has
been verified successfully
Ex. No. : 7
Date:
Algorithm
Step 1: Start => Microsoft visual studio 2008 => New Project => VC# and Asp.Net
application => to give a name for Name Panel Calci.aspx.
Step 3: To write the coding for button click in Addition and Subtraction in the design
page.
Step 4: The source code is auto generated on the label box and text box in the source code
window.
SOURCE CODE
Default.aspx
Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="calculate._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-family: "Book Antiqua";
font-weight: bold;
}
57
WWW.VIDYARTHIPLUS.COM
.style2
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: medium;
}
.style3
{
font-size: medium;
}
.style4
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: x-large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" BackColor="#669900" BorderStyle="Solid"
Height="477px" style="margin-left: 205px; margin-top: 47px" Width="670px">
<span class="style2"> </span><span
class="style4">Addution and Subtraction
of Two Numbers from the user</span><br class="style2" />
<br class="style2" />
<br class="style2" />
Default.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace calculate
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(User.aspx);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect(User1.aspx);
}
}
}
User.aspx
<%Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="calculate._Default"%>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
59
WWW.VIDYARTHIPLUS.COM
font-family: "Book Antiqua";
font-weight: bold;
}
.style2
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: medium;
}
.style3
{
font-size: medium;
}
.style4
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: x-large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" BackColor="#669900" BorderStyle="Solid"
Height="477px" style="margin-left: 205px; margin-top: 47px" Width="670px">
<span class="style2"> </span>
<span class="style4">Addution and Subtraction
of Two Numbers from the user</span><br class="style2" />
<br class="style2" />
<br class="style2" />
<span class="style2">First number for the user
</span>
<span class="style1"><span class="style3">
<asp:TextBox ID="TextBox5" runat="server" Height="33px"
Width="151px"></asp:TextBox>
</span></span>
<br class="style2" />
<br class="style2" />
<span class="style2">Second number for the user
</span><span class="style1">
<span class="style3">
<asp:TextBox ID="TextBox2" runat="server" Height="29px"
style="margin-left: 12px" Width="150px"></asp:TextBox>
</span></span>
<br class="style2" />
<br class="style2" />
60
WWW.VIDYARTHIPLUS.COM
<br class="style2" />
<br class="style2" />
<span class="style2">
</span><span class="style2">
</span><span class="style1"><span class="style3">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="margin-left: 199px; font-size: medium; font-weight: 700; font-family:
'Times New Roman', Times, serif;"
Text="ADDITION" Width="144px" />
</span></span>
</asp:Panel>
</form>
</body>
</html>
User.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace calculate
{
public partial class _user : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(Addition.aspx);
}
}
}
Addition.aspx
Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="calculate._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
61
WWW.VIDYARTHIPLUS.COM
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-family: "Book Antiqua";
font-weight: bold;
}
.style2
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: medium;
}
.style3
{
font-size: medium;
}
.style4
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: x-large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" BackColor="#669900" BorderStyle="Solid"
Height="477px" style="margin-left: 205px; margin-top: 47px" Width="670px">
<span class="style2"> </span><span
6class="style4">Addution and Subtraction
of Two Numbers from the user</span><br class="style2" />
<br class="style2" />
<br class="style2" />
<span class="style2">Result for ADDITION</span><span class="style1"><span
class="style3"><asp:TextBox ID="TextBox3" runat="server" Height="29px"
style="margin-left: 66px" Width="145px"></asp:TextBox>
</span></span>
</asp:Panel>
</form>
</body>
</html>
Addition.aspx.cs
using System;
using System.Collections;
using System.Configuration;
62
WWW.VIDYARTHIPLUS.COM
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace calculate
{
public partial class _Addition : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int num1 = Int32.Parse(TextBox1.Text);
int num2 = Int32.Parse(TextBox2.Text);
int sum = num1 + num2;
TextBox3.Text = sum.ToString();
}
}
User1.aspx
Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="calculate._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-family: "Book Antiqua";
font-weight: bold;
}
.style2
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: medium;
}
.style3
{
63
WWW.VIDYARTHIPLUS.COM
font-size: medium;
}
.style4
{
font-family: "Book Antiqua";
font-weight: bold;
font-size: x-large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" BackColor="#669900" BorderStyle="Solid"
Height="477px" style="margin-left: 205px; margin-top: 47px" Width="670px">
<span class="style2"> </span><span
class="style4">Addution and Subtraction
of Two Numbers from the user</span><br class="style2" />
<br class="style2" />
<br class="style2" />
<span class="style2">First number for the user
</span>
<span class="style1"><span class="style3">
<asp:TextBox ID="TextBox5" runat="server" Height="33px"
Width="151px"></asp:TextBox>
</span></span>
<br class="style2" />
<br class="style2" />
<span class="style2">Second number for the user
</span><span class="style1">
<span class="style3">
<asp:TextBox ID="TextBox2" runat="server" Height="29px"
style="margin-left: 12px" Width="150px"></asp:TextBox>
</span></span>
<br class="style2" />
<br class="style2" />
<br class="style2" />
<br class="style2" />
<span class="style2">
</span><span class="style2">
</span><span class="style1"><span class="style3">
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
User1.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace calculate
{
public partial class _user : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect(Subtraction.aspx);
}
}
}
Subtraction.aspx
66
WWW.VIDYARTHIPLUS.COM
namespace calculate
{
public partial class _subtraction : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
int num1 = Int32.Parse(TextBox1.Text);
int num2 = Int32.Parse(TextBox2.Text);
int sub = num1 - num2;
TextBox4.Text = sum.ToString();
}
}}
OUTPUT
67
WWW.VIDYARTHIPLUS.COM
68
WWW.VIDYARTHIPLUS.COM
Subtraction
69
WWW.VIDYARTHIPLUS.COM
Result
Thus the above program was executed and appropriate output has been verified
successfully.
Ex. No. : 8
Date:
Algorithm
Step 1: To open the Notepad window and type the coding using HTML tags.
Step 2: To give the name in name panel window & save the file using .html extension.
Step 3: To include the HTML header Files and Script Types, to use the Canvas Xmlns.
Step 4: To develop the coding for textbox, Rectangle, Ellipse, & Line and Polygon.
Step 5: To create the <path > and declare the path geometry in the tag file and also close
the </path> tag.
Step 6:Finally close the object and close the HTML header tags.
Source Code:
<html>
<head>
</head>
var x = args.GetPosition(sender).x;
var y = args.GetPosition(sender).y;
71
WWW.VIDYARTHIPLUS.COM
'" FontSize="18" Text="hello" Foreground="#CCCCCC"/>'
sender.children.add(textblock); }
</script>
<Path>
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="20,20">
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
72
WWW.VIDYARTHIPLUS.COM
</Canvas>
</script>
<body>
</object>
</body>
</html>
Output:
Result
Thus the above program was executed and appropriate output has been verified
successfully.
73
WWW.VIDYARTHIPLUS.COM
Ex. No. : 9
Date:
Aim
To develop the program for silver light application using Graphic control.
Algorithm
Step 1: To start the program => Microsoft Visual Studio 2010 => File => New Project.
Step 2: Under the categories VC# the templates for silver light application in silver light
control.
Step 3: To give the suitable name for the project & choose the drive to save.
Step 4: To select the chart tool in toolbox & write the coding for mainform.xaml.
Step 5: to declare the variable for sName and tMarks using constructor.
Source Code
Class1.cs
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SilverlightApplication1
{
public class Class1
{
public Class1() { }
public Class1(string sName, int tMarks)
{
74
WWW.VIDYARTHIPLUS.COM
Name = sName;
Marks = tMarks;
}
public string Name { get; set; }
public int Marks { get; set; }
}
}
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
namespace SilverlightApplication1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
MainPage.xaml
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
75
WWW.VIDYARTHIPLUS.COM
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400" xmlns:charting="clr-
namespace:Microsoft.Windows.Controls.DataVisualization.Charting;assembly=Microsoft.
Windows.Controls.DataVisualization">
<charting:PieSeries ItemsSource="{Binding}"
IndependentValueBinding="{Binding Name}"
DependentValueBinding="{Binding Marks}"/>
</charting:Chart>
</Grid>
</UserControl>
Output: PieSeries
76
WWW.VIDYARTHIPLUS.COM
Output: BarSeries
77
WWW.VIDYARTHIPLUS.COM
Result
Thus the above program was executed and appropriate output has been verified
successfully.
78