Vasavi College of Engineering

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

VASAVI COLLEGE OF ENGINEERING

(Affiliated to Osmania University)


Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
Index.Jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="upload.jsp" method="post">
HNO:<input type="number" name="hno" size="3' min=100 max=999 maxlength="3"
onerror="enter minimum 3 digits"/><br>
Name:<input type="text" name="name"/>
<input type="submit" value="submit"/>
</form>
</body>
</html>

VASAVI COLLEGE OF ENGINEERING


(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
Upload.Jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
int hno=Integer.parseInt(request.getParameter("hno"));
String name=request.getParameter("name");
%>
<jsp:useBean id="beanone" class="in.ac.vce.UploadBean">
<jsp:setProperty property="hno" name="beanone" value="<%=hno%>"/>
<jsp:setProperty property="name" name="beanone" value="<%=name%>"/>
<jsp:setProperty property="storeDatabase" name="beanone" value="st"/>
</jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>

VASAVI COLLEGE OF ENGINEERING


(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
UploadBean.Java

package in.ac.vce;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UploadBean
{
private int hno;
private String name;
Connection con;
PreparedStatement ps;
public void UploadBean()
{
}
public void setHno(int hno)
{
this.hno=hno;}
public void setName(String name)
{this.name=name;}
public int getHno()
{return this.hno;}
public String getName()
{return this.name;}
public void setStoreDatabase(String n)
{
try {
Class.forName("oracle.jdbc.OracleDriver");
String url="jdbc:oracle:thin:@135.135.4.22:1521:rdbms";
con=DriverManager.getConnection(url,"cse14733002","vasavi");
System.out.println("JDBCDemo.main() connected");
ps=con.prepareStatement("insert into biodata values(?,?)");
ps.setInt(1,hno);
ps.setString(2,name);
int r=ps.executeUpdate();
}
catch(Exception e)
{
e.printStackTrace();
}}}
VASAVI COLLEGE OF ENGINEERING
(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
Index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Login</title>
</head>
<body>
Login<br>
<form action="validate.jsp" method="post">
UserName:<input type="text" name="username"/></br>
Password:<input type="text" name="password"/></br>
<input type="submit" value="submit"/>
</form>
</body>
</html>

Welcome.html

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Welcome
</body>
</html>

VASAVI COLLEGE OF ENGINEERING


(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
Validate.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String userName = request.getParameter("username");
String password = request.getParameter("password");
if (userName.equals("adarsh") && password.equals("adarsh123")) {
%>

<jsp:forward page="welcome.html"></jsp:forward>

<%
} else {
%>
<b style="color: red">Login failed</b>
<jsp:include page="index.html"></jsp:include>
<%
}
%>
</body>
</html>

VASAVI COLLEGE OF ENGINEERING


(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
Index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="process.jsp">
No1:<input type="text" name="n1" /><br/><br/>
No1:<input type="text" name="n2" /><br/><br/>
<input type="submit" value="divide"/></form>
</body>
</html>

Error.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%@ page isErrorPage="true" %>

<h3>Sorry an exception occured!</h3>

Exception is: <%= exception %>


</body>
</html>
VASAVI COLLEGE OF ENGINEERING
(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No
Process.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ page errorPage="error.jsp" %>


<%

String num1=request.getParameter("n1");
String num2=request.getParameter("n2");

int a=Integer.parseInt(num1);
int b=Integer.parseInt(num2);
int c=a/b;
out.print("division of numbers is: "+c);

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>
VASAVI COLLEGE OF ENGINEERING
(Affiliated to Osmania University)
Hyderabad - 500 031.
DEPARTMENT OF : Computer Science and
engineering
NAME OF LABORATORY : Web Programming and
Networking
Name Roll No.
Page No

You might also like