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

Similar documents
Javascript. A key was pressed OR released. A key was released. A mouse button was pressed.

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

Q1. What is JavaScript?

blink.html 1/1 lectures/6/src/ form.html 1/1 lectures/6/src/

CIS 3952 [Part 2] Java Servlets and JSP tutorial

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL

c360 Web Connect Configuration Guide Microsoft Dynamics CRM 2011 compatible c360 Solutions, Inc. c360 Solutions

Copyright 2011 Sakun Sharma

Web Development and HTML. Shan-Hung Wu CS, NTHU

First Version Web 1.0: customer.jsp

SocialMiner Configuration

Session 21. Expression Languages. Reading. Java EE 7 Chapter 9 in the Tutorial. Session 21 Expression Languages 11/7/ Robert Kelly,

Hyperlinks, Tables, Forms and Frameworks

MI1004 Script programming and internet applications

First Simple Interactive JSP example

UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2016 EXAMINATIONS. CSC309H1 S Programming on the Web Instructor: Ahmed Shah Mashiyat

JavaScript: Introduction, Types

HTML Forms IT WS I - Lecture 11

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab.

JavaScript CSCI 201 Principles of Software Development

Stateless -Session Bean

DEZVOLTAREA APLICATIILOR WEB CURS 7. Lect. Univ. Dr. Mihai Stancu

<form>. input elements. </form>

jmaki Overview Sang Shin Java Technology Architect Sun Microsystems, Inc.

A340 Laboratory Session #5

JavaServer Pages (JSP)

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

Spring 2014 Interim. HTML forms

Unit Notes. ICAWEB411A Produce basic client-side script for dynamic web pages Topic 1 Introduction to JavaScript

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

Web Development & Design Foundations with HTML5

Lab 7 Introduction to MySQL

Introduction to HTML5

Advanced Internet Technology Lab # 6

Lotus Using JavaScript in IBM Lotus Domino 7 Applications.

Practice problems. 1 Draw the output for the following code. 2. Draw the output for the following code.

AIM. 10 September

HTML 5 Form Processing

1$ 5 ! $ 6 4 * Source: 0 "!*! 0! * 8 97 ?!$ 5 0 *! 4! $ 0 : * ' () 7;7 7<7

The first sample. What is JavaScript?

Chapter 15 Java Server Pages (JSP)

JavaScript (5A) JavaScript

Learning JavaScript. A C P K Siriwardhana, BSc, MSc

INFO / CSE 100 FINAL EXAM SOLUTIONS March 19, 2009

Manual Html A Href Onclick Submit Form

JavaScript Introduction

HTML HTML. Chris Seddon CRS Enterprises Ltd 1

Document for Consuming Web-Service In.NET & JAVA

Session 11. Expression Language (EL) Reading

</title><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

CSC 415/515 PROJECT 3 JAVASCRIPT CONCENTRATION GAME. 1. Introduction

PRODUCT DOCUMENTATION. Installing and Implementing Enterprise Contact Center Chat RELEASE 5.1

Java TM. JavaServer Faces. Jaroslav Porubän 2008

Introduction to DHTML

JavaScript s role on the Web

Javascript in the Corvid Servlet Runtime Templates

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to:

Session 5. Web Page Generation. Reading & Reference

Course Wiki. Today s Topics. Web Resources. Amazon EC2. Linux. Apache PHP. Workflow and Tools. Extensible Networking Platform 1

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

Introduction to JavaScript

Course Information. Todd Sproull Jolley 536 Office Hours by Appointment. Monday and Wednesday 10 11:30 AM

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Minor Subject

Course Information. Instructor Todd Sproull Jolley 536 Office Hours by Appointment

This is CS50. Harvard College Fall Quiz 1 Answer Key

UNIT-VI CREATING AND USING FORMS

Advantages: simple, quick to get started, perfect for simple forms, don t need to know how form model objects work

Exercise 1: Basic HTML and JavaScript

CSCI 1100L: Topics in Computing Spring 2018 Web Page Project 50 points

SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2015/2016 CI135. Introduction to Web Development

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

AC75/AT75 INTERNET APPLICATIONS JUN 2015

SmileTiger emeeting Server 2008 Integration Guide

CE212 Web Application Programming Part 3

Current trends: Scripting (I) A bid part of interface design centers around dialogs

Introductory workshop on PHP-MySQL

Infodraw MRS Interfaces for Non-MRS Applications

Task 1: JavaScript Video Event Handlers

3 The Building Blocks: Data Types, Literals, and Variables

COMP519 Practical 5 JavaScript (1)

ajax1.html 1/2 lectures/9/src/ajax/ ajax1.html 2/2 lectures/9/src/ajax/

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

Creating Web Pages Using HTML

Assignment 11 (NF) - Repetition

Everything you need to know to get you started. By Kevin DeRudder

IT2353 Web Technology Important Questions 2 Marks and 16 Marks Unit 1 Part A 1. Differentiate Internet with Intranet. 2. What are HTML tags? 3.

Server-Side Web Programming: Python (Part 1) Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Chapter 1 FORMS. SYS-ED/ Computer Education Techniques, Inc.

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

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

Programming language components

1.1 Text Alternatives: Provide text alternatives for any non-text content. 3.1 Readable: Make text content readable and understandable.

Session 3: JavaScript - Structured Programming

Submitting forms (client-side)

New Media Production Lecture 7 Javascript

How to Make a Contact Us PAGE in Dreamweaver

COM1004 Web and Internet Technology

Demonstration of Servlet, JSP with Tomcat, JavaDB in NetBeans

The HTTP Protocol HTTP

Transcription:

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 1 Script showing use of variables in JavaScript JavaScript 2 Script showing use of arrays in JavaScript. JavaScript 3 Script showing user defined functions JavaScript 4 Script showing how JavaScript places code in the browser window JavaScript 5 Script showing use of alert dialog box JavaScript 6 Script showing use of prompt dialog box JavaScript 7 Script showing use of Confirm dialog box JavaScript 8 Program showing JavaScript front-end validation JavaScript 9 Program implementing the concept of cookies in JSP JSP 10 Program implementing the concept of session in JSP JSP 2

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 1 Branch: CSE Semester: V Objective: Script showing use of variables in JavaScript Program: <HTML> <HEAD> <SCRIPT Language = JavaScript> var name = prompt("enter your name", "Name"); </SCRIPT> </HEAD> <BODY> <SCRIPT Language = "JavaScript"> document.write("<h2> Hello " + name + "</H2>"); </SCRIPT> </BODY> </HTML> Outcome: Students will understand the concept of variables in javascript. 3

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 2 Branch: CSE Semester: V Objective: Script showing use of arrays in JavaScript. In following script an array is used with hard coded values.displaying the values of the array elements in the browser makes use of an array s join() method to print the array elements in a single line. <HTML> <HEAD><TITLE>Viewing the array elements of a JavaScript Array</TITLE></HEAD> <BODY> <SCRIPT language = "JavaScript"> <!-- Begin Hiding JavaScript friends = new Array(5); friends[0] = "Ananth"; friends[1] = "Cedric"; friends[2] = "Ketan"; friends[3] = "Rohan"; friends[4] = "Leela"; document.write(friends[0] + "<BR>"); document.write(friends[1] + "<BR>"); document.write(friends[2] + "<BR>"); document.write(friends[3] + "<BR>"); document.write(friends[4] + "<BR>"); 4

join_crit= friends.join(); document.write(join_crit); // End hiding JavaScript --> </SCRIPT> </BODY> </HTML> Outcome: Students will understand the concept of arrays in javascript. 5

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 3 Branch: CSE Semester: V Objective: Script showing user defined functions <HTML> <HEAD> <TITLE>Creating and Using User Defined Functions</TITLE> <SCRIPT Language="JavaScript"> var name = ""; function hello() { name = prompt('enter Your Name:', 'Name'); alert('greetings ' + name + ', Welcome to my page!'); function goodbye() { alert('goodbye ' + name + ', Sorry to see you go!'); </SCRIPT> </HEAD> <BODY onload="hello();" onunload="goodbye();"> <IMG SRC="images/Pinkwhit.gif"> </BODY> </HTML> Outcome: Students will understand the concepts of user defined system. 6

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 4 Branch: CSE Semester: V Objective: Script showing how JavaScript places code in the browser window <HTML> <HEAD><TITLE>Outputting Text </TITLE></HEAD> <BODY><CENTER><BR><BR> <IMG Height=100 Src="Images/sctfamil.gif" Width=100>Silicon Chip Technologies.<BR> <SCRIPT Language = "Javascript"> document.write("<br><br>"); Width=100>'); document.write('<img Height=100 Src="Images/sctfamil.gif" </HTML> </SCRIPT> </CENTER></BODY> document.write("<b>silicon Chip Technologies.</B><BR>"); Outcome: Students will understand the concepts of javascript places code in the browser windows. 7

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 5 Branch: CSE Semester: V Objective: Script showing use of alert dialog box <HTML> <HEAD><TITLE>Example</TITLE></HEAD> <BODY><SCRIPT Language="Javascript"> alert("welcome To My Web Site!"); document.write('<img Src="Images/welcome.gif">'); </SCRIPT></BODY> </HTML> Outcome: Students will understand the concepts of alert dialog box. 8

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 6 Branch: CSE Semester: V Objective: Script showing use of prompt dialog box <HTML> <HEAD><TITLE>Example</TITLE></HEAD> <BODY><SCRIPT Language="Javascript"> alert("welcome To My Web Site!"); document.write('<img Src="Images/welcome.gif">'); </SCRIPT></BODY> </HTML> Outcome: Students will understand the concepts of prompt dialog box. 9

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 7 Branch: CSE Semester: V Objective:Script showing use of Confirm dialog box <HTML> <HEAD> <TITLE> Confirm Method </TITLE> <SCRIPT LANGUAGE="JavaScript"> var question = "What is 10+10?"; var answer = 20; var correct = '<IMG Src="images/man2.gif">'; var incorrect ='<IMG Src="images/man1.gif">'; var Response = prompt(question,"0"); for(count = 1; count < 3; count++) { if(response!= answer) { if( confirm("wrong, Press OK For Another Chance") ) { Response = prompt(question,"0"); else { alert("better Luck Next Time"); count = 3; 10

else { alert("great!! Your Are Right"); count = 3; var output = (Response == answer)? correct : incorrect; document.write("<br>"); document.write(output); </SCRIPT> </HEAD> <BODY></BODY> </HTML> Outcome: Students will understand the concept of confirmation dialogue box. 11

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 8 Branch: CSE Semester: V Objective: Program showing JavaScript front-end validation <HTML> <HEAD> <TITLE>Creating and Using Validation function</title> <SCRIPT Language="JavaScript"> functionformvalidator(){ // Make quick references to our fields varfirstname = document.getelementbyid('firstname'); varaddr = document.getelementbyid('addr'); var zip = document.getelementbyid('zip'); var state = document.getelementbyid('state'); var username = document.getelementbyid('username'); var email = document.getelementbyid('email'); // Check each input in the order that it appears in the form! if(isalphabet(firstname, "Please enter only letters for your name")){ if(isalphanumeric(addr, "Numbers and Letters Only for Address")){ if(isnumeric(zip, "Please enter a valid zip code")){ if(madeselection(state, "Please Choose a State")){ 12

if(lengthrestriction(username, 6, 8)){ email address")){ if(emailvalidator(email, "Please enter a valid return true; return false; functionnotempty(elem, helpermsg){ if(elem.value.length == 0){ alert(helpermsg); elem.focus(); // set the focus to this input return false; return true; functionisnumeric(elem, helpermsg){ varnumericexpression = /^[0-9]+$/; 13

if(elem.value.match(numericexpression)){ return true; else{ alert(helpermsg); elem.focus(); return false; functionisalphabet(elem, helpermsg){ varalphaexp = /^[a-za-z]+$/; if(elem.value.match(alphaexp)){ return true; else{ alert(helpermsg); elem.focus(); return false; functionisalphanumeric(elem, helpermsg){ varalphaexp = /^[0-9a-zA-Z]+$/; if(elem.value.match(alphaexp)){ return true; else{ alert(helpermsg); elem.focus(); 14

return false; functionlengthrestriction(elem, min, max){ varuinput = elem.value; if(uinput.length>= min &&uinput.length<= max){ return true; else{ alert("please enter between " +min+ " and " +max+ " characters"); elem.focus(); return false; functionmadeselection(elem, helpermsg){ if(elem.value == "Please Choose"){ alert(helpermsg); elem.focus(); return false; else{ return true; functionemailvalidator(elem, helpermsg){ varemailexp = /^[\w\-\.\+]+\@[a-za-z0-9\.\-]+\.[a-za-z0-9]{2,4$/; 15

if(elem.value.match(emailexp)){ return true; else{ alert(helpermsg); elem.focus(); return false; </script> </head> <form onsubmit='return formvalidator()' > First Name: <input type='text' id='firstname' /><br /> Address: <input type='text' id='addr' /><br /> Zip Code: <input type='text' id='zip' /><br /> State: <select id='state'> <option>please Choose</option> <option>al</option> <option>ca</option> <option>tx</option> <option>wi</option> </select><br /> Username(6-8 characters): <input type='text' id='username' /><br /> Email: <input type='text' id='email' /><br /> <input type='submit' value='check Form' /> </form> </html> 16

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 9 Branch: CSE Semester: V Outcome: Students will understand the concepts java script front-end validation. Objective: Program implementing the concept of cookies in JSP. newhtml.html <html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <form action="maincookie.jsp" method="get"> FIRST NAME:<input type="text" name="first_name"></br> LAST NAME:<input type="text" name="last_name"></br> <input type="submit" value="submit"/> </form> </body> </html> MainCookie.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> <%@page language="java" import="java.util.*" %> <!DOCTYPE html> <html> 17

<head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <h1> Setting Cookie values</h1> First Name:<%=request.getParameter("first_name")%></br> Last Name:<%=request.getParameter("last_name")%></br> <% Cookie firstname=new Cookie("first_name",request.getParameter("first_name")); Cookie lastname=new Cookie("last_name",request.getParameter("last_name")); firstname.setmaxage(60*60*24); lastname.setmaxage(60*60*24); response.addcookie(firstname); response.addcookie(lastname); %> <a href="readcookies.jsp"> Next page to view the cookies value</a> </body> </html> ReadCookies.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> 18

<h1> Reading Cookies</h1> <% Cookie cookie=null; Cookie[] cookies=null; cookies=request.getcookies(); if(cookies!=null) { out.println("<h2> Found ookies name and value</h2>"); for(int i=0;i<cookies.length;i++) { cookie=cookies[i]; out.print("name:"+cookie.getname()+","); out.print("value:"+cookie.getvalue()+"</br>"); else { out.println("no cookies found"); %> </body> </html> Outcome: Students will understand the concepts of cookies in JSP. 19

Course Name: Advance java programming Experiment No. 10 Course Code : PCS-553 Faculty : Mr.UpendraBisht Branch: CSE Semester: V Objective:Program implementing the concept of session in JSP Index.html <html> <head> <title>using session in JSP</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <form action="newjsp.jsp" method="post"> Enter your name<input type="text" name="name"/> Enter your password<input type="password" name="pwd"/> <input type="submit" value="submit"/> </form> </body> </html> Newjsp.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> 20

<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>jsp Page</title> </head> <body> <% String name=request.getparameter("name"); String password=request.getparameter("pwd"); if(name.equals("ub") &&password.equals("dbit")) { session.setattribute("username",name); response.sendredirect("newjsp1.jsp"); else { out.print("<b><center> Sorry dear you are not good enough to learn jsp</center></b>"); %> </body> </html> Newjsp1.jsp 21

Course Name: Advance java programming Course Code : PCS-553 Faculty : Mr.UpendraBisht Experiment No. 2 Branch: CSE Semester: V <%@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> <center> <b> Hello dear,"<%=session.getattribute("username")%>", Welcome to the amazing world of JSP</b> </center> </body> </html> Outcome: Students will understand the concepts of session handling. 22