Thursday 10 April 2014

CONCEPTS OF SERVLETS

 Creating a servlet program
first servlet program by using Note pad (without using IDE)
(http://raj-servlets.blogspot.in/2013/08/first-servlet-program-by-using-note-pad.html)
How servlet intercepts HTTP requests, and the method it runs
Understanding the role of servlets
Evaluating servlets vs. other technologies
Understanding the role of JSP
Configuring the server
Configuring your 
development environment
Testing the 
server setup
Servlet Basics

The basic structure of servlets
A simple servlet that generates plain text
A servlet that generates HTML
Servlets and packages
Some utilities that help build HTML
The servlet life cycle
Servlet debugging strategies
Handling the Client Request: 
Form Data

The role of form data
Creating and submitting HTML forms
Reading individual request parameters
Reading the entire set of request parameters
Handling missing and malformed data
Dealing with incomplete form submissions
Filtering special characters out of the request parameters
Handling the Client Request: HTTP Request Headers

Reading HTTP request headers
Building a table of all the request headers
Understanding the various request headers
Reducing download times by compressing pages
Differentiating among types of browsers
Generating the Server Response: HTTP Status Codes

Format of the HTTP response
How to set status codes
What the status codes are good for
Shortcut methods for redirection and error pages
A servlet that redirects users to browser-specific pages
A front end to various search engines
Generating the Server Response: HTTP Response Headers

Format of the HTTP response
Setting response headers
Understanding what response headers are good for
Building Excel 
spread sheets
Generating JPEG images dynamically
Sending incremental updates to the browser
Handling Cookies

Understanding the benefits and drawbacks of cookies
Sending outgoing cookies
Receiving incoming cookies
Tracking repeat visitors
Specifying cookie attributes
Differentiating between session cookies and persistent cookies
Simplifying cookie usage with utility classes
Modifying cookie values
Remembering user preferences
Session Tracking

Implementing session tracking from scratch
Using basic session tracking
Understanding the session-tracking API
Differentiating between server and browser sessions
Encoding URLs
Storing immutable objects vs. storing mutable objects
Tracking 
user access counts
Accumulating user purchases
Implementing a shopping cart
Building an 
online store

Servlet internal question paper for web technologies(http://raj-servlets.blogspot.in/2013/04/servlet-internal-question-paper-for-web.html)
Question paper for servlets and jsp for WEB TECHNOLOGIES(http://raj-servlets.blogspot.in/2014/04/question-paper-for-servlets-and-jsp-for.html)


Question paper for servlets and jsp for WEB TECHNOLOGIES

Subject: WT
Class     : III yr II Sem CSE-C
PART-A
Multiple choice:

  1. Servlets are used at?                                                                                      [           ]
a. Broswer side
b. server side
c. Both
d. None
  1. Servlet mapping defines?                                      [A         ]
a.  an association between a URL pattern and a servlet
b.  an association between a URL pattern and a request page
c.  an association between a URL pattern and a response page
d.  All of the above

  1. How many jdbc drivers are there       [           ]
a. one  b. three           c. four              d. five

  1. To execute jdbc program we need                                         [           ]
a. jdbc software          b. jdbc jar file c. mysql software        d. oracle software

  1. Following is not the JSP implicit object                           [        ]
a. String            b. config        c. out            d. request.

Fill in the blanks:
1.       JSP stands for ___________________________.
2.      Jdbc is used to ________________________.
3.      _____________________methods are the Servlet lifecycle methods.
  1. _______________are used to do session tracking .
  2. Class.forName() method is used for ___________

PART-B
Answer any three:
1.     What are JSP directives ? Write any JSP program for login screen?
  1. Explain about the lifecycle of servlets? Illustrate with a suitable example for servlets ?(Write down the steps to write servlet programs)
  2. What are the advantages and characteristics of JAVA BEANS?
  3. Develop a web application for registration for email login details using jsp and jdbc?
  4. Explain about the session tracking? Write a example program for Cookies
  5. What are the steps are involved while writing the jdbc program? Illustrate with a jdbc program to store data into the database




Tuesday 8 April 2014

Context Initialization Parameters

Context Initialization Parameters

  • So far we discussed, Servlet Container supports to store startup and configuration information for a Servlet as initialization parameters (init parameters).
  • init parameters are configured specific to the Servlet configured in the deployment descriptor file, means these data can be retrieved only one servlet
  • But I want to configure data that has to be retrieved into all or more than one servlet.
  • For example my web application contains two servlets , login and registration, and you want the Driver class name and the JDBC URL of both Servlets to establish a connection, for this situation we can implement by using the context initialization parameters (Context init parameters), which are provided under Servlet specification.
This type of parameters are accessible to all the web components in this application.

How to declare the context init parameters?

The following tag is used as a direct child of <web-app> in web.xml to do this:


Syntax:

 <context-param>
     <param-name>parameter name</param-name>
     <param-value>parameter value</param-value>
</context-param>


  • this is not in side servlet, this is out side servlet
  • Annotations style is not supported for configuring this requirement.