WT Lab Manualpdf
WT Lab Manualpdf
WT Lab Manualpdf
Table of Content
Sr. No Content
1. Assignment List
2. Assignment No.1
3. Assignment No.2
4. Assignment No.3
5. Assignment No.4
6. Assignment No.5
7. Assignment No.6
8. Assignment No.7
9. Assignment No.8
1. Case Study: Before coding of the website, planning is important, students should visit different
websites (Min. 5) for the different client projects and note down the evaluation results for these
websites, either good website or bad website in following format:
Sr. Website URL Purpose of Things liked in Things disliked in Overall evaluation
No. Website website website in website
From the evaluation, students should learn and conclude different website design issues, which
should be considered while developing a website.
2. Implement a web page index.htm for any client website (e.g. a restaurant website project) using
following:
a. HTML syntax: heading tags, basic tags & attributes, frames, tables, images, lists, links for
text & images, forms etc.
b. Use of Internal CSS, Inline CSS, External CSS
3. Design the XML document to store the information of the employees of any business organizatio
and demonstrate the use of:
a) DTD
b) XML Schema
And display the content in (e.g. tabular format) by using CSS/XSL.
8. Design a login page with entries for name, mobile number email id and login button. Use
struts and perform following validations
c. Validation for correct names
d. Validation for mobile numbers
e. Validation for email id
f. Validation if no entered any value
g. Re-display for wrongly entered values with message
h. Congratulations and welcome page upon successful entries.
i.
9. Design an application using Angular JS. e.g. Design registration (first name, last name,
username, password) and login page using Angular JS.
10. Design and implement a business interface with necessary business logic for any web
application using EJB.
e.g. Design and implement the web application logic for deposit and withdraw amount
transactions using EJB.
Assignment No. : 1
TITLE
1. Case Study: Before coding of the website, planning is important, students should visit different
websites (Min. 5) for the different client projects and note down the evaluation results for these
websites, either good website or bad website in following format:
Sr. Website URL Purpose of Things liked in Things disliked in Overall evaluation
No. Website website website in website
From the evaluation, students should learn and conclude different website design issues, which
should be considered while developing a website.
OBJECTIVES
THEORY-CONCEPT
1 Site purpose
2 target audience
3 Responsive and mobile friendly
4 Fresh content or outdated content
5 Using understandable language
6 Visual design/ Quality of images
7 Checking navigation link
8 observed speed for page
Page 3
lOMoAR cPSD| 19022837
Before design the website planning is important visit the different websites (for min. 5 website) for
EXECUTION STEPS
different client domain. Do the evaluation of these website for whether website is good or bad by consider
following parameter
Sr. Website URL Purpose of Things liked in Things disliked in Overall evaluation
No. Website website website in website
From the evaluation, conclude different website design and how to design the good website
Hence students has learn how to design good website and what is issue in design the website
Page 4
lOMoAR cPSD| 19022837
Assignment No. : 2
TITLE
PROBLEM STATEMENT
Implement a web page index.htm for any client website (e.g. a restaurant website project) using following:
a. HTML syntax: heading tags, basic tags & attributes, frames, tables, images, lists, links for text &
images, forms etc.
b. Use of Internal CSS, Inline CSS, External CSS
OUTCOME
THEORY-CONCEPT
HTML: HTML is the standard markup language for creating Web pages.
Page 5
lOMoAR cPSD| 19022837
HTML Versions:
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML 5 2014
Table.1: HTML Versions
CSS:
CSS stands for Cascading Style Sheet. It is nothing, but design language intended to simplifythe
process of making web pages presentable.CSS handles the feel and look part of a web page.By
using CSS, one can control the color of text, style of fonts, spacing between paragraphs, layout
designs.
Advantages of CSS:
It saves the time, Pages load faster, Easy maintenance, Superior styles to HTML, Multiple
Device Compatibility, Global web standards, Offline Browsing, Platform Independence.
CSS3 Modules:
CSS3 Modules are having old CSS specifications as well as extension features.
Box Model
Selectors
Background
Border
Image Values and Replaced Content
Text Effects
Page 6
lOMoAR cPSD| 19022837
Animations
2D/3D Transformations
Multiple Column Layout
User Interface
TECHNOLOGY / TOOL
Inline - by using the style attribute in HTML elements. An inline CSS is used to apply a
unique style to a single HTML element.
Internal - by using a <style> element in the <head> section. An internal CSS is used to
define a style for a single HTML page. An internal CSS is defined in the <head> section
of an HTML page, within a <style> element.
Example:<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
Page 7
lOMoAR cPSD| 19022837
External - by using an external CSS file. An external style sheet is used to define the style
for many HTML pages. With an external style sheet, you can change the look of an entire
web site, by changing one file!To use an external style sheet, add a link to it in the
<head> section of the HTML page.
Use the HTML <head> element to store <style> and <link> elements
Use the CSS color property for text colors
Use the CSS font-family property for text fonts
Use the CSS font-size property for text sizes
Use the CSS border property for borders
Use the CSS padding property for space inside the border
Use the CSS margin property for space outside the border
TEST CASES
CONCLUSION/ANALYSIS
Hence, we have designed static web pages using HTML and CSS.
Page 8
lOMoAR cPSD| 19022837
ORAL QUESTIONS
Page 9
lOMoAR cPSD| 19022837
Assignment No. : 3
TITLE
PROBLEM STATEMENT
Design the XML document to store the information of the employees of any business organization and
demonstrate the use of:
a) DTD
b) XML Schema
And display the content in (e.g., tabular format) by using CSS/XSL
OUTCOMES
Software Reqquirement:
1. Operating System: Windows 7/8/10/Ubuntu
2. Browser: Firefox/Google Chrome/ Microsoft Edge etc.
3. Software : Sublime Text editor/ Notepad/ Notepad++, Eclipse (for DTD)
THEORY-CONCEPT
XML stands for Extensible Markup Language. It is nothing but the text-based markup language
which is derived from Standard Generalized Markup Language(SGML).
XML tags identify the data and are used to store and organize the data, rather than specifying how
to display it like HTML tags, which are used to display the data. XML is not going to replace
HTML in the near future, but it introduces new possibilities by adopting many successful features
of HTML.
Page 10
lOMoAR cPSD| 19022837
There are three important characteristics of XML that make it useful in a variety of systems and
solutions −
XML is extensible − XML allows you to create your own self-descriptive tags, or
language, that suits your application.
XML carries the data, does not present it − XML allows you to store the data irrespective
of how it will be presented.
XML is a public standard − XML was developed by an organization called the World Wide
Web Consortium (W3C) and is available as an open standard.
TECHNOLOGY/TOOL
The XML document have an XML declaration, but it is optional, and it is written as−
<? xml version = "1.0" encoding = "UTF-8"?>
Where version is nothing but the version of an XML document and UTF specifies the character-
encoding used in the document.
Each XML-element needs to be closed either with start or with end elements as shown below −
<element>………</element>
An XML document can have only one root element.
<root>
<x>...</x>
<y>...</y>
</root>
XML Attributes:
Using a name/value pair, an attribute specifies a single property for an element. An XML-
element can have one or more attributes. For example −
DESIGN/EXECUTION STEPS
TEST CASES
CONCLUSION/ANALYSIS
Hence, we have designed static web pages using XML and CSS
ORAL QUESTIONS
Page 12
lOMoAR cPSD| 19022837
Assignment No. - 4
TITLE
PROBLEM STATEMENT
Write a program to design registration form for students by using HTML, CSS& Java Script and
perform following validations: all fields mandatory, phone number and email address validation.
OUTCOMES
THEORY-CONCEPT
Advantages:
Increased interactivity
Richer interfaces
Validation:
When client enters the all necessary data and press the submit button form validation is
done at server side If data entered by a client is incorrect or missing, the server needs to send all
data back to the client and request for resubmission of form with correct information. This is
really a lengthy process which puts a lot of load(burden) on the server.
So, JavaScript provides a way to validate form's data on the client's side itself before sending it
to the web server. Form validation performs two functions-
Basic Validation –First of all the form must be checked to make sure all the mandatory
fields are filled in. It would require just a loop through each field in the form and check
for the data.
Data Format Validation − Secondly, the data that is entered must be checked for correct
format and its value. The code must include appropriate logic to test correctness of data.
TECHNOLOGY/TOOL
JavaScript can be implemented using JavaScript statements that are placed within the <script>.
You can place the <script> tags, containing your JavaScript, anywhere within your web page,
but it is normally recommended that you should keep it within the <head> tags.
Language − This attribute specifies what scripting language you are using. Typically, its
value will be JavaScript. Although recent versions of HTML (and XHTML, its successor)
have phased out the use of this attribute.
Type − This attribute is what is now recommended to indicate the scripting language in
use and its value should be set to "text/javascript".
Page 14
lOMoAR cPSD| 19022837
DESIGN/EXECUTION STEPS
TEST CASES
CONCLUSION/ANALYSIS
Page 15
lOMoAR cPSD| 19022837
ORAL QUESTIONS
1. Name some Java Script features.
2. How to define anonymous function?
3. What is callback?
4. What is the difference between undefined and not-defined in JavaScript?
5. What is „closure‟ in JavaScript?
6. What are JavaScript data types?
7. What are all the types of Pop up boxes available in JavaScript?
Page 16
lOMoAR cPSD| 19022837
Assignment No. - 05
TITLE
OBJECTIVES
PROBLEM STATEMENTS
1. Design and Build Student Login Page using JSP, Servlet and MySQL.
2. Design and Build Employee Login Page using JSP, Servlet and MySQL.
.
OUTCOMES
SOFTWARE NEEDED
Page 17
lOMoAR cPSD| 19022837
THEORY - CONCEPT
Java Server Pages (JSP): It is a server side programming technology that is used to create
dynamic web-based applications. JSP have right to use the complete Java APIs, including the
JDBC API to access the databases.
It is a technology that helps software developers to create dynamic web pages based on HTML,
XML and other document types. It was released in 1999 by Sun Microsystems. It is just like a
PHP and ASP, but it uses the Java programming language.
A JSP element is a type of java servlet that is designed to accomplish the role of a user interface
for a java web application. Web developers write JSPs as text files that combine HTML or
XHTML code, XML elements, and rooted JSP actions and commands.
Using JSP, you can collect input from users through webpage forms, current records from a
database or another source and create web pages dynamically.
JSP tags can be used for different purposes, such as retrieving information from a database or
registering user preferences, accessing JavaBeans components, passing control between pages,
and sharing information between requests, pages etc.
Page 18
lOMoAR cPSD| 19022837
<body>
<%
out.println("Welcome to JSP Class");
%>
</body>
</html>
Output:
Welcome to JSP Class
Servlet:
A Servlet is a server side program and written in Java. Servlet is a web component that is deployed
on the server for creating the dynamic web pages. A Java servlet is a Java program thatextends the
capabilities of a server. Although servlets can respond to any types of requests, they most
commonly execute applications hosted on Web servers.
Page 19
lOMoAR cPSD| 19022837
TECHNOLOGY/TOOL IN BRIEF
NetBeans: NetBeans is an IDE, used for quickly and easily developing java desktop, mobile, and
web applications, as well as HTML5 applications with HTML, JavaScript, and CSS. Also provides
a huge set of tools for PHP and C/C++ developers. It is free and open source tool and has a great
community of users and developers around the world.
MySQL: MySQL is a freely available open source Relational Database Management System
(RDBMS). It uses the Structured Query Language (SQL).
SQL is the most popular language for adding, accessing and managing data in a database. It is
most noted for its quick processing, proven reliability, ease and flexibility of use. MySQL is an
essential part of almost every open source PHP application. Good examples for PHP & MySQL-
based scripts are WordPress, Joomla, Magento and Drupal.
Page 20
lOMoAR cPSD| 19022837
TEST CASES
Manual testing is used to validate the fields like username, password, mobile number and email
id‟s of the users entered by user with the database.
CONCLUSION / ANALYSIS
Hence, we have performed the dynamic web application using JSP, Servlet and MySQL.
Page 21
lOMoAR cPSD| 19022837
ORAL QUESTIONS
1. What is JSP?
2. What is Servlet?
3. What is the purpose of MySQL?
4. What is database?
5. What is the syntax of JSP?
6. How do we connect JSP file to database?
Page 22
lOMoAR cPSD| 19022837
Assignments no: 06
TITLE
Add dynamic web application essence using PHP, HTML and MySQL.
OBJECTIVES
To understand the principles and methodologies of PHP web based applications development
process,
PROBLEM STATEMENT
Design and develop dynamic web application using PHP and MySQL as a back-end for employee
data with insert, delete, view and update operations.
OUTCOMES
Page 23
lOMoAR cPSD| 19022837
THEORY-CONCEPT
1. PHP:
The PHP Hypertext Preprocessor (PHP) began as a little open source venture that advanced as an
ever increasing number of individuals discovered how valuable it was. Rasmus Lerdorf released
the principal form of PHP route in 1994. PHP is a recursive acronym for "PHP: Hypertext
Preprocessor".
PHP is a server side scripting dialect that is installed in HTML. It is utilized to oversee dynamic
substance, databases, session following, even form whole internet business locales. It is
incorporated with various prevalent databases, including MySQL, PostgreSQL, Oracle, Sybase,
Informix, and Microsoft SQL Server.
PHP is pleasingly zippy in its execution, particularly when gathered as an Apache module on the
Unix side. The MySQL server, once began, executes even extremely complex questions with
colossal outcome sets in record-setting time.
PHP bolsters a substantial number of real conventions, for example, POP3, IMAP, and LDAP.
PHP4 included help for Java and conveyed question designs (COM and CORBA), making n- level
improvement a plausibility out of the blue. PHP is excusing: PHP dialect tries to be as pardoning
as would be prudent. PHP Syntax is C-Like.
PHP performs framework capacities, i.e. from documents on a framework it can make, open, read,
compose, and close them. PHP can deal with frames, i.e. accumulate information from records,
spare information to a document; through email you can send information, returninformation to
the client.
You include, erase, adjust components inside your database through PHP. Access treats factors
and set treats. Utilizing PHP, you can confine clients to get to a few pages of your site. It can
encode information.
Page 24
lOMoAR cPSD| 19022837
Example:
To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an essential
example, first we will create a friendly little "Hello, World!" script.
As mentioned earlier, PHP is embedded in HTML. That means that in amongst your normal
HTML (or XHTML if you're cutting-edge) you'll have PHP statements like this –
<html>
<head>
</head>
<body>
</body>
</html>
To create and run PHP Web pages three fundamental parts should be introduced on your PC
framework.
Web Server − PHP will work with for all intents and purposes all Web Server programming,
including Microsoft's Internet Information Server (IIS) however then regularly utilized is
unreservedly accessible Apache Server. Download Apache for nothing here −
https://httpd.apache.org/download.cgi
Database − PHP will work with for all intents and purposes all database programming, including
Oracle and Sybase yet most regularly utilized is uninhibitedly accessible MySQL database.
Download MySQL for nothing here − https://www.mysql.com/downloads/
Page 25
lOMoAR cPSD| 19022837
PHP Parser − keeping in mind the end goal to process PHP content directions a parser must be
introduced to create HTML yield that can be sent to the Web Browser. This instructional exercise
will manage you how to introduce PHP parser on your PC.
2. MySQL:
MySQL is the most famous Open Source Relational SQL Database Management System.MySQL
is outstanding amongst other RDBMS being utilized for creating different online programming
applications. MySQL is created, advertised and upheld by MySQL AB, which isa Swedish
organization. This instructional exercise will give you a fast begin to MySQL and make you OK
with MySQL programming.
What is a Database?
A database is a different application that stores a gathering of information. Every database has
at least one unmistakable APIs for making, getting to, overseeing, seeking and recreating the
information it holds.
Different sorts of information stores can likewise be utilized, for example, records on the
document framework or vast hash tables in memory yet information getting and composing would
not be so quick and simple with those kind of frameworks.
These days, we utilize social database administration frameworks (RDBMS) to store and oversee
tremendous volume of information. This is called social database since every one of the
information is put away into various tables and relations are set up utilizing essential keys or
different keys known as Foreign Keys.
RDBMS Terminology
Before we continue to clarify the MySQL database framework, let us modify a couple of
definitions identified with the database.
Page 26
lOMoAR cPSD| 19022837
MySQL Database
MySQL is a quick, simple to-utilize RDBMS being utilized for some little and huge
organizations. MySQL is produced, showcased and upheld by MySQL AB, which is a Swedish
organization. MySQL is winding up so famous as a result of numerous great reasons:
MySQL is discharged under an open-source permit. So you don't have anything to pay to
utilize it.
MySQL is a capable program in its own particular right. It handles a huge subset of the
usefulness of the most costly and intense database bundles.
MySQL utilizes a standard type of the outstanding SQL information dialect.
MySQL takes a shot at many working frameworks and with numerous dialects including
PHP, PERL, C, C++, JAVA, and so forth.
MySQL works rapidly and functions admirably even with extensive informational
indexes.
MySQL is amicable to PHP, the most refreshing dialect for web advancement.
MySQL underpins huge databases, up to 50 million lines or more in a table. The default
document measure restrain for a table is 4GB, yet you can expand this (if your working
framework can deal with it) to a hypothetical utmost of 8 million terabytes (TB).
Page 27
lOMoAR cPSD| 19022837
MySQL is adaptable. The open-source GPL permit enables developers to alter the
MySQL programming to fit their own particular surroundings.
TECHNOLOGY/TOOL
1. Technology is to be used is PHP (PHP Hypertext Preprocessor) and tool XAMPP server is to
be used to execute PHP web application.
2. XAMPP server embeds the PHP, MySQL and phpmyadmin, these three tools must be
required to run php web application.
DESIGN/EXECUTION STEPS
For the design purpose html and CSS is to be used. For this design part contains the GUI of web
applications, how its looks like? When users going to use the web application.
Steps to install XAMPP and configure the PHP, MYSQL server.
1. Download the XAMPP using following link (download latest version as per your Operating system
Windows/ Linux). Here we are using Linux Ubuntu Systems. Copy and paste downloaded XAMPP
into home location. https://www.apachefriends.org/download.html
3. After ab
4. ove command following installation window will appear.
Page 28
lOMoAR cPSD| 19022837
after successful completion of installation. It will ask to run XAMPP and here say to run. After run
the MySQL and Apache web server should be in running state. See below image.
As per above image you are ready with Apache Web Server and MySQL Database.
Page 29
lOMoAR cPSD| 19022837
after you become the root just type the following command to enter the root directory
cd /
“opt” is the directory in which XAMPP is installed by default.
6. As you have successfully installed and started XAMPP now just navigate to htdocs by typing the
following command into terminal:
Note: to edit or create any file in htdocs you need to be root : sudo -i
cd /
Page 30
lOMoAR cPSD| 19022837
8. To navigate to htdocs
cd opt/lampp/htdocs
gedit hello.php
Code for Sample Hello Script
<?php
?>
Here you can create the database and table inside database as per your need.Here we created “test”
database with “users” table contain four columns.
Page 31
lOMoAR cPSD| 19022837
CONCLUSION/ANALYSIS
In this assignment, we have studied how to design and develop small web application using PHP
script, XAMPP server with apache server and MySQL as backend.
Page 32
lOMoAR cPSD| 19022837
ORAL QUESTIONS
10. What is JOIN in MySQL? What are the different types of join?
Page 33
lOMoAR cPSD| 19022837
Assignments no: 07
TITLE
Add dynamic web application essence using PHP, AJAX and MySQL.
OBJECTIVES
To understand the principles and methodologies of web based applications development process,
PROBLEM STATEMENT
Design and develop dynamic web application using PHP, AJAX and MySQL as a back-end for
employee data with insert and view operations.
OUTCOMES
Page 34
lOMoAR cPSD| 19022837
THEORY-CONCEPT
AJAX remains for Asynchronous JavaScript and XML. AJAX is another procedure for makingbetter,
speedier, and more intelligent dynamic web applications with the assistance of XML, HTML, CSS,
and Java Script. Ajax utilizes XHTML for content, CSS for introduction, alongside Document Object
Model and JavaScript for dynamic substance show.
Customary web applications transmit data to and from the server utilizing synchronous solicitations. It
implies you round out a frame, hit submit, and get coordinated to another page with new data from the
server. With AJAX, when you hit submit, JavaScript will influence a demand to the server, to decipher
the outcomes, and refresh the present screen. In the purest sense, the client could never realize that
anything was even transmitted to the server.
AJAX instructional exercise covers ideas and cases of AJAX innovation for apprentices and experts.
AJAX is an acronym for Asynchronous JavaScript and XML. It is a gathering of between related
innovations like JavaScript, DOM, XML, HTML, CSS and so forth.
AJAX enables you to send and get information nonconcurrently without reloading the page. So it is
quick.
AJAX enables you to send just essential data to the server not the whole page. So just profitable
information from the customer side is steered to the server side. It makes your application intuitive and
quicker.
AJAX speaks with the server utilizing XMLHttpRequest question. How about we endeavor to
comprehend the stream of ajax or how ajax functions by the picture showed beneath.
AJAX communicates with the server using XML Http Request object. Let's try to understand the
flow of ajax or how ajax works by the image displayed below:
Page 35
lOMoAR cPSD| 19022837
Figure.4: AJAX communication with the server using XML Http Request object
As you can see in the above example, XML Http Request object plays an important role.
TECHNOLOGY/TOOL
DESIGN/EXECUTION STEPS
For the design purpose html and CSS is to be used. For this design part contains the GUI of web
applications, how its looks like? When users going to use the web application.
CONCLUSION/ANALYSIS
In this assignment, we have studied how to design and develop small web application using PHP
java script, ajax, XAMPP server with apache server and MySQL as backend.
Page 36
lOMoAR cPSD| 19022837
ORAL QUESTIONS
1. What is AJAX?
2. What is jQuery?
3. How many TRIGGERS allows per table in mysql?
4. What is difference between COMMIT and ROLLBACK?
5. What is Ajax?
6. Whether jQuery HTML work for both HTML and XML documents?
7. What is the use of jQuery.ajax method ()?
8. What are Ajax applications?
9. How to control the duration of an Ajax request?
10. What are the advantages and disadvantages of Ajax?
11. Which are the two methods used for cross domain Ajax calls?
12. What are all the technologies used by Ajax?
13. What is JSON in Ajax?
14. What are the difference between AJAX and Javascript?
15. How Ajax objects can be created?
Page 37
lOMoAR cPSD| 19022837
Assignment No: 08
TITLE
OBJECTIVES
1. To impart the efficient and available client side and server side technologies.
2. To implement the communication between computing nodes using client side and server
side technologies.
3. To design and implement the web services with content management.
PROBLEM STATEMENT
Create a login module for the web application using struts framework.
OUTCOMES
1. Implement the effective client side and server side technologies using struts framework.
2. Solve the complex problem of development using MVC framework.
Software‟s: Java 1.7 or Higher, Apache Tomcat 7 or higher, Struts API‟s, Eclipse IDE.
THEORY
The frameworks plays a vital role in industries for manageable and well designed application development
as well as enterprise application development. The core of the Struts framework is a flexiblecontrol layer
based on standard technologies like Java Servlets, JavaBeans, Resource Bundles, and XML, as well as
various Jakarta Commons packages. Struts encourages application architectures based on the Model 2
approach, a variation of the classic Model-View-Controller(MVC)
Page 38
lOMoAR cPSD| 19022837
Struts gives its own particular Controller segment and incorporates with different advancements to give the
Model and the View. For the Model, Struts can collaborate with standard information get to advances,as
JDBC and EJB, and also most any outsider bundles, as Hibernate, iBATIS, or Object Relational Bridge.
For the View, Struts functions admirably with Java Server Pages, including JSTL and JSF, and in addition
Velocity Templates, XSLT, and other introduction frameworks.
The Struts system gives the undetectable underpinnings each expert web application needs to survive. Struts
causes you make an extensible advancement condition for your application, in view of distributed
guidelines and demonstrated outline designs.
ORM remains for Object/Relational mapping. It is the customized and translucent constancy of items in a
Java application in to the tables of a social database utilizing the metadata that portrays the mapping
between the articles and the database. It works by changing the information starting with one portrayal then
onto the next.
Page 39
lOMoAR cPSD| 19022837
The "view" is the user interface, the screens that the end user of the application actually sees and
interacts with. In a J2EE web application, views are JSP files. For collecting user input, you will
have a JSP that generates an HTML page that contains one or more HTML forms. For displaying
output (like a report), you will have a JSP generates an HTML page that probably contains one
or more HTML tables. Each of these is a view: a way for the end user to interact with the system,
putting data in, and getting data out.
What is Struts?
Struts Tags
Common Attributes
Almost all tags provided by the Struts framework use the following attributes:
Page 40
lOMoAR cPSD| 19022837
Creating Beans
<!-- Copying an already existent bean, frijole, to a new bean, lima -->
<bean:define id="lima" name="frijole"/>
<!-- Copying an already existent bean, while specifying the class -->
<bean:define id="lima" name="frijole" class="com.SomePackageName.Beans.LimaBean"/>
The Struts framework provides other tags for dealing with issues concerning copying cookies,
request headers, JSP implicity defined objects, request parameters, web application resources,
Page 41
lOMoAR cPSD| 19022837
Struts configuration objects, and including the dynamic response data from an action. These tags
are not discussed here, but it is important to be aware of their existence.
Bean Output
The <bean:message> and <bean:write> tags from the Struts framework will write bean and aplication
resources properties into the current HttpResponse object.
Frequently data should be gathered from a client and handled. Without the capacity to gather client
input, a web application would be futile. So as to get the clients data, a html shape is utilized.
Client information can originate from a few gadgets, for example, content fields, contentboxes,
check takes care of, pop menus, and radio catches. The information comparing to the
Page 42
lOMoAR cPSD| 19022837
client input is put away in an ActionForm class. A design document called struts-config.xml is
utilized to characterize precisely how the client input are handled. The following diagram roughly
depicts the use of Struts for using forms.
The Struts html tags are used to generate the widgets in the html that will be used in gathering
the user‟s data. There are also tags to create a form element, html body elements, links, images,
and other common html elements as well as displaying errors. Below are the tags provided by html
section of the Struts framework and a short description of each.
<html:base> Generates a <base> tag. This tag should be used inside of a <head>
tag.
<html:button> Generates an <input type="button"> tag. This tag should be used inside
a <form> element.
<html:cancel> Generates an <input type="submit"> tag and causes the Action servlet
not to invoke its validate() method. This tag should be used inside a
<form> element.
Page 43
lOMoAR cPSD| 19022837
The purpose of the ActionForm class is to contain and provide validation of the user-input data.
This class is subclassed for application specific customization.
Here is a template for a customized ActionForm class with markers denoting where special items
should be located in the class with $ symbols.
package com.akurdi.action;
import com.opensymphony.xwork2.ActionSupport;
return "error";
if (this.username.equals("admin")
&& this.password.equals("admin123")) {
return "success";
Page 44
lOMoAR cPSD| 19022837
} else {
addActionError(getText("error.login"));
return "error";
return username;
this.username = username;
return password;
this.password = password;
Do this:
1. Create the directory structure. The root directory is SimpleStruts, and it has the standard
WEB-INF directory with classes inside, and com.akurdi.action inside that. It also has a lib
directory within WEB-INF, which is something we haven't seen before; we'll see in a
minute what goes there.
Page 45
lOMoAR cPSD| 19022837
2. Copy the Struts tag library descriptor files into WEB-INF. The files struts.tld, struts-bean.tld,
struts-form.tld, struts-html.tld, struts-logic.tld, and struts-template.tld are available in the lib
directory of your Struts installation.
3. Copy the Struts parser, struts.jar, into WEB-INF/lib/. This file is available in the lib directory
of your Struts installation
4. Create the tag descriptor library file for any custom tags you may use beyond the Struts
tags. In this case, the file defines no custom tags, but it's good practice to have it in place,
in case you need to add your own tags later.
There are three main sections to a struts-config.xml configuration file. They are the "Form
Bean Definitions" section, the "Global Forward Definitions" section, and the "Action
Mapping Definitions" section defines a forward called "success".
The web.xml web application configuration file will need to define the servlet ActionServlet,
to which control will be transferred whenever an appropriate URL pattern is accessed. The
servlet is defined just as any other servlet will be defined. The URL pattern is specified by
a servlet mapping. For this application, the URL pattern is any requested resource that ends
with a .do extension.
In order to use the Struts tags, the .tld files describing the tags will need to be included in
the configuration file. The references to these tags are made just as they were for our own
custom tags in the previous chapter. The Struts framework is simply a complex set of tag
libraries (struts*.tld), with associated code (struts.jar).
7. The ApplicationResources.properties file provides resources that will be used by any subclassed
Struts classes (for example, SetNameAction). This resources file provides a place to define
prompts, labels that will display on buttons, and other information that may change. By
placing this information in the ApplicationResources.properties file, recompiling any servlets
used in the application can be avoided, as well as encouraging separation of logic and
presentation.
8. Instances of the Name class are placed in the user sessions. Only one will exist in any
particular user session. It provides methods for accessing and mutating a name.
9. The view of the application is done with the JSP index.jsp. It represents the user interface
and allows the user to interact with the application.
10. Compile, create .war file and place it into the webapps folder of tocat.
Page 46
lOMoAR cPSD| 19022837
TECHNOLOGY/TOOL
1) Eclipse IDE
2) Apache Tomcat 7.0 or higher
DESIGN/EXECUTION STEPS
Step 5) Map the request in (struts-config.xml) file and define the view components.
Step 7) start server and deploy the project or create .war file paste it in webapps folder and run
from manager-app.
TEST CASES
Page 47
lOMoAR cPSD| 19022837
CONCLUSION/ANALYSIS
Hence we have successfully tested the Struts framework and tested the results.
ORAL QUESTIONS
Page 48
lOMoAR cPSD| 19022837
Assignment No: 09
TITLE
OBJECTIVES
1. Understand the design of single-page applications and how AngularJS facilitates their
development
2. Properly separate the model, view, and controller layers of your application and
implement them using AngularJS
3. Master AngularJS expressions, filters, and scopes
4. Build Angular forms
5. Elegantly implement Ajax in your AngularJS applications
6. Write AngularJS directives
PROBLEM STATEMENT
OUTCOMES
Students can able to,
THEORY-CONCEPT
Page 49
lOMoAR cPSD| 19022837
utilize HTML as your layout dialect and gives you a chance to stretch out HTML's linguistic
structure to express your application parts plainly and compactly. Its information official and
reliance infusion take out a significant part of the code you as of now need to compose. Also,
everything occurs inside the program, making it a perfect band together with any server
innovation".
General Features
AngularJS is a productive system that can make Rich Internet Applications (RIA).
AngularJS gives designers a choices to compose customer side applications utilizing
JavaScript in a spotless Model View Controller (MVC) way.
Applications written in AngularJS are cross-program agreeable. AngularJS consequently
handles JavaScript code reasonable for every program.
AngularJS is open source, totally free, and utilized by a great many engineers the world
over. It is authorized under the Apache permit version2.0.
By and large, AngularJS is a system to assemble expansive scale, elite, and simple to-
keep up web applications.
Core Features:
Page 50
lOMoAR cPSD| 19022837
2. Scope: These are objects that allude to the model. They go about as paste amongst
controller and view.
5. Filters: These select a subset of things from a cluster and restore another exhibit.
7. Templates: These are the rendered see with data from the controller and model. These can
be a solitary record, (for example, index.html) or different perspectives in a single page
utilizing partials.
9. Model View Whatever: MVW is an outline design for isolating an application into various
parts called Model, View, and Controller, each with unmistakable obligations. AngularJS
does not actualize MVC in the conventional sense, yet rather something nearerto MVVM
(Model-View-ViewModel). The Angular JS group alludes it cleverly as Model View
Whatever.
10. Deep Linking: Deep connecting permits to encode the condition of use in the URL with
the goal that it can be bookmarked. The application would then be able to be re- established
from the URL to a similar state.
Page 51
lOMoAR cPSD| 19022837
11. Dependency Injection: AngularJS has a worked in reliance infusion subsystem that
encourages the designer to make, comprehend, and test the applications effectively.
Advantages of AngularJS
It gives the ability to make Single Page Application in a spotless and viable way.
It gives information restricting ability to HTML. Along these lines, it gives client a rich
and responsive experience.
AngularJS code is unit testable.
AngularJS utilizations reliance infusion and make utilization of partition of concerns.
AngularJS gives reusable segments.
With AngularJS, the engineers can accomplish greater usefulness with short code.
In AngularJS, sees are unadulterated html pages, and controllers written in JavaScript do
the business handling.
Page 52
lOMoAR cPSD| 19022837
Model
The model is in chargeof overseeingapplicationinformation.It reacts to the demandfrom see and to the
directions from controller to refresh itself.
The View
An introduction of information in a specific arrangement, activated by the controller's choice to exhibit the
information. Theyare content based layoutframeworks, for example, JSP, ASP, PHPand simple to incorporate
with AJAXinnovation.
The Controller
Page 53
lOMoAR cPSD| 19022837
ng-model − This directive binds the values of AngularJS application data to HTML
input controls.
ng-bind − This directive binds the AngularJS Application data to HTML tags.
DESIGN/EXECUTION STEPS
1. When a link https://angularjs.org/ is opened, there are two options to download AngularJS
library −
View on GitHub − Click on this button to go to GitHub and get all of the latest scripts.
Download AngularJS 1 − Or click on this button, a screen as below would be seen −
Page 54
lOMoAR cPSD| 19022837
CDN access − You also have access to a CDN. The CDN will give you access around
the world to regional data centers that in this case, Google host. This means using CDN
moves the responsibility of hosting files from your own servers to a series of external ones.
This also offers an advantage that if the visitor to your webpage has already downloaded
a copy of AngularJS from the same CDN, it won't have to be re- downloaded.
Example:
Now let us write a simple example using AngularJS library. Let us create an HTML
file myfirstexample.html as below –
<!doctype html>
<html>
<head>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.min.js"></script>
</head>
<bodyng-app="myapp">
<divng-controller="HelloController">
<h2>Welcome {{helloTo.title}} to the world of Tutorialspoint!</h2>
</div>
<script>
angular.module("myapp",[])
.controller("HelloController",function($scope){
Page 55
lOMoAR cPSD| 19022837
$scope.helloTo={};
$scope.helloTo.title="AngularJS";
});
</script>
</body>
</html>
<head>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
To update into latest version of Angular JS, use the following script source.
<head>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.min.js"></script>
</head>
<bodyng-app="myapp">
</body>
3. View
The view is this part −
<divng-controller="HelloController">
<h2>Welcome {{helloTo.title}} to the world of Tutorialspoint!</h2>
Page 56
lOMoAR cPSD| 19022837
</div>
ng-controller tells AngularJS what controller to use with this view. helloTo.titletells AngularJS
to write the "model" value named helloTo.title to the HTML at this location.
4. Controller
The controller part is −
<script>
angular.module("myapp",[])
.controller("HelloController",function($scope){
$scope.helloTo={};
$scope.helloTo.title="AngularJS";
});
</script>
This code registers a controller function named HelloController in the angular module named
myapp. The controller function is registered in angular via the angular.module(...).controller(...)
function call.
The $scope parameter passed to the controller function is the model. The controller function
adds a helloTo JavaScript object, and in that object it adds a title field.
5. Execution
Save the above code as myfirstexample.html and open it in any browser.
Output as below:
At the point when the page is stacked in the program, following things happen −
HTML archive is stacked into the program, and assessed by the program. AngularJS
JavaScript document is stacked, the precise worldwide question is made. Next, JavaScript
which registers controller capacities is executed.
Page 57
lOMoAR cPSD| 19022837
Next AngularJS look over the HTML to search for AngularJS applications and
perspectives. When see is found, it associates that view to the comparing controller work.
Next, AngularJS executes the controller capacities. It at that point renders the perspectives
with information from the model populated by the controller. The page is presently
prepared.
6. HowAngularJSintegrateswithHTML
ng-app directive indicates the start of AngularJS application.
ng-model directive then creates a model variable named "name" which can be used with
the html page and within the div having ng-app directive.
ng-bind then uses the name model to be displayed in the html span tag whenever user
input something in the text box.
Closing</div> tag indicates the end of AngularJS application.
AngularJS directives are used to extend HTML. These are special attributes starting with ng-
prefix. We're going to discuss following directives −
ng-app − This directive starts an AngularJS Application.
ng-init − This directive initializes application data.
ng-model − This directive binds the values of AngularJS application data to HTML
input controls.
ng-repeat − This directive repeats html elements for each item in a collection.
TECHNOLOGY/TOOL
TEST CASES
Deploy the Html program run test the result for dynamic implementation of AngularJS.
CONCLUSION/ANALYSIS
With the help of this assignment it is helpful to understand features of AngularJS. MVC model
structure and its use in advanced web programming is studied.
Page 58
lOMoAR cPSD| 19022837
ORAL QUESTIONS
Page 59
lOMoAR cPSD| 19022837
Assignment No. - 10
TITLE
OUTCOMES
SOFTWARE NEEDED
Page 60
lOMoAR cPSD| 19022837
THEORY – CONCEPT
Java Beans :
J2EE application container contains the components that can be used by the clients for executing
the business logic .These components are known as Enterprise Java Beans (EJB) .
J2EE platform has component based architecture to provide multi-tiered, distributed and highly
transactional features to enterprise level applications.
EJB mainly contains the business logic & business data. EJB component is an EJB class. It is a
java class written by EJB developer & this class implements business logic.
It is used for developing very much scalable and robust enterprise level applications to be
deployed Application Server such as JBOSS, Web Logic etc.
EJB 3.0 is being a large shift from EJB 2.0 and makes development of EJB based applications
relatively easy.
Features of EJBs:
Page 61
lOMoAR cPSD| 19022837
Session Beans
• Session beans are intended to allow the application author to easily implement portions of
application code in middleware and to simplify access to this code.
• Represents a single client inside the server
• The client calls the session bean to invoke methods of an application on the server
• Perform works for its client, hiding the complexity of interaction with other objects in the
server
• Is not shared
• Is not persistent
When the client stops the session, the bean can be assigned to another client from the server
Session beans are divided into two types:
1. Stateless Session Bean:
Stateless Session Bean is intended to be simple and “light weight” components. The client, thereby
making the server highly scalable, if required, maintains any state. Since no state is maintained in
this bean type, stateless session beans are not tied to any specific client, hence any available
instance of a stateless session bean can be used to service a client.
• values only for the duration of the single invocation
• Except during method invocation, all instances of stateless
session bean are equivalent
Stateless Session Bean’s Life Cycle:
• The client invoke the create method
• The EJB container :
Instantiates the bean
Invokes the setSessionContext Invokes ejbCreate
• The bean is ready
• While in the ready state
Page 62
lOMoAR cPSD| 19022837
Does not
Exist
1. setSessionConext ejbRemove
2. ejbcrete
Ready
Figure.9: Stateless Session Bean’s Life Cycle
Stateful session beans can access persistent resources on behalf of the client, but unlike entity
beans, they do not actually represent the data.
EJB container may activate a bean, moving it back to the ready stage, and then calls the bean's
ejbActivate method.
A client may invoke the remove method and the container calls the bean's ejbRemove
method
Stateless:
1. Normally data members are not put in stateless session bean
2. Stateless beans are pooled
Page 63
lOMoAR cPSD| 19022837
Stateful:
1. Data members that represent state are present in stateleful session bean
2. Stateful beans are cached
3. Setting the tag idle-timeout-seconds determines how long data is maintained in stateful
session bean
4. Activation – Passivation used
An Entity Bean
The EJB architecture is an extension of Web architecture. It has an additional tier. The clients of
an enterprise bean can be a traditional java application lie, applet, JSP or Servlet.
Like in a web application, client browser has to go all the way to web container to use a servlet
or JSP, the communication between beans and clients is performed by the EJB container.
Page 64
lOMoAR cPSD| 19022837
EJB server
EJB container
EJB home
interface
Client EJB
bean
EJB remote
interface
There are three types through which two or more activities may interfere:
1. Dirty read
2. Non-Repeatable read
3. Phantom read
Clustering and Load-Balancing: Clustering is the process of combining the multiple
peripherals, computers and other resources into a single unit.
A clustered system then works as load balanced system. In a distributed system when a
request is send to the server, an algorithm running on the server decides which server has
less load and sends the request to that server. EJB container encapsulates these features to
provide smooth and efficient service.
Deployment Descriptor: A deployment descriptor is an XML file packaged with the
enterprise beans in an EJB JAR file or an EAR file. It contains metadata describing the
contents and structure of the enterprise beans, and runtime transaction and security
information for the EJB container.
EJB Server: An EJB server is a high-level process or application that provides a run- time
environment to support the execution of server applications that use enterprise beans. An
EJB server provides a JNDI-accessible naming service. It manages and coordinates the
allocation of resources to client applications, provides access to system resources and
provides a transaction service.
Page 65
lOMoAR cPSD| 19022837
TEST CASES
Manual testing is used to check the application is running properly in JBOSS server
CONCLUSION / ANALYSIS
Hence, we have created a simple EJB 3 stateless session bean and a local Java application client
which will call/invoke the bean to develop for performing addition of two numbers.
Open Eclipse IDE and create a new EJB project which can be done by clicking on, File menu -> New ->
EJB Project
Step 1:
Click File –> New –> Other –> EJB –> EJB Project –> Next
Page 66
lOMoAR cPSD| 19022837
Page 67
lOMoAR cPSD| 19022837
Step 2 :
Now create Stateless session bean with its remote interface. Expand project –> expande
ejbModule –> Right click Session Bean –> New –> Session
Page 68
lOMoAR cPSD| 19022837
Bean
Page 69
lOMoAR cPSD| 19022837
}
}
Step 3:
Page 70
lOMoAR cPSD| 19022837
Now we need to deploy the our EJB "addition" on server. Follow the steps mentioned bellow to
deploy this project on server.
Right click on "JBoss 7.1 Runtime Server" from Servers view and click on Start.
Step 4:
Now next step Go to Project-> addition -> right click -> run-> Run on server
Page 71
lOMoAR cPSD| 19022837
Step 5:
After running the program you can see following message on console
Page 72
lOMoAR cPSD| 19022837
Step 6:
Once this jar file is deployed to server now export EJB jar file save it in desktop -> Finish.
Page 73
lOMoAR cPSD| 19022837
Step 7:
Page 74
lOMoAR cPSD| 19022837
Page 75
lOMoAR cPSD| 19022837
Step 8:
Page 76
lOMoAR cPSD| 19022837
Step 9:
Page 77
lOMoAR cPSD| 19022837
//form.html
Page 78
lOMoAR cPSD| 19022837
Step 10 :
Copy the url from step 5 and add that url in wepappadd code as given above.
Step 11 :
Page 80
lOMoAR cPSD| 19022837
Page 81
lOMoAR cPSD| 19022837
ORAL QUESTIONS
1. What is EJB?
2. What is JSP?
3. What is the purpose of JBOSS?
4. What is the syntax of JSP?
5. How to deploy java beans to server?
Page 82