Adv Java - [Java Server Page: Session Management]

♠ Posted by Unknown in

Java Server Page Session Management

The HTTP is stateless protocol. The state management is a necessary management technique to preserve current page data from moving one page to another page. The Session management is one type of state management to maintain particular user login/logout session tracking. The Session is created individually for every particular user who are getting logged in/out on website.

Adv Java - [Java Server Page Directive]

♠ Posted by Unknown in

Java Server Page Directive

This example is showing the use of directives to import libraries of java into java server page code. Here, I have called util package of java library to fetch data from the html table.

Adv Java - [Java Server Pages: Scripting Elements]

♠ Posted by Unknown in

JSP Scripting Elements


Once the directives have been used to setup the scripting environment you can utilize the scripting language elements. JSP1.1. has three scripting language elements – declaration, scriptlets, and expressions. A declaration will declare elements, a scriptlet is a statement fragment, and an expression is a complete language expression. In JSP each scripting element begins with a “<%”. 

Adv Java - [Servlet: Hidden Field]

♠ Posted by Unknown in

Hidden Field in Servlet Example

The HTTP is stateless protocol, means it can not preserve data of current web page while moving backward/forward web pages. The hidden field is a way to State management in servlet example. The hidden field is used to store intermediate data hide while moving from one page to another page.  

Adv Java - [Servlet: Database Connectivity]

♠ Posted by Unknown in

DataBase Connectivity on Servlet

This example is showing the DataBase connectivity to fetch the result of particular student from the SQL Table. DataBase may resides on server-side and establish ODBC connection between database and Java class.

Adv Java - [Servlet: Hyperlink Example]

♠ Posted by Unknown in
Servlet Example

The Example that display the use of hyperlinks among several servlets. The Servlets are called to each other by referencing the java class name to the anchor element of HTML.

Adv Java - [Servlet: Useful Methods]

♠ Posted by Unknown in

Useful Methods of Servlet

 Servlets are simply Java classes that follow three basic rules:

  1. An HTTP Servlet must extend javax.servlet.http.HttpServlet (or extend an abstract class that does).
  2. The Servlet must implement at least one of the following metheods: doGet(), doPost(), doPut(), doDelete(), init(), destroy(), or service().
  3. The Servlet can optionally implement init(), destroy(), or getServletInfo().

Adv Java - [Servlet: Multithreaded]

♠ Posted by Unknown in

Multithreading into Servlet


The servlet container has a pool of threads that it will dispatch to handle client requests. It is quite likely that two clients arriving at the same time could be processing through your service() at the same time. Therefore the service() method must written in a thread-safe manner. Any access to common resources will need to be guarded by using the synchronized keyword.

Adv Java[Servlet: Session Management]

♠ Posted by Unknown in

Servlet Session Management


HTTP is a “sessionless” protorcol, so you cannot tell from one server hit to another if you’ve got the same person repeatedly querying your site. Or if it is a completely different person. A great deal of effort has gone into mechanisms that will allow Web developers to track sessions. Companies could not do e-commerce without keeping track of a client and the items they have put into their shopping cart, for example.

Adv Java [Servlet: Life Cycle]

♠ Posted by Unknown in

Servlets


Client access from the Internet or corporate intranets is a sure way to allow many users to access data and resources easily. This type of access is based on clients using the World Wide Web standards of Hypertext Markup Language (HTML) and Hyper Text Transfer Protocol (HTTP). The Servlet API set abstracts a common solution framework for responding to HTTP requests.