Unit 4 Web Programming
Unit 4 Web Programming
Pavan R Jaiswal
HTML
JavaScript programming
MVC architecture models
JSP, JSP over servlet
JDBC process with MongoDB
Ajax
Ajax frameworks
Web Programming 6
10/12/2015
The HTML source code should be formatted
to increase readability and facilitate
debugging.
◦ Every block element should start on a new
line.
◦ Every nested (block) element should be
indented.
◦ Browsers ignore multiple whitespaces in the
page source, so formatting is harmless.
For performance reasons, formatting can be
sacrificed
Web Programming 8
10/12/2015
<!DOCTYPE HTML>
<html> Opening
<head>
tag
<title>My First HTML Page</title>
</head>
<body> Closing
<p>This is some text...</p> tag
</body>
</html>
An HTML element consists of an opening tag, a closing tag and the content
inside.
Web Programming 9
10/12/2015
<!DOCTYPE HTML>
HTML
<html>
header
<head>
<title>My First HTML Page</title>
</head>
<body>
<p>This is some text...</p>
</body>
</html>
Web Programming 10
10/12/2015
<!DOCTYPE HTML>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<p>This is some text...</p>
</body>
</html>
HTML body
Web Programming 11
10/12/2015
Hyperlink tags
<a href="http://www.pavanjaiswal.com/"
title=“Blog">Link to personal web site</a>
Image tags
<img src="logo.gif" alt="logo" />
Text formatting tags
This text is <em>emphasized.</em>
<br />new line<br />
This one is <strong>more emphasized.</strong>
Web Programming 12
10/12/2015
some-tags.html
<!DOCTYPE HTML>
<html>
<head>
<title>Simple Tags Demo</title>
</head>
<body>
<a href="http://www.pavanjaiswal.com/" title=
“Blog">This is a link.</a>
<br />
<img src="logo.gif" alt="logo" />
<br />
<strong>Bold</strong> and <em>italic</em> text.
</body>
</html>
Web Programming 13
10/12/2015
some-tags.html
<!DOCTYPE HTML>
<html>
<head>
<title>Simple Tags Demo</title>
</head>
<body>
<a href="http://www.pavanjaiswal.com/" title=
“Blog">This is a link.</a>
<br />
<img src="logo.gif" alt="logo" />
<br />
<strong>Bold</strong> and <em>italic</em> text.
</body>
</html>
Web Programming 14
10/12/2015
Tags can have attributes
◦ Attributes specify properties and behavior
◦ Example:
◦ Few attributes can apply to every element:
id, style, class, title
The id is unique in the document
Content of title attribute is displayed as hint when the
element is hovered with the mouse
Some elements have obligatory attributes
Attribute alt with value
"logo"
Web Programming 15
10/12/2015
Heading Tags (h1 – h6)
<h1>Heading 1</h1>
<h2>Sub heading 2</h2>
<h3>Sub heading 3</h3>
Paragraph Tags
<p>This is my first paragraph</p>
<p>This is my second paragraph</p>
Sections: div and span
<div style="background: skyblue;">
This is a div</div>
Web Programming 16
10/12/2015
headings.html
<!DOCTYPE HTML>
<html>
<head><title>Headings and paragraphs</title></head>
<body>
<h1>Heading 1</h1>
<h2>Sub heading 2</h2>
<h3>Sub heading 3</h3>
<div style="background:skyblue">
This is a div</div>
</body>
</html>
Web Programming 17
10/12/2015
headings.html
<!DOCTYPE HTML>
<html>
<head><title>Headings and paragraphs</title></head>
<body>
<h1>Heading 1</h1>
<h2>Sub heading 2</h2>
<h3>Sub heading 3</h3>
<div style="background:skyblue">
This is a div</div>
</body>
</html>
Web Programming 18
10/12/2015
It is important to have the correct vision and
attitude towards HTML
◦ HTML is only about structure, not appearance
◦ Browsers tolerate invalid HTML code and parse
errors – you should not.
Web Programming 20
10/12/2015
XHTML is more strict than HTML
◦ Tags and attribute names must be in lowercase
◦ All tags must be closed (<br/>, <img/>) while HTML
allows <br> and <img> and implies missing closing tags
(<p>par1 <p>par2)
◦ XHTML allows only one root <html> element (HTML
allows more than one)
Web Programming 22
10/12/2015
Contains information that doesn’t show directly
on the viewable page
Starts after the <!doctype> declaration
Begins with <head> and ends with </head>
Contains mandatory single <title> tag
Can contain some other tags, e.g.
◦ <meta>
◦ <script>
◦ <style>
◦ <!–- comments -->
Web Programming 24
10/12/2015
The <script> element is used to embed
scripts into an HTML document
◦ Script are executed in the client's Web browser
◦ Scripts can live in the <head> and in the <body>
sections
Supported client-side scripting languages:
◦ JavaScript (it is not Java!)
◦ VBScript
◦ JScript
Web Programming 28
10/12/2015
The <body> section describes the viewable
portion of the page
Starts after the <head> </head> section
Begins with <body> and ends with </body>
<html>
<head><title>Test page</title></head>
<body>
<!-- This is the Web page body -->
</body>
</html>
Web Programming 29
10/12/2015
Text formatting tags modify the text between
the opening tag and the closing tag
◦ Ex. <b>Hello</b> makes “Hello” bold
<b></b> bold
<i></i> italicized
<u></u> underlined
<sup></sup> Samplesuperscript
<sub></sub> Samplesubscript
<strong></strong> strong
<em></em> emphasized
<pre></pre> Preformatted text
<blockquote></blockquote> Quoted text block
<del></del> Deleted text – strike through
30
Web Programming 10/12/2015 31
Browsers have limited functionality
◦ Text, images, tables, frames
JavaScript allows for interactivity
Browser/page manipulation
◦ Reacting to user actions
A type of programming language
◦ Easy to learn
◦ Developed by Netscape
◦ Now a standard exists –
www.ecma-international.org/publications/
standards/ECMA-262.HTM
</script>
</body>
</html>
document.write('<h1>This is my first
JavaScript Page</h1>');
</script>
</body> HTML written
</html> inside JavaScript
<form>
<input type="button" Value="Press"
onClick="window.alert('Hello');">
</form>
Note quotes: " and '
document.addressform.yourname.value
document.addressform.phone.value
document.addressform.email.value
<form name="alertform">
Enter your name:
<input type="text" name="yourname">
<input type="button" value= "Go"
onClick="window.alert('Hello ' +
document.alertform.yourname.value);">
</form>
16
-
Web Programming 10/12/2015 76
MVC is understood by different people in
different ways
It is often misunderstood, but most software
developers will say it is important; powerful
Lets start it right: MVC is a few patterns put
together
J2EE Container
Deployment Descriptor is used to
configure web applications that are
hosted in the App Server.
Deployment Descriptor
web.xml
out.println("<html>");
out.println("<head><title>Resource Example Servlet</title></head>");
out.println("<body>");
out.println("<H3>Resource Example Servlet</H3>");
out.println("<p>I could really do some damage if I only knew how to
use those" +
" JDBC libraries!<br>I mean I have:<br>" );
out.println("<ul>");
out.println("<li>User: " + dbUser );
out.println("<li>URL: " + dbUrl );
out.println("<li>Driver: " + driver );
out.println("</ul>");
out.println("<p>" + exampleMsg + "</p>");
out.println("</body>");
out.println("</html>");
Client Server
10
Web Programming 10/12/2015 0
Web containers provide an implementation of
this interface to provide session tracking.
Session objects can be retrieved from the
HttpRequest object also provided by the
container.
HttpSession session = request.getSession();
10
Web Programming 10/12/2015 1
Servlet API provides an interface for storing
information that is relevant to all servlets
being hosted in a web application.
Common for facilities like application
logging, access to other resources
(Database Connection Pools), and request
dispatching.
There is one context per web application
per JVM.
Parameter information is configured in the
web.xml file in name/value pairs.
10
Web Programming 10/12/2015 2
Presentation Layer (JSP, HTML, WML)
Logic Layer
(Servlets, JavaBeans, EJBS, etc)
10
Web Programming 10/12/2015 3
High cost of maintenance
HTML and Java exist in the same file.
Web Designers don’t understand java code,
don’t like the java code…
Programmers don’t particularly like the
messing with <HTML> code!!!!
Better to separate JAVA code from the HTML
code.
if( developer == javaProgrammer)
System.out.println(“Stick to Java code!”);
else if( developer == webDesigner )
System.out.println(“Stick to html code!”);
10
Web Programming 10/12/2015 4
Java Server Pages (JSPs) provide a way to
separate the generation of dynamic content
(java) from its presentation (html)
JSP specification builds on the functionality
provided by the servlet specification.
10
Web Programming 10/12/2015 5
index.jsp
Servlet/JSP
checks
Server
converts
Browser Forwards
to
Generated compiles
Servlet index.java
10
Web Programming 10/12/2015 6
10
Web Programming 10/12/2015 7
10
Web Programming 10/12/2015 8
10
Web Programming 10/12/2015 9
Contains html code like static html pages
with the JSP tags and scripting included in
the page.
Three basic types of jsp tags
◦ Scripting elements
◦ Directive elements
◦ Action elements
11
Web Programming 10/12/2015 0
Allow java code – variable or method
declarations, scriptlet, and expressions.
Declaration tag <%! … %>
Scriptlet tag <% … %>
Expression tag <%= … %>
11
Web Programming 10/12/2015 1
<%! … %>
Allows you to declare page wide variables
and methods.
<%! int counter = 0; %>
<%! Vector beanList = new Vector(); %>
Methods and variables have class scope
Note, code must end with ; like any java code
11
Web Programming 10/12/2015 2
<% … %>
Used to include small pieces of Java code
11
Web Programming 10/12/2015 3
<%= … %>
Accepts any Java expression, evaluates the
expression, converts to a String, and
displays.
<%= counter %>
<%= uBean.getUserName() %>
Short hand for:
<% out.println( uBean.getUserName() ); %>
11
Web Programming 10/12/2015 4
Directives provide global information to the
JSP engine
For example, a directive can be used to
import java classes.
Directive elements have a syntax of the form
<%@ directive … %>
11
Web Programming 10/12/2015 5
The page directive defines a number of
page dependent attributes
<%@ page language=“Java”
[ extends=“className” ]
[ import=“importList” ]
[ session= “true|false” ]
[ buffer=“none|sizekb” ]
[ autoFlush=“true|false” ]
[ isThreadSafe=“true|false” ]
… %>
11
Web Programming 10/12/2015 6
If language attribute is set, must be = “Java”
Default import list is java.lang.*,
javax.servlet.*, javax.servlet.jsp.* and
javax.servlet.http.*.
If session = “true” then default session
variable of type
javax.servlet.http.HttpSession references
the current/new session for the page.
11
Web Programming 10/12/2015 7
The include directive is used to inline text
and/or code at JSP page translation-time.
<%@ page include file=“relativeURL”
%>
<%@ page include=“/navbar.html”%>
11
Web Programming 10/12/2015 8
The syntax for action elements is based on
XML(i.e. they have a start tag, a body, and an
end tag).
The JSP specification includes some action
types that are standard.
New action types are added using the taglib
directive.
11
Web Programming 10/12/2015 9
Web container implements these actions
<jsp:useBean>
<jsp:setProperty>
<jsp:getProperty>
<jsp:include>
<jsp:forward>
<jsp:plugin>
<jsp:param>
12
Web Programming 10/12/2015 0
<jsp:useBean>
Associates an instance of a bean to a
variable to use with in the jsp page
<jsp:useBean id=“name”
scope=“page|request|session|application”
class=“className” type=“typeName”>
…
</jsp:useBean>
12
Web Programming 10/12/2015 1
id – variable name to reference instance of
class
scope
◦ page – javax.servlet.jsp.PageContext
Objects only accessible from within the page
◦ request ServletRequest
Objects accessible in pages processing request where bean is
created
◦ session – HttpSession
Objects accessible from user session
◦ application – ServletContext
Objects accessible in pages belonging to same application
12
Web Programming 10/12/2015 2
Type (optional)
◦ Allows scripting variable to be cast to another type
from implementation class, java casting rules apply.
Class
◦ Fully qualified class name that defines the
implementation of the object
12
Web Programming 10/12/2015 3
<jsp:setProperty>
Sets the value of properties in a bean
<jsp:setProperty name=“beanName”
property=“propertyName”|(param=“paramete
rname”|value=“propertyValue”)/>
Use property=“*” to set all properties from
the request
12
Web Programming 10/12/2015 4
Name
◦ Variable name as defined in useBean
Property
◦ Name of the bean property
Request
◦ Name of the request parameter (if omitted same
name as bean property name)
Value
◦ Value assign property (Performs necessary
conversions)
12
Web Programming 10/12/2015 5
Gets the value of properties in a bean
<jsp:getProperty name=“beanName”
property=“propertyName”/>
Name
◦ Variable name as defined in useBean
Property
◦ Name of the bean property to retrieve
12
Web Programming 10/12/2015 6
<html>
<title>Random JSP Test</title>
<body bgcolor=“white”>
<jsp:useBean id=“rnd” scope=“page”
class=“random.NumberGenerator”/>
<ul>
<li>Next number is: <jsp:getProperty
name=“rnd” property=“nextInt”/>
</ul>
</body>
</html>
12
Web Programming 10/12/2015 7
package random;
import java.util.*;
public class NumberGenerator {
Random rnd = new Random();
12
Web Programming 10/12/2015 8
<jsp:include>
Allows you to include resources in the same
context as the current page
<jsp:include page=“url” flush=“true”/>
page:
◦ Relative url
flush:
◦ If true, buffer is flushed
12
Web Programming 10/12/2015 9
<jsp:forward>
Allows you to dispatch the request to a
different page
<jsp:forward page=“url”/>
page:
◦ Relative url
13
Web Programming 10/12/2015 0
Creates HTML that contains OBJECT or
EMBED constructs that result in Java Plugin
download and execution of Applet
<jsp:plugin type=“applet”
code=“applet.class” codebase=“/html”>
<jsp:fallback>
<p>Can’t display applet</p>
</jsp:fallback>
</jsp:plugin>
Fallback is used if the plugin cannot be
started
13
Web Programming 10/12/2015 1
<jsp:param>
Used to provide key/value information for
<jsp:include>, <jsp:forward>, and
<jsp:plugin>
<jsp:param name=“name” value=“value”/>
Name and value are mandatory
13
Web Programming 10/12/2015 2
Two approaches to build application with
JSPs
Model 1: JSP page processes all input
Model 2: Servlet acts as a controller and
directs http traffic to appropriate responses
13
Web Programming 10/12/2015 3
JSP is responsible for processing incoming
requests and replying to clients
All data access is through beans
13
Web Programming 10/12/2015 4
Suitable for simple applications
Easier to understand
May lead to lots of Java code embedded
within JSP pages for complex applications
13
Web Programming 10/12/2015 5
Combine use of servlets and JSP
Servlet acts as controller, JSP as presentation
layer
servlet
Database
browser Beans
JSP
13
Web Programming 10/12/2015 6
JSP aren’t total separation of logic from the
presentation. Although it’s a good start.
Look into Custom tags to encapsulate your
application logic and move it outside of the
jsps. Creation of your own custom tag
libraries help to eliminate java code from
being embedded in the jsp.
Frameworks like WebMacro, Struts, and
Velocity provide additional features to
13
Web Programming 10/12/2015 7
13
Web Programming 10/12/2015 8
Intrinsic support for agile development
13
Web Programming 10/12/2015 9
Document Oriented Database
◦ Data is stored in documents, not tables / relations
14
Web Programming 10/12/2015 0
Key-value
Graph database
Document-
oriented
Column family
Column Field
Index Index
Join Embedded Document
Partition Shard
> db.user.update(
{"_id" : ObjectId("51…")},
{ > db.user.remove({
$set: {
age: 40,
"first": /^J/
salary: 7000} })
}
)
Web Programming 145
10/12/2015
• Basically
• Atomicity Available (CP)
• Consistency • Soft-state
• Isolation • Eventually
• Durability consistent (AP)
14
Web Programming 10/12/2015 8
If you have maven project, just add below
dependency to include MongoDB java driver into
your application
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.3</version>
</dependency>
14
Web Programming 10/12/2015 9
MongoDB client is an interface between our
Java program and MongoDB server
It is used to
◦ Create connection
◦ Connect to database
◦ Retrieve collection names
◦ Create/read/update/delete database, collection,
document, etc.
15
Web Programming 10/12/2015 0
Below are few common methods to connect to MongoDB server
15
Web Programming 10/12/2015 1
Once you get connection to MongoDB server,
next step is to create connection to database
as shown below. Note: if database does not
exists then MongoDB will create it for you.
15
Web Programming 10/12/2015 2
MongoDB client provide useful method to get
all database names as shown below
15
Web Programming 10/12/2015 3
MongoCredential journaldevAuth =
MongoCredential.createPlainCredential("pankaj", "journaldev",
"pankaj123".toCharArray());
MongoCredential testAuth =
MongoCredential.createPlainCredential("pankaj", "test",
"pankaj123".toCharArray());
List<MongoCredential> auths = new ArrayList<MongoCredential>();
auths.add(journaldevAuth);
auths.add(testAuth);
15
Web Programming 10/12/2015 4
We can get collection name as below
MongoClient mongo = new MongoClient("localhost",
27017);
DB db = mongo.getDB("journaldev");
Set<String> collections = db.getCollectionNames();
System.out.println(collections); // [datas, names,
system.indexes, users]
We can get specific collection by providing its
name as below
DB db = mongo.getDB("journaldev");
DBCollection col = db.getCollection("users");
15
Web Programming 10/12/2015 5
User.java
package mongopackage;
15
Web Programming 10/12/2015 6
public void setName(String name) {
this.name = name;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public boolean isEmployee() {
return isEmployee;
}
public void setEmployee(boolean isEmployee) {
this.isEmployee = isEmployee;
}
}
15
Web Programming 10/12/2015 7
MongoDBExample.java
package mongopackage;
import java.net.UnknownHostException;
import com.journaldev.mongodb.model.User;
import com.mongodb.BasicDBObjectBuilder;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.WriteResult;
15
Web Programming 10/12/2015 8
MongoClient mongo = new MongoClient("localhost", 27017);
DB db = mongo.getDB("journaldev");
//create user
WriteResult result = col.insert(doc);
System.out.println(result.getUpsertedId());
System.out.println(result.getN());
System.out.println(result.isUpdateOfExisting());
System.out.println(result.getLastConcern());
//read example
DBObject query = BasicDBObjectBuilder.start().add("_id", user.getId()).get();
DBCursor cursor = col.find(query);
while(cursor.hasNext()){
System.out.println(cursor.next());
}
15
Web Programming 10/12/2015 9
//update example
user.setName("Pankaj Kumar");
doc = createDBObject(user);
result = col.update(query, doc);
System.out.println(result.getUpsertedId());
System.out.println(result.getN());
System.out.println(result.isUpdateOfExisting());
System.out.println(result.getLastConcern());
//delete example
result = col.remove(query);
System.out.println(result.getUpsertedId());
System.out.println(result.getN());
System.out.println(result.isUpdateOfExisting());
System.out.println(result.getLastConcern());
//close resources
mongo.close();
}
16
Web Programming 10/12/2015 0
private static DBObject createDBObject(User user) {
BasicDBObjectBuilder docBuilder = BasicDBObjectBuilder.start();
docBuilder.append("_id", user.getId());
docBuilder.append("name", user.getName());
docBuilder.append("role", user.getRole());
docBuilder.append("isEmployee", user.isEmployee());
return docBuilder.get();
}
16
Web Programming 10/12/2015 1
Sample execution results in below output
null
0
false
WriteConcern { "getlasterror" : 1} / (Continue on error? false)
{ "_id" : 2 , "name" : "Pankaj" , "role" : "CEO" , "isEmployee" : true}
null
1
true
WriteConcern { "getlasterror" : 1} / (Continue on error? false)
null
1
false
WriteConcern { "getlasterror" : 1} / (Continue on error? false)
16
Web Programming 10/12/2015 2
16
Web Programming 10/12/2015 3
• "Asynchronous JavaScript and XML"
• New name for an old technique:
– JavaScript + DHTML + XMLHttpRequest
– In use since at least 1997
– I've used it since 2000
– Finally someone gave it a name
– Already enabled in your Web server and browser
• Use JavaScript asynchronously behind the
scenes to load additional data (typically
XML) without discarding and reloading the
entire Web page.
16
Web Programming 10/12/2015 4
• Your users will soon demand it
– Not just another cool (geeky) technology
– Very user-visible effect
– Rich UI experience in a Web page
• Portable across browsers
• Plus, all advantages of zero-install Web
app
– No install done for this demo
– No "DLL Hell"
16
Web Programming 10/12/2015 5
• Client/Server Apps:
– Dynamic data
– Static forms, controls, code, etc.
– Efficient, but not flexible
• Traditional Web Apps:
– Dynamic data
– Dynamic forms, controls, code, etc.
– Flexible, but inefficient, and noticeably slow
• Ajax Apps:
– Dynamic data
– Static or dynamic forms, controls, code, etc.
– Best of both worlds
16
Web Programming 10/12/2015 6
• Geeky reasons:
– Multithreaded data retrieval from Web servers
• Pre-fetch data before needed
• Progress indicators
• Appearance of speed
• Avoids need for setTimeout()
– Less bandwidth required; less server load
• Reload partial page, not entire page
• Load data only, not even partial page
16
Web Programming 10/12/2015 7
16
Web Programming 10/12/2015 8
• As little or as much as you like
• No need to abandon what you already do
• One more item in your "bag of tricks"
• Start by jazzing up your existing UI
16
Web Programming 10/12/2015 9
• open (“method”, “URL”, [async, username,
password])
– Assigns destination URL, method, etc.
• send (params)
– Sends request including postable string or DOM object data
• abort ()
– Terminates current request
• getAllResponseHeaders ()
– Returns headers (name/value pairs) as a string
• getResponseHeader (“header”)
– Returns value of a given header
• setRequestHeader (“label”,”value”)
– Sets Request Headers before sending
17
Web Programming 10/12/2015 0
• onreadystatechange
– Event handler (your code) that fires at each state change
• readyState
0 = uninitialized 3 = interactive (some data has been returned)
1 = loading (broken in IE 6.0)
2 = loaded 4 = complete
• status
– HTTP Status returned from server: 200-299 = OK
• responseText
– String version of data returned from server
• responseXML
– XML DOM document of data returned
• statusText
– Status text returned from server
17
Web Programming 10/12/2015 1
var req = new XMLHttpRequest();
req.onreadystatechange = myHandler;
req.open("GET", "servlet", true);
req.send("p1=abc");
...
function myHandler() {
if (req.readyState == 4) {
doSomethingWith(req.responseXML);
}
else if (req.readyState == 3) {
showProgressIndicator();
}
}
17
Web Programming 10/12/2015 2
Windows Live Local
Windows Live Mail (Hotmail Beta)
Google Maps
Google Suggest
17
Web Programming 10/12/2015 3
Ajax frameworks are categorized into four
types
1. Direct Ajax framework
2. Indirect Ajax framework
3. Component Ajax framework
4. Server drive Ajax framework
17
Web Programming 10/12/2015 4
This type requires CSS, Ajax and HTML
expertise
This type consists of web pages which are
authored in HTML
One can use cross browser API of this type
XAP, DWR and prototype are the categories of
this type
17
Web Programming 10/12/2015 5
This type is dependent on compiler
technology
Thus coding is done in high level language
so that compiler will run the code in
JavaScript
This type will guide you on programming
concepts front
17
Web Programming 10/12/2015 6
It has in built components to generate and
handle own HTML code
You can enjoy customized APIs, extensibility,
programmatic control, skinning facility with
this type
Example: YUI, Dojo, Open Rico, TIBCO
17
Web Programming 10/12/2015 7
In this type, components will be crated with
the use of server side scripting language
With the use of various Ajax techniques, one
can communicate all the user actions to the
server
Example: jBossRich Faces, jMaki, Google Web
Toolkit, Thin Wire, etc
17
Web Programming 10/12/2015 8
Important questions
1. What are some of the common lists that can be
used when designing a webpage?
2. How do you create links to sections within the
same webpage?
3. Write a HTML table tag sequence that outputs
the following:
50 pcs 100 500
10 pcs 5 50
4. What does DOCTYPE mean?
5. How many HTML tags are should be used for
the most simple of web pages? Which are they?
17
Web Programming 10/12/2015 9
Important questions
6. How to set a default parameter value for a
JavaScript function?
7. How to open URL in new tab in javascript?
8. How do I declare a namespace in
JavaScript?
9. Difference between JavaScript and Jscript?
10.What is JavaScript? Validate login form
using JavaScript.
11.What is difference between include action
and include directive in JSP?
18
Web Programming 10/12/2015 0
Important questions
12.How do you define application wide error
page in JSP?
13.How do you get ServletContext reference inside
Servlet? Explain with example.
14.What does load-on-start-up element in
web.xml do?
15.Define JSP and servlet.
16.Explain JDBC process with MongoDB. Consider
suitable example.
17.What is MVC architecture?
18
Web Programming 10/12/2015 1
Reference
1.http://www.w3schools.com/html/
2.Elisabeth Freeman, Eric Freeman, “Head
First JavaScript Programming” by O’Reilly
Media
3.scom.hud.ac.uk/scomsjw/Web%20Authori
ng%20Module/Lecture%20Slides/introjs.pp
t
4.Kathy Sierra, “Head First Servlets and JSP”
by O’Reilly Media
5.http://java.sun.com/products/servlet
6.http://java.sun.com/products/jsp
18
Web Programming 10/12/2015 2
Reference
7. http://www.theserverside.com
8. http://www.pavanjaiswal.com/2015/07/run-
jsp-servlet-in-apache-tomcat-no.html
9. http://www.webdeveloperjuice.com/2013/0
9/18/top-seven-ajax-frameworks-for-
building-rich-web-based-applications/
10.https://www.elance.com/q/blog/2011/11/u
nderstanding-4-types-of-ajax-
frameworks.html
11.http://www.journaldev.com/3963/mongodb
-java-crud-example-tutorial
18
Web Programming 10/12/2015 3
Thank You
http://www.pavanjaiswal.com
18
Web Programming 10/12/2015 4