SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
T.Y.B.Sc. Computer Science Roll No.
INDEX
Practical No. Practical Name Page
No.
Date Remark Signature
1. Simple Server-Side Programming
using Servlets . Where user can
get the information about server.
01 to 03 05/12/2015
2. Advance Server-Side
Programming using Servlets.
Where user can get details of his
created table in SQL.
04 to 08 12/12/2015
3. Simple Server-side programming
using JSP for Login page where
after login the page forwarded to
new welcome page and if login
details are wrong then page
transferred to index page.
09 to 12 19/12/2015
4. Advance Server-side
programming using JSP for login
page where login details for user
taken from database created in
SQL. If user_id and password
entered by user is wrong then
page redirected to invalid page or
else redirected to Home page.
13 to 20 02/01/2016
5. Developing Simple Enterprise
Java Beans for addition of two
numbers by taking inputs from
user.
21 to 25 09/01/2016
6. Developing Advance Enterprise
Java Beans. Where user is
entering details of registration
form in Registration.jsp file and
the data entered by user should be
stored in database.
26 to 29 23/01/2016
7. Developing Simple Web services
in Java Demonstrate a simple web
service that generates a response
based on information received
from the client.
30 to 34 06/02/2016
8. Developing Advance Web
services in Java. Develop web
service for calculator applications,
to implement simple arithmetic
Operations. Use WSDL for these
web services to show output.
35 to 39 13/02/2016
T.Y.B.Sc. Computer Science Roll No.
Practical No: 1
Practical Name :–
Simple Server-Side Programming using Servlets. Where user can get the information about
server.
Index.jsp :-
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="serverinfo" method="post">
<input type="submit" value="submit">
</form>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Serverinfo.java :-
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;
public class extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<h3>Server Info:<h3>");
out.println("Server Name:"+request.getServerName()+"<br><br>");
out.println("Server Port:"+request.getServerPort()+"<br><br>");
out.println("Client Browser:"+request.getHeader("User Agent")+"<br><br>");
out.println("Server Referer:"+request.getHeader("Referer")+"<br><br>");
out.println("Client IP:"+request.getRemoteAddr()+"<br><br>");
out.println("Server OS Version:"+System.getProperty("os.version")+"<br><br>");
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
}
T.Y.B.Sc. Computer Science Roll No.
Output :-
T.Y.B.Sc. Computer Science Roll No.
Practical No: 2
Practical Name :–
Advance Server-Side Programming using Servlets. Where user can get details of his created
table in SQL.
Index.jsp :-
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="dataconnection1" method="POST">
<input type="submit" value="submit">
</form>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Dataconnection1.java :-
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.sql.*;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "dataconnection1", urlPatterns = {"/dataconnection1"})
public class dataconnection1 extends HttpServlet implements Servlet
{
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
out.println("connectivity begins");
Connection cn;
Statement st;
ResultSet rs;
cn=DriverManager.getConnection("jdbc:odbc:ServletDSN","system","dbms");
out.println("cooncted successfully");
st=cn.createStatement();
st.executeUpdate("create table Aut1(AuId Number,AuName Char(15),AuAddr
Char(30))");
out.println("Table Created");
st.executeUpdate("insert into Aut1 values(1,'ABC','Panvel')");
st.executeUpdate("insert into Aut1 values(2,'XYZ','Pune')");
out.println("Records inserted into table");
rs=st.executeQuery("select * from Aut1");
out.println("AuId &nbsp &nbsp AuName &nbsp &nbsp AuAddr <br>");
T.Y.B.Sc. Computer Science Roll No.
while(rs.next())
{
out.println(rs.getInt(1)+"&nbsp &nbsp &nbsp");
out.println(rs.getString(2)+"&nbsp &nbsp &nbsp");
out.println(rs.getString(3)+"&nbsp &nbsp &nbsp");
st.close(); }
rs.close();
cn.close();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet dataconnection1</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet dataconnection1 at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
catch(Exception e1)
{
System.out.println("Failed");
}
finally {
out.close();
}
}
}
T.Y.B.Sc. Computer Science Roll No.
Output:-
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Practical No: 3
Practical Name:–
Simple Server-side programming using JSP for Login page where after login the page forwarded
to new welcome page and if login details are wrong then page transferred to index page.
Index.jsp :-
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form method="post" action="login1.jsp">
username<input type="text" name="txtname" size="20"><br>
password<input type="password" name="pwd" size="20"><br>
<input type="submit" value="Login">
</form>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Login1.jsp :-
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%if((request.getParameter("txtname").equals("yogita"))&&(request.getParameter("pwd").equal
s("vyom"))){%>
<jsp:forward page="welcome.jsp"></jsp:forward>
<%} else{ out.println("Enter correct details");%>
<jsp:include page="index.jsp"></jsp:include>
<%}%>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Login1.jsp :-
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Output:-
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Practical No: 4
Practical Name:–
Advance Server-side programming using JSP for login page where login details for user taken
from database created in SQL. If user_id and password entered by user is wrong then page
redirected to invalid page or else redirected to Home page.
Index.jsp :-
<%--
Document : index
Created on : Mar 8, 2016, 10:54:04 AM
Author : computerlab
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="TLogin.jsp" method="post">
<table bgcolor="yellow">
<tr><td>User Name:<input type="text" name="userid" size="15"></td></tr>
<tr><td>Password:<input type="password" name="pwd" size="15"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit"
size="10"></td></tr>
</table>
</form>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
TLogin.jsp :-
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="javax.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
Connection con;
String userid=request.getParameter("userid");
out.println("hellow"+userid);
session.setAttribute("userid",userid);
String pwd=request.getParameter("pwd");
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","root");
out.println("connected successfully");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from student where userid='"+userid+"'");
if(rs.next())
{
if(rs.getString(2).equals(pwd))
{
//System.out.println("Login sucessfully");
response.sendRedirect("Home.jsp");
}
else
{
response.sendRedirect("Invalid.jsp");
}
}
%>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Invalid.jsp :-
<%--
Document : Invalid
Created on : Mar 8, 2016, 10:56:04 AM
Author : computerlab
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<body bgcolor="pink">
<h1>Invalid User ID or Password<%=session.getAttribute("userid")%>!!!</h1>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Home.jsp :-
<%--
Document : Home
Created on : Feb 23, 2016, 9:06:59 AM
Author : computerlab
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<body bgcolor="pink">
<h1>Welcome<%=session.getAttribute("userid")%>!!!</h1>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Output:-
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Practical No: 5
Practical Name:–
Developing Simple Enterprise Java Beans for addition of two numbers by taking inputs from
user.
Index.jsp :-
<%--
Document : index
Created on : Feb 12, 2016, 9:08:58 AM
Author : computelab
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form method="post" action="calcservlet">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="submit" value="OK">
</form>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
calcservlet.java :-
import ejb.calbeanLocal;
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;
public class calcservlet extends HttpServlet {
calbeanLocal calbean=new calbeanLocal();
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet calcservlet</title>");
out.println("</head>");
out.println("<body>");
int a=Integer.parseInt(request.getParameter("t1"));
int b=Integer.parseInt(request.getParameter("t2"));
out.println("<h1>Sum ="+calbean.addition(a,b)+" </h1>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the
left to edit the code.">
/**
* Handles the HTTP
* <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
T.Y.B.Sc. Computer Science Roll No.
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP
* <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
T.Y.B.Sc. Computer Science Roll No.
calbeanLocal.java :-
package ejb;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
@Stateless
@LocalBean
public class calbeanLocal {
public Integer addition(int a, int b) {
return (a+b);
}
}
T.Y.B.Sc. Computer Science Roll No.
Output:-
T.Y.B.Sc. Computer Science Roll No.
Practical No: 6
Practical Name:–
Developing Advance Enterprise Java Beans. Where user is entering details of registration form
in Registration.jsp file and the data entered by user should be stored in database.
Index.jsp:
<%--
Document : index
Created on : Mar 2, 2016, 12:10:46 PM
Author : computerlab
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="Registeration1.jsp" method="post">
User Name: <input type="text" name="un"><br/>
Password: <input type="text" name="tp"><br/>
First Name: <input type="text" name="fn"><br/>
Last Name: <input type="text" name="ln"><br/>
Email: <input type="text" name="e"><br/>
<input type="submit" value="Register"><br/>
</form>
</body>
</html>
<%--
T.Y.B.Sc. Computer Science Roll No.
Registeration1.jsp:-
Created on : Aug 31, 2015, 9:41:20 AM
Author : computerlab
--%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String user_name=request.getParameter("un");
String pswd=request.getParameter("tp");
String first_name=request.getParameter("fn");
String last_name=request.getParameter("ln");
String email=request.getParameter("e");
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/reg1","root","root");
PreparedStatement ps = con.prepareStatement("insert into new_table values(?,?,?,?,?)");
ps.setString(1, user_name);
ps.setString(2, pswd);
ps.setString(3, first_name);
ps.setString(4, last_name);
ps.setString(5, email);
ps.executeUpdate();
out.println("Successful Registration");
}
catch(Exception e)
{
out.println("Exception caught"+e);
}
%>
</body>
</html>
T.Y.B.Sc. Computer Science Roll No.
Output:-
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Practical No: 7
Practical Name:–
Developing Simple Web services in Java
Demonstrate a simple web service that generates a response based on information received from
the client.
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Program :-
package server;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService()
public class HelloWebService
{
@WebMethod(operationName = "sayHello")
public String sayHello(@WebParam(name = "name")String name)
{
return "Hello -" + name;
}
}
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Practical No: 8
Practical Name:–
Developing Advance Web services in Java.
Develop web service for calculator applications, to implement simple arithmetic
Operations. Use WSDL for these web services to show output.
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.
Program :-
package server;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService()
public class CalcWebService
{
@WebMethod(operationName = "add")
public int add(
@WebParam(name = "i")int i,
@WebParam(name = "j")int j)
{
return i+j;
}
}
T.Y.B.Sc. Computer Science Roll No.
T.Y.B.Sc. Computer Science Roll No.

Mais conteúdo relacionado

Mais procurados

Training & Placement Database Management System
Training & Placement Database Management SystemTraining & Placement Database Management System
Training & Placement Database Management SystemRohit Mate
 
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Edureka!
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...Nithin Kumar,VVCE, Mysuru
 
student application form Java Netbeans
student application form Java Netbeansstudent application form Java Netbeans
student application form Java Netbeansreshmajohney
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVAAnkita Totala
 
Java package
Java packageJava package
Java packageCS_GDRCST
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singhdheeraj_cse
 
Operating System Lab Project
Operating System Lab Project Operating System Lab Project
Operating System Lab Project Abdullah Shion
 
Wireless network security
Wireless network securityWireless network security
Wireless network securityVishal Agarwal
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaRahulAnanda1
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 

Mais procurados (20)

Training & Placement Database Management System
Training & Placement Database Management SystemTraining & Placement Database Management System
Training & Placement Database Management System
 
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
Java Training | Java Tutorial for Beginners | Java Programming | Java Certifi...
 
Project report
Project reportProject report
Project report
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
 
Java interface
Java interfaceJava interface
Java interface
 
student application form Java Netbeans
student application form Java Netbeansstudent application form Java Netbeans
student application form Java Netbeans
 
String in java
String in javaString in java
String in java
 
Cyber crime (2018 )updated
Cyber crime (2018 )updatedCyber crime (2018 )updated
Cyber crime (2018 )updated
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
Java package
Java packageJava package
Java package
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Operating System Lab Project
Operating System Lab Project Operating System Lab Project
Operating System Lab Project
 
Wireless network security
Wireless network securityWireless network security
Wireless network security
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
C# String
C# StringC# String
C# String
 
Database connectivity in python
Database connectivity in pythonDatabase connectivity in python
Database connectivity in python
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 

Destaque

Advanced Java - Praticals
Advanced Java - PraticalsAdvanced Java - Praticals
Advanced Java - PraticalsFahad Shaikh
 
Linux practicals T.Y.B.ScIT
Linux practicals T.Y.B.ScITLinux practicals T.Y.B.ScIT
Linux practicals T.Y.B.ScITvignesh0009
 
Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.Niraj Bharambe
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL fileRACHIT_GUPTA
 
Java Code for Sample Projects Inheritance
Java Code for Sample Projects InheritanceJava Code for Sample Projects Inheritance
Java Code for Sample Projects Inheritancejwjablonski
 
Unit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaUnit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaNiraj Bharambe
 
Htmlcolorcodes 150323101937-conversion-gate01
Htmlcolorcodes 150323101937-conversion-gate01Htmlcolorcodes 150323101937-conversion-gate01
Htmlcolorcodes 150323101937-conversion-gate01Niraj Bharambe
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)Niraj Bharambe
 

Destaque (20)

Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
Advanced Java - Praticals
Advanced Java - PraticalsAdvanced Java - Praticals
Advanced Java - Praticals
 
Java programming-examples
Java programming-examplesJava programming-examples
Java programming-examples
 
Java codes
Java codesJava codes
Java codes
 
Core java tutorial
Core java tutorialCore java tutorial
Core java tutorial
 
Linux practicals T.Y.B.ScIT
Linux practicals T.Y.B.ScITLinux practicals T.Y.B.ScIT
Linux practicals T.Y.B.ScIT
 
Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.Data Warehousing Practical for T.Y.I.T.
Data Warehousing Practical for T.Y.I.T.
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL file
 
Java Code for Sample Projects Inheritance
Java Code for Sample Projects InheritanceJava Code for Sample Projects Inheritance
Java Code for Sample Projects Inheritance
 
Unit 1st and 3rd notes of java
Unit 1st and 3rd notes of javaUnit 1st and 3rd notes of java
Unit 1st and 3rd notes of java
 
collisiondetection
collisiondetectioncollisiondetection
collisiondetection
 
Forouzan appendix
Forouzan appendixForouzan appendix
Forouzan appendix
 
Htmlcolorcodes 150323101937-conversion-gate01
Htmlcolorcodes 150323101937-conversion-gate01Htmlcolorcodes 150323101937-conversion-gate01
Htmlcolorcodes 150323101937-conversion-gate01
 
Java unit 4_cs_notes
Java unit 4_cs_notesJava unit 4_cs_notes
Java unit 4_cs_notes
 
J2 ee tutorial ejb
J2 ee tutorial ejbJ2 ee tutorial ejb
J2 ee tutorial ejb
 
Definition
DefinitionDefinition
Definition
 
Html color codes
Html color codesHtml color codes
Html color codes
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)
 
Java lab-manual
Java lab-manualJava lab-manual
Java lab-manual
 
Advance Java
Advance JavaAdvance Java
Advance Java
 

Semelhante a T.Y.B.Sc. Computer Science Practical Record

JavaServer Pages
JavaServer Pages JavaServer Pages
JavaServer Pages profbnk
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server PageVipin Yadav
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGESKalpana T
 
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes AhmedabadJava Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes AhmedabadNicheTech Com. Solutions Pvt. Ltd.
 
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp  - Giáo trình Bách Khoa AptechSession 5 : intro to jsp  - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp - Giáo trình Bách Khoa AptechMasterCode.vn
 
Jsp presentation
Jsp presentationJsp presentation
Jsp presentationLakshmi R
 
Understanding JSP -Servlets
Understanding JSP -ServletsUnderstanding JSP -Servlets
Understanding JSP -ServletsGagandeep Singh
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scalarostislav
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actionsAren Zomorodian
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsKaml Sah
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESYoga Raja
 

Semelhante a T.Y.B.Sc. Computer Science Practical Record (20)

JSP
JSPJSP
JSP
 
JavaServer Pages
JavaServer Pages JavaServer Pages
JavaServer Pages
 
Html To JSP
Html To JSPHtml To JSP
Html To JSP
 
JSP Error handling
JSP Error handlingJSP Error handling
JSP Error handling
 
JEE Programming - 05 JSP
JEE Programming - 05 JSPJEE Programming - 05 JSP
JEE Programming - 05 JSP
 
Jsp
JspJsp
Jsp
 
JSP - Java Server Page
JSP - Java Server PageJSP - Java Server Page
JSP - Java Server Page
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
JAVA SERVER PAGES
JAVA SERVER PAGESJAVA SERVER PAGES
JAVA SERVER PAGES
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Jsp
JspJsp
Jsp
 
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes AhmedabadJava Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
 
JavaServer Pages
JavaServer PagesJavaServer Pages
JavaServer Pages
 
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp  - Giáo trình Bách Khoa AptechSession 5 : intro to jsp  - Giáo trình Bách Khoa Aptech
Session 5 : intro to jsp - Giáo trình Bách Khoa Aptech
 
Jsp presentation
Jsp presentationJsp presentation
Jsp presentation
 
Understanding JSP -Servlets
Understanding JSP -ServletsUnderstanding JSP -Servlets
Understanding JSP -Servlets
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scala
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
 

Mais de Niraj Bharambe

T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityT.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityNiraj Bharambe
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01Niraj Bharambe
 
Htmlnotes 150323102005-conversion-gate01
Htmlnotes 150323102005-conversion-gate01Htmlnotes 150323102005-conversion-gate01
Htmlnotes 150323102005-conversion-gate01Niraj Bharambe
 
Sixth sense technology
Sixth sense technologySixth sense technology
Sixth sense technologyNiraj Bharambe
 

Mais de Niraj Bharambe (8)

Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
 
DCN Practical
DCN PracticalDCN Practical
DCN Practical
 
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityT.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01
 
Htmlnotes 150323102005-conversion-gate01
Htmlnotes 150323102005-conversion-gate01Htmlnotes 150323102005-conversion-gate01
Htmlnotes 150323102005-conversion-gate01
 
Sixth sense technology
Sixth sense technologySixth sense technology
Sixth sense technology
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Último (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

T.Y.B.Sc. Computer Science Practical Record

  • 1. T.Y.B.Sc. Computer Science Roll No. INDEX Practical No. Practical Name Page No. Date Remark Signature 1. Simple Server-Side Programming using Servlets . Where user can get the information about server. 01 to 03 05/12/2015 2. Advance Server-Side Programming using Servlets. Where user can get details of his created table in SQL. 04 to 08 12/12/2015 3. Simple Server-side programming using JSP for Login page where after login the page forwarded to new welcome page and if login details are wrong then page transferred to index page. 09 to 12 19/12/2015 4. Advance Server-side programming using JSP for login page where login details for user taken from database created in SQL. If user_id and password entered by user is wrong then page redirected to invalid page or else redirected to Home page. 13 to 20 02/01/2016 5. Developing Simple Enterprise Java Beans for addition of two numbers by taking inputs from user. 21 to 25 09/01/2016 6. Developing Advance Enterprise Java Beans. Where user is entering details of registration form in Registration.jsp file and the data entered by user should be stored in database. 26 to 29 23/01/2016 7. Developing Simple Web services in Java Demonstrate a simple web service that generates a response based on information received from the client. 30 to 34 06/02/2016 8. Developing Advance Web services in Java. Develop web service for calculator applications, to implement simple arithmetic Operations. Use WSDL for these web services to show output. 35 to 39 13/02/2016
  • 2. T.Y.B.Sc. Computer Science Roll No. Practical No: 1 Practical Name :– Simple Server-Side Programming using Servlets. Where user can get the information about server. Index.jsp :- <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form action="serverinfo" method="post"> <input type="submit" value="submit"> </form> </body> </html>
  • 3. T.Y.B.Sc. Computer Science Roll No. Serverinfo.java :- 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; public class extends HttpServlet { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { out.println("<html>"); out.println("<head>"); out.println("<h3>Server Info:<h3>"); out.println("Server Name:"+request.getServerName()+"<br><br>"); out.println("Server Port:"+request.getServerPort()+"<br><br>"); out.println("Client Browser:"+request.getHeader("User Agent")+"<br><br>"); out.println("Server Referer:"+request.getHeader("Referer")+"<br><br>"); out.println("Client IP:"+request.getRemoteAddr()+"<br><br>"); out.println("Server OS Version:"+System.getProperty("os.version")+"<br><br>"); out.println("</head>"); out.println("<body>"); out.println("</body>"); out.println("</html>"); } finally { out.close(); } } }
  • 4. T.Y.B.Sc. Computer Science Roll No. Output :-
  • 5. T.Y.B.Sc. Computer Science Roll No. Practical No: 2 Practical Name :– Advance Server-Side Programming using Servlets. Where user can get details of his created table in SQL. Index.jsp :- <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form action="dataconnection1" method="POST"> <input type="submit" value="submit"> </form> </body> </html>
  • 6. T.Y.B.Sc. Computer Science Roll No. Dataconnection1.java :- import java.io.IOException; import java.io.PrintWriter; import java.sql.*; import javax.sql.*; import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "dataconnection1", urlPatterns = {"/dataconnection1"}) public class dataconnection1 extends HttpServlet implements Servlet { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); out.println("connectivity begins"); Connection cn; Statement st; ResultSet rs; cn=DriverManager.getConnection("jdbc:odbc:ServletDSN","system","dbms"); out.println("cooncted successfully"); st=cn.createStatement(); st.executeUpdate("create table Aut1(AuId Number,AuName Char(15),AuAddr Char(30))"); out.println("Table Created"); st.executeUpdate("insert into Aut1 values(1,'ABC','Panvel')"); st.executeUpdate("insert into Aut1 values(2,'XYZ','Pune')"); out.println("Records inserted into table"); rs=st.executeQuery("select * from Aut1"); out.println("AuId &nbsp &nbsp AuName &nbsp &nbsp AuAddr <br>");
  • 7. T.Y.B.Sc. Computer Science Roll No. while(rs.next()) { out.println(rs.getInt(1)+"&nbsp &nbsp &nbsp"); out.println(rs.getString(2)+"&nbsp &nbsp &nbsp"); out.println(rs.getString(3)+"&nbsp &nbsp &nbsp"); st.close(); } rs.close(); cn.close(); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet dataconnection1</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet dataconnection1 at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } catch(Exception e1) { System.out.println("Failed"); } finally { out.close(); } } }
  • 8. T.Y.B.Sc. Computer Science Roll No. Output:-
  • 10. T.Y.B.Sc. Computer Science Roll No. Practical No: 3 Practical Name:– Simple Server-side programming using JSP for Login page where after login the page forwarded to new welcome page and if login details are wrong then page transferred to index page. Index.jsp :- <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form method="post" action="login1.jsp"> username<input type="text" name="txtname" size="20"><br> password<input type="password" name="pwd" size="20"><br> <input type="submit" value="Login"> </form> </body> </html>
  • 11. T.Y.B.Sc. Computer Science Roll No. Login1.jsp :- <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <%if((request.getParameter("txtname").equals("yogita"))&&(request.getParameter("pwd").equal s("vyom"))){%> <jsp:forward page="welcome.jsp"></jsp:forward> <%} else{ out.println("Enter correct details");%> <jsp:include page="index.jsp"></jsp:include> <%}%> </body> </html>
  • 12. T.Y.B.Sc. Computer Science Roll No. Login1.jsp :- <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Hello World!</h1> </body> </html>
  • 13. T.Y.B.Sc. Computer Science Roll No. Output:-
  • 15. T.Y.B.Sc. Computer Science Roll No. Practical No: 4 Practical Name:– Advance Server-side programming using JSP for login page where login details for user taken from database created in SQL. If user_id and password entered by user is wrong then page redirected to invalid page or else redirected to Home page. Index.jsp :- <%-- Document : index Created on : Mar 8, 2016, 10:54:04 AM Author : computerlab --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form action="TLogin.jsp" method="post"> <table bgcolor="yellow"> <tr><td>User Name:<input type="text" name="userid" size="15"></td></tr> <tr><td>Password:<input type="password" name="pwd" size="15"></td></tr> <tr><td colspan="2" align="center"><input type="submit" name="submit" size="10"></td></tr> </table> </form> </body> </html>
  • 16. T.Y.B.Sc. Computer Science Roll No. TLogin.jsp :- <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*"%> <%@page import="javax.sql.*"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% Connection con; String userid=request.getParameter("userid"); out.println("hellow"+userid); session.setAttribute("userid",userid); String pwd=request.getParameter("pwd"); Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","root"); out.println("connected successfully"); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from student where userid='"+userid+"'"); if(rs.next()) { if(rs.getString(2).equals(pwd)) { //System.out.println("Login sucessfully"); response.sendRedirect("Home.jsp"); } else { response.sendRedirect("Invalid.jsp"); } } %> </body> </html>
  • 17. T.Y.B.Sc. Computer Science Roll No. Invalid.jsp :- <%-- Document : Invalid Created on : Mar 8, 2016, 10:56:04 AM Author : computerlab --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <body bgcolor="pink"> <h1>Invalid User ID or Password<%=session.getAttribute("userid")%>!!!</h1> </body> </html>
  • 18. T.Y.B.Sc. Computer Science Roll No. Home.jsp :- <%-- Document : Home Created on : Feb 23, 2016, 9:06:59 AM Author : computerlab --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <body bgcolor="pink"> <h1>Welcome<%=session.getAttribute("userid")%>!!!</h1> </body> </html>
  • 19. T.Y.B.Sc. Computer Science Roll No. Output:-
  • 23. T.Y.B.Sc. Computer Science Roll No. Practical No: 5 Practical Name:– Developing Simple Enterprise Java Beans for addition of two numbers by taking inputs from user. Index.jsp :- <%-- Document : index Created on : Feb 12, 2016, 9:08:58 AM Author : computelab --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form method="post" action="calcservlet"> <input type="text" name="t1"> <input type="text" name="t2"> <input type="submit" value="OK"> </form> </body> </html>
  • 24. T.Y.B.Sc. Computer Science Roll No. calcservlet.java :- import ejb.calbeanLocal; 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; public class calcservlet extends HttpServlet { calbeanLocal calbean=new calbeanLocal(); protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { out.println("<html>"); out.println("<head>"); out.println("<title>Servlet calcservlet</title>"); out.println("</head>"); out.println("<body>"); int a=Integer.parseInt(request.getParameter("t1")); int b=Integer.parseInt(request.getParameter("t2")); out.println("<h1>Sum ="+calbean.addition(a,b)+" </h1>"); out.println("</body>"); out.println("</html>"); } finally { out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP * <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs
  • 25. T.Y.B.Sc. Computer Science Roll No. * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP * <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
  • 26. T.Y.B.Sc. Computer Science Roll No. calbeanLocal.java :- package ejb; import javax.ejb.LocalBean; import javax.ejb.Stateless; @Stateless @LocalBean public class calbeanLocal { public Integer addition(int a, int b) { return (a+b); } }
  • 27. T.Y.B.Sc. Computer Science Roll No. Output:-
  • 28. T.Y.B.Sc. Computer Science Roll No. Practical No: 6 Practical Name:– Developing Advance Enterprise Java Beans. Where user is entering details of registration form in Registration.jsp file and the data entered by user should be stored in database. Index.jsp: <%-- Document : index Created on : Mar 2, 2016, 12:10:46 PM Author : computerlab --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form action="Registeration1.jsp" method="post"> User Name: <input type="text" name="un"><br/> Password: <input type="text" name="tp"><br/> First Name: <input type="text" name="fn"><br/> Last Name: <input type="text" name="ln"><br/> Email: <input type="text" name="e"><br/> <input type="submit" value="Register"><br/> </form> </body> </html> <%--
  • 29. T.Y.B.Sc. Computer Science Roll No. Registeration1.jsp:- Created on : Aug 31, 2015, 9:41:20 AM Author : computerlab --%> <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.Connection"%> <%@page import="java.sql.PreparedStatement"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% String user_name=request.getParameter("un"); String pswd=request.getParameter("tp"); String first_name=request.getParameter("fn"); String last_name=request.getParameter("ln"); String email=request.getParameter("e"); try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/reg1","root","root"); PreparedStatement ps = con.prepareStatement("insert into new_table values(?,?,?,?,?)"); ps.setString(1, user_name); ps.setString(2, pswd); ps.setString(3, first_name); ps.setString(4, last_name); ps.setString(5, email); ps.executeUpdate(); out.println("Successful Registration"); } catch(Exception e) { out.println("Exception caught"+e); } %> </body> </html>
  • 30. T.Y.B.Sc. Computer Science Roll No. Output:-
  • 32. T.Y.B.Sc. Computer Science Roll No. Practical No: 7 Practical Name:– Developing Simple Web services in Java Demonstrate a simple web service that generates a response based on information received from the client.
  • 34. T.Y.B.Sc. Computer Science Roll No. Program :- package server; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; @WebService() public class HelloWebService { @WebMethod(operationName = "sayHello") public String sayHello(@WebParam(name = "name")String name) { return "Hello -" + name; } }
  • 37. T.Y.B.Sc. Computer Science Roll No. Practical No: 8 Practical Name:– Developing Advance Web services in Java. Develop web service for calculator applications, to implement simple arithmetic Operations. Use WSDL for these web services to show output.
  • 39. T.Y.B.Sc. Computer Science Roll No. Program :- package server; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; @WebService() public class CalcWebService { @WebMethod(operationName = "add") public int add( @WebParam(name = "i")int i, @WebParam(name = "j")int j) { return i+j; } }