SREE CHAITANYA COLLEGE OF ENGINEERING

Size: px
Start display at page:

Download "SREE CHAITANYA COLLEGE OF ENGINEERING"

Transcription

1 SREE CHAITANYA COLLEGE OF ENGINEERING COMPUTER SCIENCE & ENGINEERING WT LAB MANUAL ( R13 REGULATION) 1. Install the following on the local machine a. Apache Web Server b. Tomcat Application Server locally c. Install MySQL d. Install PHP and configure it to work with Apache web server and MySQL 2. Write an HTML page including any required Javascript that takes a number from one text field in the range of 0 to 999 and shows it in another text field in words. If the number is out of range, it should show out of range and if it is not a number, it should show not a number message in the result box. CODE: <head> <title> WT Lab manual program no. 1 </title> </head> <form name="myform"> <center> <h1> WT Lab manual program no. 1 </h1> Enter a number <input type="text" name="tfield1" title="0 to 999" id="tfield1" /><br><br> <input type="button" value="click Here! " onclick="myfunction()"> <br><br> Display Field <input type="text" id="tfield2" name="tfield2" readonly="true"> </form> <script> function myfunction() Var inwords = ["zero","one","two","three","four","five","six","seven","eight","nine"]; var a=document.getelementbyid("tfield1").value; var sp=a.split(''); var nlength=a.tostring().length; document.getelementbyid("tfield2").value=null; if(isnan(a)) //window.alert("not a number"); //document.write("not a Number"); document.getelementbyid("tfield2").value="not a number";

2 </script> else if(a>999 a<0) //document.write("out of range"); //window.alert("out of range"); document.getelementbyid("tfield2").value="out of range"; else var i=0; var b=sp[i]; var c=sp[i+1]; var d=sp[i+2]; if(nlength==1) document.getelementbyid("tfield2").value=inwords[b]; else if(nlength==2) document.getelementbyid("tfield2").value=inwords[b]+" "+inwords[c]; else if(nlength==3) document.getelementbyid("tfield2").value=inwords[b]+" "+inwords[c]+" "+inwords[d]; OUTPUT: CASE 1:

3 CASE 2: CASE 3:

4 3. Write an HTML page that has one input, which can take multi line text and submit button. Once the user clicks on submit button, it should show number of characters, words and lines in the text entered using an alert message. Words are separated with white spaces and lines are separated with new line character. CODE: <head> <title>wt Lab manual program no. 2</title> </head> <form name="myform2"> <center> <h1> WT Lab manual program no. 2 </h1> Enter a multi-line text: <textarea cols="50" rows="5" name="tfiled1" title="enter multi-line text" id="tfield1"></textarea><br /><br /> <input type="button" value="click Here!" onclick="myfunction()" /> </form> <script> function myfunction() var text=document.getelementbyid("tfield1").value; var tlength=text.tostring().length; var sp=text.split(''); var wordcount=0; for(var i=0; i<tlength;i++) if(sp[i]==" " sp[i]=="\n") wordcount++; if(i!=0) wordcount++; var lines=0; for(var j=0; j<tlength;j++) if(sp[j]=="\n") lines++; if(j!=0) lines++; window.alert("number of characters in text are: "+tlength+"\n"+"number of words in text are: "+wordcount+"\n"+"number of lines in text are: "+lines); </script>

5 OUTPUT:

6 4. Write an HTML page that contains a selection box with a list of 5 countries. When the user selects a country, its capital should be printed next in the list. Add CSS to customize the properties of the font of the capital (color, bold and font size). CODE: <head> <title>wt Lab manual program no. 3</title> </head> <style> h1 color: orange; text-align: center;.textbox1 color: orange; font-size: 20px; font-weight: bold; </style> <center> <h1> WT Lab manual program no. 3 </h1> <form name="myform"> Select Country <select name="country" id="sbox1" onclick="myfunction()" required> <option value=""></option> <option value="delhi">india</option> <option value="canberra">australia</option> <option value="washington D.C">AMERICA</option> <option value="london">unitedkingdom</option> <option value="berlin">germany</option> </select><br><br> Capital <input type="text" class="textbox1" id="sbox2"> </form> <script> function myfunction() var a=document.getelementbyid("sbox1").value; document.getelementbyid("sbox2").value=a;

7 </script> OUTPUT:

8 5. Create an XML document that contains 10 users information. Write a Java Program, which takes User Id as input and returns the user details by taking the user information from XML document using (a) DOM parser and (b) SAX parser. CODE: users.xml <usersinformation> <user> <rollno>501</rollno> <name>aaa</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>502</rollno> <name>bbb</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>503</rollno> <name>ccc</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>504</rollno> <name>ddd</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>505</rollno> <name>eee</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>506</rollno> <name>fff</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>507</rollno> <name>ggg</name> <branch>cse</branch> <college>scce</college> </user>

9 <user> <rollno>508</rollno> <name>hhh</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>509</rollno> <name>iii</name> <branch>cse</branch> <college>scce</college> </user> <user> <rollno>510</rollno> <name>jjj</name> <branch>cse</branch> <college>scce</college> </user> </usersinformation> Wt5dom.java import java.io.file; import javax.xml.parsers.*; import org.w3c.dom.*; import java.util.scanner; public class Wt5dom public static void main(string args[]) throws Exception DocumentBuilderFactory fac=documentbuilderfactory.newinstance(); DocumentBuilder b=fac.newdocumentbuilder(); Document doc=b.parse(new File("users.xml")); doc.getdocumentelement().normalize(); Element root=doc.getdocumentelement(); Scanner in=new Scanner(System.in); System.out.println("Enter User ID:"); int n=in.nextint(); int flag=0; NodeList nl=doc.getelementsbytagname("user"); for(int i=0;i<nl.getlength();i++)

10 Node node=nl.item(i); if(node.getnodetype()==node.element_node) Element e=(element)node; int x=integer.parseint(e.getelementsbytagname("rollno").item(0).gettextcontent()); if(x==n) System.out.println(root.getNodeName()); System.out.println(" "); System.out.println("rollno:\t"+e.getElementsByTagName("rollno").item(0).getTextContent()); System.out.println("name:\t"+e.getElementsByTagName("name").item(0).getTextContent()); System.out.println("branch:\t"+e.getElementsByTagName("branch").item(0).getTextContent()); System.out.println("college:"+e.getElementsByTagName("college").item(0).getTextContent()); OUTPUT: else flag=1; break; flag=0; if(flag==0) System.out.println("User not available");

11 6. Implement the following web applications using (a) PHP, (b) Servlets and (c) JSP. 6 (i) (a). A user validation web application, where the user submits the login name and password to the server. The name and password are checked against the data already available in Database and if the data matches, a successful login page is returned. Otherwise failure message is shown to the user. CODE: db.php <?php $severname="localhost"; $username="root"; $password=""; USING PHP $conn=new mysqli($severname,$username,$password); if($conn->connect_error) die("connection failed".$conn->connect_error); echo "Connected successfully <br>"; //Create database $sql = "CREATE DATABASE reg"; if(mysqli_query($conn,$sql)) echo "Database created successfully<br>"; else echo "error"; $servername="localhost"; $dbname="reg"; $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) die("connection failed: ". mysqli_connect_error()); echo "Connected successfully <br>"; // sql to create table $sql = "CREATE TABLE Guests ( name VARCHAR(30) NOT NULL, pwd VARCHAR(30) NOT NULL)"; if (mysqli_query($conn, $sql)) echo "Table MyGuests created successfully<br>"; else echo "Error creating table: ". mysqli_error($conn);

12 $sql = "INSERT INTO Guests (name, pwd) VALUES ('cse', '5')";?> if (mysqli_query($conn, $sql)) echo "New record created successfully"; else echo "Error: ". $sql. "<br>". mysqli_error($conn); mysqli_close($conn); OUTPUT OF db.php: Login6i.html <head> <title> Login Page </title> <center> <h1> Login Page </h1> <form action="loginform.php" method="post"> <table> <tr> <td> <label> Name: </label> </td> <td> <input type="text" name="uname" /> </td> </tr> <tr> <td> <label> Password: </label> </td> <td> <input type="password" name="upwd" /> </td> </tr> <tr> <td> <input type="submit" value="submit" /> </td> <td> <input type="reset" value="reset" /> </td> </tr> </table> </form>

13 loginform.php <head> <title> Registration page </title> </head> <?php $name=$_post["uname"]; $pwd=$_post["upwd"]; $conn=mysql_connect("localhost","root","") or die("mysql_error()"); mysql_select_db("reg") or die("mysql_error()"); $query=mysql_query("select * from guests where name='$name'");?> while($row=mysql_fetch_array($query)) $duser=$row['name']; $dpwd=$row['pwd']; if($pwd==$dpwd && $name==$duser) echo "welcome $name branch"; else echo "invalid user"; OUTPUT:

14 6 (ii) (a). Modify the above program to use an xml instead of database CODE: login6ii.html <htm`l> <head> <title> Login Page </title> <center> <h1> Login Page </h1> <form action="loginform6ii.php" method="post"> <table> <tr> <td> <label> Name: </label> </td> <td> <input type="text" name="uname" /> </td> </tr> <tr> <td> <label> Password: </label> </td> <td> <input type="password" name="upwd" /> </td> </tr> <tr> <td> <input type="submit" value="submit" /> </td> <td> <input type="reset" value="reset" /> </td> </tr> </table> </form> Userlogin.xml <Authentication> <user> <username>cse</username> <password>5</password> </user> <user> <username>eee</username> <password>2</password> </user> </Authentication> loginform6ii.php <head> <title> Registration page 6ii </title> </head> <?php $myxml=simplexml_load_file("userlogin6ii.xml"); $username=$_post['uname']; $password=$_post['upwd']; $xmlusername=""; $xmlpassword="";

15 for($i=0;$i<count($myxml);$i++) $xmlusername=$myxml->user[$i]->username; $xmlpassword=$myxml->user[$i]->password; if($xmlusername==$username && $xmlpassword==$password) echo "welcome $username"; die(); echo "Invalid username or password";?> OUTPUT:

16 6 (iii) a. Modify the above program to use AJAX to show the result on the same page below the submit button. <head> <script type="text/javascript"> var xmlhttp; function ajaxfunction() xmlhttp=getxmlhttpobject(); xmlhttp.open("get","time.jsp",true); xmlhttp.send(null); xmlhttp.onreadystatechange=function() if(xmlhttp.readystate==4 && xmlhttp.status==200) document.myform.time.value=xmlhttp.responsetext; function GetXmlHttpObject() var xmlhttp=null; if(window.xmlhttprequest) xmlhttp=new XMLHttpRequest(); if(window.activexobject) xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); return xmlhttp; </script> </head> <center> <form name="myform"> Name:<input type="text" name="username" onkeyup='ajaxfunction()'/><br><br> <input type="submit" value="submit"><br><br> Time: <input type="text" name="time"/> </form> OUTPUT:

17 6 (iv) (a). A simple calculator web application that takes two numbers and an operator (+,-,/,* and %) from an HTML page and returns the result page with the operation performed on the operands. CODE: USING PHP Cal6iv.html <head> <title> Calculator </title> </head> <center> <h1> BASIC CALCULATOR </h1> <form action="cal6iv.php" method="post"> <input type="text" name="v1" placeholder="enter a value"> <input type="text" name="v2" placeholder="enter a value"><br><br> <input type="submit" value="+" name="add"> <input type="submit" value="-" name="sub"> <input type="submit" value="*" name="mul"> <input type="submit" value="/" name="div"> <input type="submit" value="%" name="mod"> </form> Cal6iv.php <head> <title> Result </title> </head> <center> <?php $x=$_post['v1']; $y=$_post['v2']; if(isset($_post['add'])) echo "<h1> The result is ",$x+$y,"</h1>"; else if(isset($_post['sub'])) echo "<h1> The result is ",$x-$y,"</h1>"; else if(isset($_post['mul'])) echo "<h1> The result is ",$x*$y,"</h1>"; else if(isset($_post['div']))

18 echo "<h1> The result is ",$x/$y,"</h1>"; else if(isset($_post['mod'])) echo "<h1> The result is ",$x%$y,"</h1>";?> OUTPUT:

19 6 (v) (a). Modify the above program such that it stores each query in a database and checks the database first for the result. If the query is already available in DB, it returns the value that was previously computed (from DB) or it computes the result and returns it after storing the new query and result in DB. CODE: USING PHP db6v.php <?php $severname="localhost"; $username="root"; $password=""; $conn=new mysqli($severname,$username,$password); if($conn->connect_error) die("connection failed".$conn->connect_error); echo "Connected successfully <br>"; //Create database $sql = "CREATE DATABASE calc_data"; if(mysqli_query($conn,$sql)) echo "Database created successfully<br>"; else echo "error"; $servername="localhost"; $dbname="calc_data"; $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) die("connection failed: ". mysqli_connect_error()); echo "Connected successfully <br>"; // sql to create table $sql = "CREATE TABLE calc_queires ( v1 VARCHAR(30) NOT NULL,v2 VARCHAR(30) NOT NULL,oper VARCHAR(3), res VARCHAR(30) )"; if (mysqli_query($conn, $sql)) echo "Table MyGuests created successfully<br>"; else echo "Error creating table: ". mysqli_error($conn);

20 $sql = "INSERT INTO calc_queires (v1,v2,oper,res) VALUES ('3','3','+','6')"; if (mysqli_query($conn, $sql)) echo "New record created successfully"; else echo "Error: ". $sql."<br>". mysqli_error($conn); mysqli_close($conn);?> OUTPUT OF db6v.php: cal6v.html <head> <title> Calculator </title> </head> <center> <h1> BASIC CALCULATOR </h1> <form action="cal6v.php" method="post"> <input type="text" name="v1" placeholder="enter a value"> <input type="text" name="v2" placeholder="enter a value"><br><br> <input type="submit" value="+" name="add"> <input type="submit" value="-" name="sub"> <input type="submit" value="*" name="mul"> <input type="submit" value="/" name="div"> <input type="submit" value="%" name="mod"> </form> cal6v.php <head> <title> Result </title> </head>

21 <center> <?php $x=$_post['v1']; $y=$_post['v2']; if(isset($_post['add'])) $op='+'; $res=$x+$y; else if(isset($_post['sub'])) $op='-'; $res=$x-$y; else if(isset($_post['mul'])) $op='*'; $res=$x*$y; else if(isset($_post['div'])) $op='/'; $res=$x/$y; else if(isset($_post['mod'])) $op='%'; $res=$x%$y; $dbc=mysql_connect("localhost","root","") or die("mysql_error()"); mysql_select_db("calc_data") or die("mysql_error()"); $query=mysql_query("select * from calc_queires where v1='$x' and v2='$y' and oper='$op'"); while($row=mysql_fetch_assoc($query)) $val1=$row['v1']; $val2=$row['v2']; $oper=$row['oper']; $result=$row['res']; if($val1==$x && $val2==$y && $op==$oper) echo "<h1> The result is ",$result,"</h1>"; else $write=mysql_query("insert INTO calc_queries (v1,v2,oper,res) VALUES

22 ('$x','$y','$op','$res')"); echo "</h1> The result is",$res,"</h1>";?> OUTPUT:

23 6 (vi) (a). A web application that takes a name as input and on submit it shows a hello <name> page where name is taken from the request. It shows the start time at the right top corner of the page and provides a logout button. On clicking this button, it should show a logout page with Thank You <name > message with the duration of usage (hint: Use session to store name and time). USING PHP CODE: session.html <head> <title> SESSION LOGIN </title> </head> <center> <form action="sessionlogin.php" method="post"> Enter Name: <input type="text" name="uname"> <br> <input type="submit" value="login" name="register"> </form> sessionlogin.html <head> <title> Result </title> </head> <center> <?php session_start(); $name=$_post['uname'];; $_SESSION['uname']=$name; $time=time(); echo "<p align='right'> $time </p>"; echo "Hello"." ".$name." "."You are logged in"; $_SESSION['time']=time();?> <form action="sessionlogout.php" method="post"> <input type="submit" value="logout" name="log"> </form>

24 sessionlogin.html <head> <title> Result </title> </head> <center> <?php session_start(); $nowsince=time()-$_session['time']; $name=$_session['uname']; echo "<h1> Thank you $name </h1>"."the duration of your session is"," ",$nowsince." "."seconds"; session_destroy();?> OUTPUT:

25 6 (vii) (a). A web application that takes name and age from an HTML page. If the age is less than 18, it should send a page with Hello <name>, you are not authorized to visit the site message, where <name> should be replaced with the entered name. Otherwise it should send Welcome <name> to this site message. CODE: usereligible.html USING PHP <head> <title> User Acess </title> </head> <br> <center> <h1> USER ELIGIBILITY </h1> <form action="eligibilitycheck.php" method="post"> <input type="text" name="uname" placeholder="enter your name"> <br> <input type="text" name="uage" placeholder="enter your age"> <br> <input type="submit" vvalue="submit" name="sub"<> </form> eligibilitycheck.php <head> <title> Result </title> </head> <center> <?php $age=$_post['uage']; $name=$_post['uname']; if($age<=18) echo "<h1>hello"." ".$name." "."you are not authorized to this site</h1>"; else echo "<h1> welcome".$name."to this site</h1>";?>

26 OUTPUT:

27 6 (viii) a. A web application for implementation: The user is first served a login page which takes user s name and password. After submitting the details the server checks these values against the data from a database and takes the following decisions If name and password matches, serves a welcome page with user s full name. If name matches and password doesn t match, then serves password mismatch page. If name is not found in the database, serves a registration page, where user s full name is asked and on submitting the full name, it stores, the login name, password and full name in database (hint: use session for storing the submitted login name and password) USING PHP CODE: Db.php <?php $severname="localhost"; $username="root"; $password=""; $conn=new mysqli($severname,$username,$password); if($conn->connect_error) die("connection failed".$conn->connect_error); echo "Connected successfully <br>"; //Create database $sql = "CREATE DATABASE reg6viii"; if(mysqli_query($conn,$sql)) echo "Database created successfully<br>"; else echo "error";

28 $servername="localhost"; $dbname="reg6viii"; $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) die("connection failed: ". mysqli_connect_error()); echo "Connected successfully <br>"; // sql to create table $sql = "CREATE TABLE Guests ( name VARCHAR(30) NOT NULL, pwd VARCHAR(30) NOT NULL, fname VARCHAR(50) NOT NULL)"; if (mysqli_query($conn, $sql)) echo "Table MyGuests created successfully<br>"; else echo "Error creating table: ". mysqli_error($conn); $sql = "INSERT INTO Guests (name, pwd, fname) VALUES ('cse', '5','compuer science and engineering')";?> if (mysqli_query($conn, $sql)) echo "New record created successfully"; else echo "Error: ". $sql. "<br>". mysqli_error($conn); mysqli_close($conn); Login6viiia.html <head> <title> User Acess </title> </head> <br> <center> <h1> LOGIN PAGE </h1> <form action="login6viiia.php" method="post"> <input type="text" name="uname" placeholder="enter your name"> <br> <input type="password" name="pass" placeholder="enter your age"> <br> <input type="submit" value="login" name="login">

29 </form> Login6viiia.php <head> <title> Result </title> </head> <center> <?php $name=$_post['uname']; $pwd=$_post['pass']; $dbc=mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("reg6viii") or die(mysql_error()); $query=mysql_query("select * from guests where name='$name'"); while($row=mysql_fetch_assoc($query)) $dbuser=$row['name']; $dbpwd=$row['pwd']; $dbfull=$row['fname']; if($name==$dbuser && $pwd==$dbpwd) echo "Welcome\t<h1>",$dbfull,"</h1>\tyou are successfully logged in "; else echo "<h1> User doesn't exist </h1>"."<a href='reg6viiia.html'> Click here to register </a>";?>

30 reg6viiia.html <head> <title> User Acess </title> </head> <br> <center> <h1> REGISTRATION PAGE </h1> <form action="reg6viiia.php" method="post"> User Name:<input type="text" name="uname" placeholder="enter your name"> <br> Password:<input type="password" name="pass"> <br> Full Name:<input type="text" name="fname" placeholder="enter your name"> <br> <input type="submit" value="register" name="register"> </form> reg6viiia.php <head> <title> Result </title> </head> <center> <?php $name=$_post['uname']; $pwd=$_post['pass']; $fname=$_post['fname']; $dbc=mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("reg6viii") or die(mysql_error()); $write=mysql_query("insert into guests values ('$name','$pwd','$fname')"); if(isset($write)) echo "<h1> You are registered successfully</h1>"."<a href='login6viiia.html'> Click here to login</a>";?>

31 OUTPUT: CASE 1: CASE 2:

32

33 6(ix) a. A web application that lists all cookies stored in the browser on clicking List Cookies button. Add cookies if necessary. USING PHP Cookieset.php <head> <title> User Acess </title> </head> <br> <center> <?php $exp=time()+86400; setcookie("cse LAB","FIRST FLOOR",$exp); setcookie("mca LAB","GROUND FLOOR",$exp); setcookie(("ece LAB","SECOND FLOOR",$exp);?> Cookie.php <head> <title> Cookie </title> </head> <center> <form action="" method="post"> <input type="submit" value="list COOKIES" name="list"> </form> <?php error_reporting(0); if($_post['list']) foreach($_cookie as $key=>$val) echo "<center>".$key."is at".$val."in SCCE <br> ";?> OUTPUT:

34 6. Implement the following web applications using (a) PHP, (b) Servlets and (c) JSP. 6 (i) (b). A user validation web application, where the user submits the login name and password to the server. The name and password are checked against the data already available in Database and if the data matches, a successful login page is returned. Otherwise failure message is shown to the user. NOTE: The following Servlets and JSP programs used MS Access database USING SERVLET CODE: login6ib.html <form method="post" action="log"> <center> <table> <tr> <td> username: </td> <td> <input type="text" name="uname"> </td> </tr> <tr> <td> password </td> <td> <input type="password" name="pwd"> </td> </tr> <tr> <td></td> <td> <input type="submit" value="login"> <input type="reset" value="reset"> </td> </tr> </table> </form> Loginservlet6ib.java import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.io.*; public class LoginServlet6ib extends HttpServlet public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException

35 process(req,res); public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException process(req,res); public void process(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException try String un=req.getparameter("uname"); String pass=req.getparameter("pwd"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=drivermanager.getconnection("jdbc:odbc:scce"); Statement st=con.createstatement(); ResultSet rs=st.executequery("select * FROM guests1"); res.setcontenttype("text/html"); PrintWriter pw=res.getwriter(); pw.println(); String dbun,dbpwd; while(rs.next()) dbun = rs.getstring(2); dbpwd = rs.getstring(3); if(dbun.equals(un) && dbpwd.equals(pass)) pw.println("<h1> Hi "+un+"..successfully logged in</h1>"); break; else if(dbun.equals(un)) pw.println("<h1> Invalid password</h1>"); break; else if(dbpwd.equals(pass)) pw.println("<h1> Invalid username</h1>"); break; catch(exception e) e.printstacktrace();

36 web.xml <?xml version="1.0"?> <web-app> <servlet> <servlet-name>hello1</servlet-name> <servlet-class>loginservlet6ib</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello1</servlet-name> <url-pattern>/log</url-pattern> </servlet-mapping> </web-app> OUTPUT:

37 6 (ii) (b). Modify the above program to use an xml instead of database USING SERVLETS Login6iib.html <center> <form method="post" action="init1"> <table> <tr> <td> username: </td> <td> <input type="text" name="uname"> </td> </tr> <tr> <td> password </td> <td> <input type="password" name="pwd"> </td> </tr> <tr> <td></td> <td> <input type="submit" value="login"> <input type="reset" value="reset"> </td> </tr> </table> </form> InitParamServlet6iib.java import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.io.*; public class InitParamServlet6iib extends HttpServlet String u,p; public void init(servletconfig config) throws ServletException u=config.getinitparameter("un"); p=config.getinitparameter("pwd"); public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException String un=req.getparameter("uname");

38 web.xml String pass=req.getparameter("pwd"); res.setcontenttype("text/html"); PrintWriter out=res.getwriter(); if(u.equals(un) && p.equals(pass)) out.println("<h1> Hi "+un+" Successfully logged in"); else out.println("<h1> Hi "+un+" Invalid username or password"); <?xml version="1.0"?> <web-app> <servlet> <servlet-name>hello2</servlet-name> <servlet-class>initparamservlet6iib</servlet-class> <init-param> <param-name> un </param-name> <param-value> cse </param-name> </init-param> <init-param> <param-name> pwd </param-name> <param-value> 5 </param-name> </init-param> </servlet> </web-app> Output <servlet-mapping> <servlet-name>hello2</servlet-name> <url-pattern>/init1</url-pattern> </servlet-mapping>

39 6 (iv) (b). A simple calculator web application that takes two numbers and an operator (+,-,/,* and %) from an HTML page and returns the result page with the operation performed on the operands. CODE: USING SERVLET Cal6ivb.html <head> <title> Calculator </title> </head> <center> <h1> BASIC CALCULATOR </h1> <form action="calc" method="post"> <input type="text" name="v1" placeholder="enter a value"> <input type="text" name="v2" placeholder="enter a value"><br><br> <input type="radio" value="+" name="add"> <input type="radio" value="-" name="sub"> <input type="radio" value="*" name="mul"> <input type="radio" value="/" name="div"> <input type="radio" value="%" name="mod"> </form> CalcServlet6ivb.java import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.io.*; public class CalcServlet6ivb extends HttpServlet public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException process(req,res); public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException process(req,res); public void process(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException res.setcontenttype("text/html"); try

40 PrintWriter out=res.getwriter(); int n01,n02; String op; int result=0; n01=integer.parseint(req.getparameter("v1")); n02=integer.parseint(req.getparameter("v2")); op=req.getparameter("add"); if(op.equals("+")) result=n01+n02; if(op.equals("-")) result=n01-n02; if(op.equals("*")) result=n01*n02; if(op.equals("/")) result=n01/n02; if(op.equals("%")) result=n01%n02; out.println("<h1> Result= "+result+"</h1>"); catch(exception e) e.printstacktrace(); web.xml <?xml version="1.0"?> <web-app> <servlet> <servlet-name>calulatoriv</servlet-name> <servlet-class>calcservlet6ivb</servlet-class> </servlet> <servlet-mapping> <servlet-name>calulatoriv</servlet-name> <url-pattern>/calc</url-pattern> </servlet-mapping> </web-app>

41 OUTPUT:

42 6 (v) (b). Modify the above program such that it stores each query in a database and checks the database first for the result. If the query is already available in DB, it returns the value that was previously computed (from DB) or it computes the result and returns it after storing the new query and result in DB. CODE: cal6vb.html USING SERVLET <head> <title> Calculator </title> </head> <center> <h1> BASIC CALCULATOR </h1> <form action="calcdb" method="post"> <input type="text" name="v1" placeholder="enter a value"> <input type="text" name="v2" placeholder="enter a value"><br><br> <input type="submit" value="+" name="add"> <input type="submit" value="-" name="sub"> <input type="submit" value="*" name="mul"> <input type="submit" value="/" name="div"> <input type="submit" value="%" name="mod"> </form> CalcDbServlet6vb.java import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.io.*; public class CalcDbServlet6vb extends HttpServlet public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException try res.setcontenttype("text/html"); PrintWriter out=res.getwriter(); int n01,n02; String op; n01=integer.parseint(req.getparameter("v1")); n02=integer.parseint(req.getparameter("v2")); op=req.getparameter("add"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=drivermanager.getconnection("jdbc:odbc:scce6"); Statement st=con.createstatement();

43 ResultSet rs=st.executequery("select * FROM calc"); if(rs.next()) out.println("<h1> operation already exixts in the database"); out.println("<br> Result is ="+rs.getstring(5)); else int result=0; if(op.equals("+")) result=n01+n02; if(op.equals("-")) result=n01-n02; if(op.equals("*")) result=n01*n02; if(op.equals("/")) result=n01/n02; if(op.equals("%")) result=n01%n02; int x=st.executeupdate("insert into guests2 values('"+n01+"','"+n02+"','"+op+"','"+result+"')"); if(x>0) out.println("<h1> Result"+res+"</h1>"); else out.println("<h1> Error in insertion</h1>"); catch(exception e) e.printstacktrace(); Web.xml <?xml version="1.0"?> <web-app> <servlet> <servlet-name>calulatorv</servlet-name> <servlet-class>calcdbservlet6vb</servlet-class> </servlet> <servlet-mapping> <servlet-name>calulatorv</servlet-name> <url-pattern>/calcdb</url-pattern>

44 </servlet-mapping> </web-app> OUTPUT:

45 6(iv) b. A web application that takes a name as input and on submit it shows a hello <name> page where name is taken from the request. It shows the start time at the right top corner of the page and provides a logout button. On clicking this button, it should show a logout page with Thank You <name > message with the duration of usage (hint: Use session to store name and time). USING SERVLET Session6vib.html <head> <title> SESSION LOGIN </title> </head> <center> <form action="session6vib" method="get"> Enter Name: <input type="text" name="uname"> <br> <input type="submit" value="login" name="register"> </form> Session16vib.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class Session16vib extends HttpServlet public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException try res.setcontenttype("text/html"); PrintWriter out=res.getwriter(); out.println("<form method=get action=session26vib>"); Date d=new Date(); out.println("<p align=right> Time:"+d.getTime()+"</p>"); String un=req.getparameter("uname"); HttpSession session=req.getsession(); session.setattribute("user",un); session.setattribute("time",d.gettime()); out.println("hello\t"+un); out.println("<br><br> <input type=submit value=logout>"); out.println("</form");

46 catch(exception e) e.printstacktrace(); Session26vib.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class Session26vib extends HttpServlet public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException try res.setcontenttype("text/html"); PrintWriter out=res.getwriter(); HttpSession session=req.getsession(); Date d2=new Date(); String un=(string)session.getattribute("user"); Long t1=(long)session.getattribute("time"); Long t2=d2.gettime(); session.invalidate(); out.println("thank you\t"+un); out.println("<br><br> Session duration: '"+(t2-t1)/(60*60)+"'seconds"); catch(exception e) e.printstacktrace(); Web.xml <?xml version="1.0"?> <web-app> <servlet> <servlet-name>session1</servlet-name> <servlet-class>session16vib</servlet-class> </servlet> <servlet-mapping> <servlet-name>session1</servlet-name>

47 <url-pattern>/session6vib</url-pattern> </servlet-mapping> <servlet> <servlet-name>session2</servlet-name> <servlet-class>session26vib</servlet-class> </servlet> <servlet-mapping> <servlet-name>session2</servlet-name> <url-pattern>/session26vib</url-pattern> </servlet-mapping> </web-app> OUTPUT:

48 6(Vii) b. A web application that takes name and age from an HTML page. If the age is less than 18, it should send a page with Hello <name>, you are not authorized to visit the site message, where <name> should be replaced with the entered name. Otherwise it should send Welcome <name> to this site message. CODE: Usereligibilty6viib.html USING SERVLETS <head> <title> User Acess </title> </head> <br> <center> <h1> USER ELIGIBILITY </h1> <form action="checkage" method="get"> <input type="text" name="uname" placeholder="enter your name"> <br> <input type="text" name="uage" placeholder="enter your age"> <br> <input type="submit" value="submit" name="sub"<> </form> CheckAge6viib.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class CheckAge6viib extends HttpServlet public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException try res.setcontenttype("text/html"); PrintWriter out=res.getwriter(); int age=integer.parseint(req.getparameter("uage")); String name=req.getparameter("uname"); if(age<=18) out.println("<h1> Hello\t " +name+"\tyou are not eligible </h1>"); else out.println("<h1> Welcome " +name+"to this site </h1>");

49 catch(exception e) e.printstacktrace(); Web.xml <?xml version="1.0"?> <web-app> <servlet> <servlet-name>checkage</servlet-name> <servlet-class>checkage6viib</servlet-class> </servlet> <servlet-mapping> <servlet-name>checkage</servlet-name> <url-pattern>/checkage</url-pattern> </servlet-mapping> </web-app> OUTPUT:

50 6. Implement the following web applications using (a) PHP, (b) Servlets and (c) JSP. 6 (i) (c). A user validation web application, where the user submits the login name and password to the server. The name and password are checked against the data already available in Database and if the data matches, a successful login page is returned. Otherwise failure message is shown to the user. CODE: USING JSP Login6ic.html <form name="f1" method="get" action="login6ic.jsp"> <center> <b><h1> Login Page </h1></b><br> Username: <input type="text" name="uname"><br> Password: <input type="password" name="pwd"><br> <br> <br> <input type="submit" value="login"> <input type="reset"> </form> Login6ic.jsp <%@page language="java" import="java.sql.*" errorpage=""%> <% String u,p; u=request.getparameter("uname"); p=request.getparameter("pwd"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=drivermanager.getconnection("jdbc:odbc:scce"); Statement st=con.createstatement(); ResultSet rs=st.executequery("select * from guests1"); String dbun,dbpwd; while(rs.next()) dbun = rs.getstring(2); dbpwd = rs.getstring(3); if(dbun.equals(u) && dbpwd.equals(p)) out.println("<h1> Hi "+u+"..successfully logged in</h1>"); break;

51 else if(dbun.equals(u)) out.println("<h1> Invalid password</h1>"); break; else if(dbpwd.equals(p)) out.println("<h1> Invalid username</h1>"); break; con.close(); %> OUTPUT:

52 6 (ii) (c). Modify the above program to use an xml instead of database USING JSP Loginjsp6iic.html <center> <form method="get" action="login6ic.jsp"> <table> <tr> <td> username: </td> <td> <input type="text" name="uname"> </td> </tr> <tr> <td> password </td> <td> <input type="password" name="pwd"> </td> </tr> <tr> <td></td> <td> <input type="submit" value="login"> <input type="reset" value="reset"> </td> </tr> </table> </form> Login6iic.jsp language="java" import="java.sql.*" errorpage=""%> <% String u,p; u=config.getinitparameter("uname"); p=config.getinitparameter("pwd"); String un=request.getparameter("uname"); String pass=request.getparameter("pwd"); if(u.equals(un) && p.equals(pass)) out.println("<h1> Welcome "+u+" </h1>"); else out.println("<h1> Hi "+u+"..invalid username or password</h1>"); %> Web.xml

53 <?xml version="1.0"?> <web-app> <servlet> <servlet-name>login6iic</servlet-name> <jsp-file>/login6ic.jsp</jsp-file> <Init-param> <param-name>uname</param-name> <param-value>cse</param-value> </Init-param> <Init-param> <param-name>pwd</param-name> <param-value>5</param-value> </Init-param> </servlet> <servlet-mapping> <servlet-name>login6iic</servlet-name> <url-pattern>/login6iic.jsp</url-pattern> </servlet-mapping> </web-app> OUTPUT:

54 6(iv)(c). A simple calculator web application that takes two numbers and an operator (+,-,/,* and %) from an HTML page and returns the result page with the operation performed on the operands. USING JSP CODE: Calc6ivc.html <head> <title> Calculator </title> </head> <center> <h1> BASIC CALCULATOR </h1> <form action="calc6ivc.jsp" method="get"> <input type="text" name="v1" placeholder="enter a value"> <input type="text" name="v2" placeholder="enter a value"><br><br> <input type="submit" value="+" name="add"> <input type="submit" value="-" name="sub"> <input type="submit" value="*" name="mul"> <input type="submit" value="/" name="div"> <input type="submit" value="%" name="mod"> </form> Calc6ivc.jsp <%@page language="java" import="java.sql.*" errorpage=""%> <% int n01,n02; String op; n01=integer.parseint(request.getparameter("v1")); n02=integer.parseint(request.getparameter("v2")); op=request.getparameter("add"); int result=0; if(op.equals("+")) result=n01+n02; if(op.equals("-")) result=n01-n02; if(op.equals("*")) result=n01*n02; if(op.equals("/")) result=n01/n02;

55 if(op.equals("%")) result=n01%n02; out.println("<h1> Result= "+result+"</h1>"); %> OUTPUT:

56 6(v) (c). Modify the above program such that it stores each query in a database and checks the database first for the result. If the query is already available in DB, it returns the value that was previously computed (from DB) or it computes the result and returns it after storing the new query and result in DB. USING JSP CODE: Calc6vc.html <head> <title> Calculator </title> </head> <center> <h1> BASIC CALCULATOR </h1> <form action="calc6vc.jsp" method="post"> <input type="text" name="v1" placeholder="enter a value"> <input type="text" name="v2" placeholder="enter a value"><br><br> <input type="submit" value="+" name="add"> <input type="submit" value="-" name="sub"> <input type="submit" value="*" name="mul"> <input type="submit" value="/" name="div"> <input type="submit" value="%" name="mod"> </form> Calc6v.jsp <%@page language="java" import="java.sql.*" "errorpage=""%> <% int n01,n02; String op; n01=integer.parseint(request.getparameter("v1")); n02=integer.parseint(request.getparameter("v2")); op=request.getparameter("add"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=drivermanager.getconnection("jdbc:odbc:scce6"); Statement st=con.createstatement(); ResultSet rs=st.executequery("select * FROM calc"); if(rs.next()) out.println("<h1> operation already exixts in the database"); out.println("<br> Result is ="+rs.getstring(5)); else

57 int result=0; if(op.equals("+")) result=n01+n02; if(op.equals("-")) result=n01-n02; if(op.equals("*")) result=n01*n02; if(op.equals("/")) result=n01/n02; if(op.equals("%")) result=n01%n02; int x=st.executeupdate("insert into guests2 values('"+n01+"','"+n02+"','"+op+"','"+result +"')"); if(x>0) out.println("<h1> Result"+result+"</h1>"); else out.println("<h1> Error in insertion</h1>"); %> OUTPUT:

58 6(vi) (c). A web application that takes a name as input and on submit it shows a hello <name> page where name is taken from the request. It shows the start time at the right top corner of the page and provides a logout button. On clicking this button, it should show a logout page with Thank You <name > message with the duration of usage (hint: Use session to store name and time). USING JSP CODE: Session6vic.html <head> <title> SESSION LOGIN </title> </head> <center> <form action="session16vic.jsp" method="get"> Enter Name: <input type="text" name="uname"> <br> <input type="submit" value="login" name="register"> </form> Session16vic.jsp <%@page language="java" import="java.util.*" errorpage=""%> <form method="get" action="session26vic.jsp"> <% Date d=new Date(); %> <p align="right"> Time;<%=d.getTime()%></p> <% String un=request.getparameter("uname"); session.setattribute("user",un); session.setattribute("time",d.gettime()); %> Hello <%=un%> <br><br> <input type="submit" value="logout"> </form> Session26vic.jsp <%@page language="java" import="java.util.*" errorpage=""%> <%

59 Date d2=new Date(); String un=(string)session.getattribute("user"); Long t1=(long)session.getattribute("time"); Long t2=d2.gettime(); %> Thank you <%=un%> <br><br> Session duration: <%=(t2-t1)/(60*60)%> seconds <% session.invalidate();%> OUTPUT:

60 6 (Vii)(c). A web application that takes name and age from an HTML page. If the age is less than 18, it should send a page with Hello <name>, you are not authorized to visit the site message, where <name> should be replaced with the entered name. Otherwise it should send Welcome <name> to this site message. USING JSP CODE: Usereligible6viic.html <head> <title> User Acess </title> </head> <br> <center> <h1> USER ELIGIBILITY </h1> <form action="checkage6viic.jsp" method="get"> <input type="text" name="uname" placeholder="enter your name"> <br> <input type="text" name="uage" placeholder="enter your age"> <br> <input type="submit" value="submit" name="sub"<> </form> Checkage6viic.jasp <%@page language="java" import="java.sql.*" errorpage=""%> <% String name; int age; name=request.getparameter("uname"); age=integer.parseint(request.getparameter("uage")); if(age<=18) out.println("<h1> Hello\t " +name+"\tyou are not eligible </h1>"); else out.println("<h1> Welcome " +name+"to this site </h1>"); %>

61 OUTPUT: CASE 1: CASE 2:

62 6(ix) (c). A web application that lists all cookies stored in the browser on clicking List Cookies button. Add cookies if necessary. USING JSP CODE: cookie6ixc.html <head> <title> Calculator </title> </head> <form action="cookie16ixc.jsp" method="post"> Enter your name:<input type="text" name="name1" placeholder="enter name"> <input type="submit" value="add cookie"> </form> cookie16ixc.jsp <%@page language="java" import="java.sql.*" errorpage=""%> <% String name=request.getparameter("name1"); Cookie c1=new Cookie ("firstname",name); response.addcookie(c1); c1.setmaxage(50*50); %> <form method="get" action="cookie26ixc.jsp"> <input type="submit" value="list Cookies"> </form> Cookie26ixc.jsp <%@page language="java" import="java.sql.*" errorpage=""%> <title> List of Cookies </title> <h1> List of Cookies </h1> <% Cookie[] cookies=request.getcookies();

63 %> <table border=1> </tr> <% out.println("<td> Cookie Name </td> <td> Cookie value </td>"); for(int i=0;i<cookies.length;i++) out.println("<h2> <tr> <td> "+cookies[i].getname()+"</td><td>"+cookies[i].getvalue()+"</td></tr>"); %> </tr> </table> OUTPUT:

EXPERIMENT- 9. Login.html

EXPERIMENT- 9. Login.html EXPERIMENT- 9 To write a program that takes a name as input and on submit it shows a hello page with name taken from the request. And it shows starting time at the right top corner of the page and provides

More information

Unit-4: Servlet Sessions:

Unit-4: Servlet Sessions: 4.1 What Is Session Tracking? Unit-4: Servlet Sessions: Session tracking is the capability of a server to maintain the current state of a single client s sequential requests. Session simply means a particular

More information

Chettinad College of Engineering and Technology CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY

Chettinad College of Engineering and Technology CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY UNIT IV SERVLETS 1. What is Servlets? a. Servlets are server side components that provide a powerful mechanism

More information

EXPERIMENT OBJECTIVE:

EXPERIMENT OBJECTIVE: EXPERIMENT-1 1.1 To accept a number from one text field in the range of 0 to 999 and shows it in another text field in words. If the number is out of range, it should show out of range and if it is not

More information

AJP. CHAPTER 5: SERVLET -20 marks

AJP. CHAPTER 5: SERVLET -20 marks 1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),

More information

3. The pool should be added now. You can start Weblogic server and see if there s any error message.

3. The pool should be added now. You can start Weblogic server and see if there s any error message. CS 342 Software Engineering Lab: Weblogic server (w/ database pools) setup, Servlet, XMLC warming up Professor: David Wolber (wolber@usfca.edu), TA: Samson Yingfeng Su (ysu@cs.usfca.edu) Setup Weblogic

More information

Kamnoetvidya Science Academy. Object Oriented Programming using Java. Ferdin Joe John Joseph. Java Session

Kamnoetvidya Science Academy. Object Oriented Programming using Java. Ferdin Joe John Joseph. Java Session Kamnoetvidya Science Academy Object Oriented Programming using Java Ferdin Joe John Joseph Java Session Create the files as required in the below code and try using sessions in java servlets web.xml

More information

To create a view for students, staffs and courses in your departments using servlet/jsp.

To create a view for students, staffs and courses in your departments using servlet/jsp. Aim To create a view for students, staffs and courses in your departments using servlet/jsp. Software Requirements: Java IDE Database Server JDK1.6 Netbean 6.9/Eclipse MySQL Tomcat/Glassfish Login Form

More information

Handout 31 Web Design & Development

Handout 31 Web Design & Development Lecture 31 Session Tracking We have discussed the importance of session tracking in the previous handout. Now, we ll discover the basic techniques used for session tracking. Cookies are one of these techniques

More information

Introductory workshop on PHP-MySQL

Introductory workshop on PHP-MySQL Introductory workshop on PHP-MySQL Welcome to Global Certifications and Training from Rocky Sir Download all needed s/w from monster.suven.net Full Stack development : UI + Server Side 1 or more client

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet.

Servlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet. Servlet OOS Lab Servlet OOS Servlets are modules of Java code that run in web server. Internet Explorer Web Server Fire Fox Servlet Servlet Servlet Java Application 2 Servlet - Example OOS import java.io.*;

More information

Introduction. This course Software Architecture with Java will discuss the following topics:

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Chapter #1. Program to demonstrate applet life cycle

Chapter #1. Program to demonstrate applet life cycle Chapter #1. Program to demonstrate applet life cycle import java.applet.applet; import java.awt.*; public class LifeCycle extends Applet{ public void init(){ System.out.println(" init()"); public void

More information

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat

More information

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003 Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

PARTIAL Final Exam Reference Packet

PARTIAL Final Exam Reference Packet PARTIAL Final Exam Reference Packet (Note that some items here may be more pertinent than others; you'll need to be discerning.) Example 1 - St10CommonImportTop.jsp (with comments removed)

More information

WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD

WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD W HI TEPAPER www. p rogres s.com WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD In this whitepaper, we describe how to white label Progress Rollbase private cloud with your brand name by following a

More information

JavaServer Pages (JSP)

JavaServer Pages (JSP) JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult

More information

JdbcResultSet.java. import java.sql.*;

JdbcResultSet.java. import java.sql.*; 1)Write a program to display the current contents of the tables in the database where table name is Registration and attributes are id,firstname,lastname,age. JdbcResultSet.java import java.sql.*; public

More information

Backend. (Very) Simple server examples

Backend. (Very) Simple server examples Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));

More information

M.Tech. CSE - I Yr I Semester (19)

M.Tech. CSE - I Yr I Semester (19) M.Tech. CSE - I Yr I Semester - 2010-11 (19) //service public ServletConfig getservletconfig() return sc; public String getservletinfo() return "Guide - T.PoornaShekhar, M.Tech CS & CSE Coordinator - www.scce.ac.in";

More information

CIS 3952 [Part 2] Java Servlets and JSP tutorial

CIS 3952 [Part 2] Java Servlets and JSP tutorial Java Servlets Example 1 (Plain Servlet) SERVLET CODE import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet;

More information

INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M 1.B HTML FORM CREATION - 2 M

INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M 1.B HTML FORM CREATION - 2 M INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M EXPLANATION - 1.B HTML FORM CREATION - 2 M SERVLET CODE IN POST METHOD IMPORT STATEMENTS - CLASS NAME AND METHOD (POST) -

More information

ICOM 5016 Database Systems. Database Users. User Interfaces and Tools. Chapter 8: Application Design and Development.

ICOM 5016 Database Systems. Database Users. User Interfaces and Tools. Chapter 8: Application Design and Development. Chapter 8: Application Design and Development ICOM 5016 Database Systems Web Application Amir H. Chinaei Department of Electrical and Computer Engineering University of Puerto Rico, Mayagüez User Interfaces

More information

Lab 7 Introduction to MySQL

Lab 7 Introduction to MySQL Lab 7 Introduction to MySQL Objectives: During this lab session, you will - Learn how to access the MySQL Server - Get hand-on experience on data manipulation and some PHP-to-MySQL technique that is often

More information

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1

Java Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public

More information

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres

sessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano A few more words about Common Gateway Interface 1 2 CGI So originally CGI purpose was to let communicate a

More information

Module 4: SERVLET and JSP

Module 4: SERVLET and JSP 1.What Is a Servlet? Module 4: SERVLET and JSP A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the Hyper

More information

ITS331 IT Laboratory I: (Laboratory #11) Session Handling

ITS331 IT Laboratory I: (Laboratory #11) Session Handling School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS331 Information Technology Laboratory I Laboratory #11: Session Handling Creating

More information

SWE642 Oct. 22, 2003

SWE642 Oct. 22, 2003 import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.arraylist; DataServlet.java /** * First servlet in a two servlet application. It is responsible

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

Chapter 2 How to structure a web application with the MVC pattern

Chapter 2 How to structure a web application with the MVC pattern Chapter 2 How to structure a web application with the MVC pattern Murach's Java Servlets/JSP (3rd Ed.), C2 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge 1. Describe the Model 1 pattern.

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name Course Code Class Branch : Web Technologies : ACS006 : B. Tech

More information

JAVA SERVLET. Server-side Programming ADVANCED FEATURES

JAVA SERVLET. Server-side Programming ADVANCED FEATURES JAVA SERVLET Server-side Programming ADVANCED FEATURES 1 AGENDA RequestDispacher SendRedirect ServletConfig ServletContext ServletFilter SingleThreadedModel Events and Listeners Servlets & Database 2 REQUESTDISPATCHER

More information

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier Use of PHP for DB Connection 1 2 Middle and Information Tier PHP: built in library functions for interfacing with the mysql database management system $id = mysqli_connect(string hostname, string username,

More information

By the end of this section of the practical, the students should be able to:

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Connecting to a MySQL database in PHP with the mysql_connect() and mysql_select_db() functions Trapping and displaying database

More information

Unit III- Server Side Technologies

Unit III- Server Side Technologies Web Technology Unit III- Server Side Technologies By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and not

More information

Principles and Techniques of DBMS 6 JSP & Servlet

Principles and Techniques of DBMS 6 JSP & Servlet Principles and Techniques of DBMS 6 JSP & Servlet Haopeng Chen REliable, INtelligent and Scalable Systems Group (REINS) Shanghai Jiao Tong University Shanghai, China http://reins.se.sjtu.edu.cn/~chenhp

More information

ServletConfig Interface

ServletConfig Interface ServletConfig Interface Author : Rajat Categories : Advance Java An object of ServletConfig is created by the web container for each servlet. This object can be used to get configuration information from

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering. Algorithm lab- PCS-553 LAB MANUAL

DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering. Algorithm lab- PCS-553 LAB MANUAL Department of Computer Science and Engineering Year: 3rd Semester: 5th Algorithm lab- PCS-553 Prepared By: HOD(CSE) 1 Department of Computer Science and Engineering INDEX S.No Practical s Name Tools Remark

More information

Scheme G Sample Question Paper Unit Test 2

Scheme G Sample Question Paper Unit Test 2 Scheme G Sample Question Paper Unit Test 2 Course Name: Computer Engineering Group Course Code: CO/CD/CM/CW/IF Semester: Sixth Subject Title: Advanced Java Programming Marks: 25 Marks 17625 ---------------------------------------------------------------------------------------------------------------------------

More information

Spring 2014 Interim. HTML forms

Spring 2014 Interim. HTML forms HTML forms Forms are used very often when the user needs to provide information to the web server: Entering keywords in a search box Placing an order Subscribing to a mailing list Posting a comment Filling

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

Advanced Internet Technology Lab # 5 Handling Client Requests

Advanced Internet Technology Lab # 5 Handling Client Requests Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 5 Handling Client Requests Eng. Doaa Abu Jabal Advanced Internet Technology Lab

More information

Advanced Internet Technology Lab # 6

Advanced Internet Technology Lab # 6 Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 6 JSP cookies Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 6 JSP cookies

More information

CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks

CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS DATE: 30.9.11 Aim: To create a servlet program to display the students marks Hardware requirements: Intel Core 2 Quad 2GB RAM Software requirements:

More information

Copyright 2005, by Object Computing, Inc. (OCI). All rights reserved. Database to Web

Copyright 2005, by Object Computing, Inc. (OCI). All rights reserved. Database to Web Database To Web 10-1 The Problem Need to present information in a database on web pages want access from any browser may require at least HTML 4 compatibility Want to separate gathering of data from formatting

More information

Session 11. Calling Servlets from Ajax. Lecture Objectives. Understand servlet response formats

Session 11. Calling Servlets from Ajax. Lecture Objectives. Understand servlet response formats Session 11 Calling Servlets from Ajax 1 Lecture Objectives Understand servlet response formats Text Xml Html JSON Understand how to extract data from the XMLHttpRequest object Understand the cross domain

More information

Lab session Google Application Engine - GAE. Navid Nikaein

Lab session Google Application Engine - GAE. Navid Nikaein Lab session Google Application Engine - GAE Navid Nikaein Available projects Project Company contact Mobile Financial Services Innovation TIC Vasco Mendès Bluetooth low energy Application on Smart Phone

More information

Develop an Enterprise Java Bean for Banking Operations

Develop an Enterprise Java Bean for Banking Operations Develop an Enterprise Java Bean for Banking Operations Aim: Develop a Banking application using EJB3.0 Software and Resources: Software or Resource Version Required NetBeans IDE 6.7, Java version Java

More information

TUTORIAL QUESTION BANK

TUTORIAL QUESTION BANK + INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name Course Code Class Branch : Web Technologies : ACS006

More information

Web based Applications, Tomcat and Servlets - Lab 3 -

Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta The Basic Web Server CMPUT 391 Database Management

More information

Use of PHP for DB Connection. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier Client: UI HTML, JavaScript, CSS, XML Use of PHP for DB Connection Middle Get all books with keyword web programming PHP Format the output, i.e., data returned from the DB SQL DB Query Access/MySQL 1 2

More information

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http? What are Servlets? Servlets1 Fatemeh Abbasinejad abbasine@cs.ucdavis.edu A program that runs on a web server acting as middle layer between requests coming from a web browser and databases or applications

More information

PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II

PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II Subject Name: Advanced JAVA programming Subject Code: 13MCA42 Time: 11:30-01:00PM Max.Marks: 50M ----------------------------------------------------------------------------------------------------------------

More information

AIM: PROCEDURE: Main page:

AIM: PROCEDURE: Main page: AIM: 1. Develop static pages (using Only HTML) of an online Book store.the pages should resemble:www.amazon.com.the website should consists the following pages. Home page Registration User Login Books

More information

LAB MANUAL SUBJECT: WEB TECHNOLOGY CLASS : T.E (COMPUTER) SEMESTER: VI

LAB MANUAL SUBJECT: WEB TECHNOLOGY CLASS : T.E (COMPUTER) SEMESTER: VI LAB MANUAL SUBJECT: WEB TECHNOLOGY CLASS : T.E (COMPUTER) SEMESTER: VI INDEX No. Title Pag e No. 1 Implements Basic HTML Tags 3 2 Implementation Of Table Tag 4 3 Implementation Of FRAMES 5 4 Design A FORM

More information

Accessing EJB in Web applications

Accessing EJB in Web applications Accessing EJB in Web applications 1. 2. 3. 4. Developing Web applications Accessing JDBC in Web applications To run this tutorial, as a minimum you will be required to have installed the following prerequisite

More information

Java Server Pages JSP

Java Server Pages JSP Java Server Pages JSP Agenda Introduction JSP Architecture Scripting Elements Directives Implicit Objects 2 A way to create dynamic web pages Introduction Separates the graphical design from the dynamic

More information

Unit 4 - Servlet. Servlet. Advantage of Servlet

Unit 4 - Servlet. Servlet. Advantage of Servlet Servlet Servlet technology is used to create web application, resides at server side and generates dynamic web page. Before Servlet, CGI (Common Gateway Interface) was popular as a server-side programming

More information

Naresh Kumar Practical List:- ( Advance Java Practical List ) INDEX

Naresh Kumar Practical List:- ( Advance Java Practical List ) INDEX Practical List:- ( Advance Java Practical List ) INDEX Naresh Kumar 2016 S. No. Practical Name 1 Practical 1 st :- Write an application to connect with MySQL DB. 2 Practical 2 nd :- Write a JDBC Application

More information

Advanced Internet Technology Lab # 4 Servlets

Advanced Internet Technology Lab # 4 Servlets Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 4 Servlets Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 4 Servlets Objective:

More information

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold.

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold. 1. Application Servers J2EE Web Development In the beginning, there was darkness and cold. Then, mainframe terminals terminals Centralized, non-distributed Agenda Application servers What is J2EE? Main

More information

Session 10. Form Dataset. Lecture Objectives

Session 10. Form Dataset. Lecture Objectives Session 10 Form Dataset Lecture Objectives Understand the relationship between HTML form elements and parameters that are passed to the servlet, particularly the form dataset 2 10/1/2018 1 Example Form

More information

Session 8. Introduction to Servlets. Semester Project

Session 8. Introduction to Servlets. Semester Project Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the

More information

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4

The Basic Web Server CGI. CGI: Illustration. Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 Database Management Systems 4 CMPUT 391 Database Management Systems The Basic Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems

More information

Introduction to Servlets. After which you will doget it

Introduction to Servlets. After which you will doget it Introduction to Servlets After which you will doget it Servlet technology A Java servlet is a Java program that extends the capabilities of a server. Although servlets can respond to any types of requests,

More information

JSP CSCI 201 Principles of Software Development

JSP CSCI 201 Principles of Software Development JSP CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Outline JSP Program USC CSCI 201L JSP 3-Tier Architecture Client Server Web/Application Server Database USC

More information

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web

Introduction to Java Servlets. SWE 432 Design and Implementation of Software for the Web Introduction to Java Servlets James Baldo Jr. SWE 432 Design and Implementation of Software for the Web Web Applications A web application uses enabling technologies to 1. make web site contents dynamic

More information

How to structure a web application with the MVC pattern

How to structure a web application with the MVC pattern Objectives Chapter 2 How to structure a web application with the MVC pattern Knowledge 1. Describe the Model 1 pattern. 2. Describe the Model 2 (MVC) pattern 3. Explain how the MVC pattern can improve

More information

Get the cookies from the service request: Cookie[] HttpServletRequest.getCookies() Add a cookie to the service response:

Get the cookies from the service request: Cookie[] HttpServletRequest.getCookies() Add a cookie to the service response: Managing Cookies Cookies Cookies are a general mechanism which server side applications can use to both store and retrieve information on the client side Servers send cookies in the HTTP response and browsers

More information

Using Java servlets to generate dynamic WAP content

Using Java servlets to generate dynamic WAP content C H A P T E R 2 4 Using Java servlets to generate dynamic WAP content 24.1 Generating dynamic WAP content 380 24.2 The role of the servlet 381 24.3 Generating output to WAP clients 382 24.4 Invoking a

More information

AJAX. Introduction. AJAX: Asynchronous JavaScript and XML

AJAX. Introduction. AJAX: Asynchronous JavaScript and XML AJAX 1 2 Introduction AJAX: Asynchronous JavaScript and XML Popular in 2005 by Google Create interactive web applications Exchange small amounts of data with the server behind the scenes No need to reload

More information

( A ) 8. If the address of an array is stored in $value, how do you get the values of this array? (B) \$value (C) &$value (D) $$value

( A ) 8. If the address of an array is stored in $value, how do you get the values of this array? (B) \$value (C) &$value (D) $$value CS 665 Information Delivery on the Internet Final Exam - Name: Fall 2002 Part 1: (75 points - 3 points for each problem) ( A ) 1. What protocol is used by all Web communications transactions? (A) HTTP

More information

Prasad V. Potluri Siddhartha Institute of Technology, Kanuru, Vijayawada. Semester end examination: 50 marks

Prasad V. Potluri Siddhartha Institute of Technology, Kanuru, Vijayawada. Semester end examination: 50 marks 1/2 M.Tech. SECOND SEMESTER CSCS2L1 WEB TECHNOLOGIES LAB Credits: 2 Lecture: 4 periods/week Internal assessment: 25 marks Tutorial: -- Semester end examination: 50 marks -----------------------------------------------------------------------------------------------------------

More information

Front-end / Back-end. How does your application communicate with services?

Front-end / Back-end. How does your application communicate with services? Front-end / Back-end How does your application communicate with services? Mission Help students implement a mock-up that actually gets (and sometimes stores) data using some kind of external service. The

More information

Servlets and JSP (Java Server Pages)

Servlets and JSP (Java Server Pages) Servlets and JSP (Java Server Pages) XML HTTP CGI Web usability Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Servlets Generic Java2EE API for invoking and connecting to mini-servers (lightweight,

More information

XmlEngine user s manual

XmlEngine user s manual XmlEngine user s manual 7 th April 2006 Revision 1.0 Visit us at www.openbravo.com Table of Contents I.Introduction... 3 II.Requirements... 4 III.License... 5 IV.Installation... 6 V.System overview...

More information

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22.

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22. Answers 1. What is the super interface to all the JDBC Drivers, specify their fully qualified name? a. Java.sql.Driver i. JDBC-ODBC Driver ii. Java-Native API Driver iii. All Java Net Driver iv. Java Native

More information

Advanced Web Technology

Advanced Web Technology Berne University of Applied Sciences Dr. E. Benoist Winter Term 2005-2006 Presentation 1 Presentation of the Course Part Java and the Web Servlet JSP and JSP Deployment The Model View Controler (Java Server

More information

Course Entity Bean CODE

Course Entity Bean CODE Q.1. Implement award list of MCA 1st year as a XML document. The table must have semester No, student s Enrollment No, TEE marks of all the theory subjects, practical subjects and assignments. Q. 2. Create

More information

A.A. 2008/09. What is Ajax?

A.A. 2008/09. What is Ajax? Internet t Software Technologies AJAX IMCNE A.A. 2008/09 Gabriele Cecchetti What is Ajax? AJAX stands for Asynchronous JavaScript And XML. AJAX is a type of programming made popular in 2005 by Google (with

More information

Servlets. An extension of a web server runs inside a servlet container

Servlets. An extension of a web server runs inside a servlet container Servlets What is a servlet? An extension of a web server runs inside a servlet container A Java class derived from the HttpServlet class A controller in webapplications captures requests can forward requests

More information

Java4570: Session Tracking using Cookies *

Java4570: Session Tracking using Cookies * OpenStax-CNX module: m48571 1 Java4570: Session Tracking using Cookies * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract

More information

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR

2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

CE212 Web Application Programming Part 3

CE212 Web Application Programming Part 3 CE212 Web Application Programming Part 3 30/01/2018 CE212 Part 4 1 Servlets 1 A servlet is a Java program running in a server engine containing methods that respond to requests from browsers by generating

More information

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial. AJAX About the Tutorial AJAX is a web development technique for creating interactive web applications. If you know JavaScript, HTML, CSS, and XML, then you need to spend just one hour to start with AJAX.

More information

JAVA SERVLET. Server-side Programming PROGRAMMING

JAVA SERVLET. Server-side Programming PROGRAMMING JAVA SERVLET Server-side Programming PROGRAMMING 1 AGENDA Passing Parameters Session Management Cookie Hidden Form URL Rewriting HttpSession 2 HTML FORMS Form data consists of name, value pairs Values

More information

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL PLAN PREZENTACJI Bazy danych w PHP Połączenie z bazą danych Zamknięcie połączenie Tworzenie bazy danych Tworzenie tabeli Operacje na tabelach

More information

Overview of Forms. Forms are used all over the Web to: Types of forms: Accept information Provide interactivity

Overview of Forms. Forms are used all over the Web to: Types of forms: Accept information Provide interactivity HTML Forms Overview of Forms Forms are used all over the Web to: Accept information Provide interactivity Types of forms: Search form, Order form, Newsletter sign-up form, Survey form, Add to Cart form,

More information

Servlet Fudamentals. Celsina Bignoli

Servlet Fudamentals. Celsina Bignoli Servlet Fudamentals Celsina Bignoli bignolic@smccd.net What can you build with Servlets? Search Engines E-Commerce Applications Shopping Carts Product Catalogs Intranet Applications Groupware Applications:

More information

UNIT-VI. HttpServletResponse It extends the ServletResponse interface to provide HTTP-specific functionality in sending a response.

UNIT-VI. HttpServletResponse It extends the ServletResponse interface to provide HTTP-specific functionality in sending a response. UNIT-VI javax.servlet.http package: The javax.servlet.http package contains a number of classes and interfaces that describe and define the contracts between a Servlet class running under the HTTP protocol

More information

Chapter 15 Java Server Pages (JSP)

Chapter 15 Java Server Pages (JSP) Sungkyunkwan University Chapter 15 Java Server Pages (JSP) Prepared by J. Jung and H. Choo Web Programming Copyright 2000-2018 Networking 2000-2012 Networking Laboratory Laboratory 1/30 Server & Client

More information

CS433 Technology Overview

CS433 Technology Overview CS433 Technology Overview Scott Selikoff Cornell University November 13, 2002 Outline I. Introduction II. Stored Procedures III. Java Beans IV. JSPs/Servlets V. JSPs vs. Servlets VI. XML Introduction VII.

More information

Internet Technologies 5-Dynamic Web. F. Ricci 2010/2011

Internet Technologies 5-Dynamic Web. F. Ricci 2010/2011 Internet Technologies 5-Dynamic Web F. Ricci 2010/2011 Content The "meanings" of dynamic Building dynamic content with Java EE (server side) HTML forms: how to send to the server the input PHP: a simpler

More information

CMPS 401 Survey of Programming Languages

CMPS 401 Survey of Programming Languages CMPS 401 Survey of Programming Languages Programming Assignment #4 PHP Language On the Ubuntu Operating System Write a PHP program (P4.php) and create a HTML (P4.html) page under the Ubuntu operating system.

More information

Component Based Software Engineering

Component Based Software Engineering Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts

More information

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2 Java Servlets Adv. Web Technologies 1) Servlets (introduction) Emmanuel Benoist Fall Term 2016-17 Introduction HttpServlets Class HttpServletResponse HttpServletRequest Lifecycle Methods Session Handling

More information

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly Web Programming Lecture 10 PHP 1 Purpose of Server-Side Scripting database access Web page can serve as front-end to a database Ømake requests from browser, Øpassed on to Web server, Øcalls a program to

More information