Working with JSP Sessions

Working with JSP Sessions In this JSP tutorial, you will learn about JSP session object methods, getCreationTime, getLastAccessedTime, getId, invalidate(), getMaxInactiveInterval, setMaxInactiveInterval(), removeAttribute(String name) and setAttribute(String, object). This section details the syntax, usage, example and explanation of more session object methods, such as: getCreationTime getLastAccessedTime getId invalidate() getMaxInactiveInterval setMaxInactiveInterval() removeAttribute(String name) setAttribute(String, object) getCreationTime: The getCreationTime method of session object is used to return the session created time. The returned time value would be in milliseconds, the time value is midnight January 1, 1970 GMT. General syntax of getCreationTime of… Read More

JSP Response Object

JSP Response Object In this JSP tutorial, you will learn about JSP Response object, Methods of response Object, setContentType(), addCookie(Cookie cookie), containsHeader(String name), setHeader(String name, String value), sendRedirect(String) and sendError(int status_code). The response object denotes the HTTP Response data. The result or the information of a request is denoted with this object. The response object handles the output of the client. This contrasts with the request object. The class or the interface name of the response object is http.HttpServletResponse. The response object is written: Javax.servlet.http.httpservletresponse. The response object is generally… Read More

JSP Request Object

JSP Request Object In this JSP tutorial, you will learn about JSP request object, JSP request object methods, getParameter(String name), getParameterNames(), getParameterValues(String name), getQueryString(), getRequestURI(), getServletPath(), setAttribute(String,Object), removeAttribute(String) The request object in JSP is used to get the values that the client passes to the web server during an HTTP request. The request object is used to take the value from the client’s web browser and pass it to the server. This is performed using an HTTP request such as: headers, cookies or arguments. The class or the interface name… Read More

JSP Out Object

JSP Out Object In this JSP tutorial, you will learn about out object and its methods viz. clear, clearBuffer, flush, isAutoFlush, getBufferSize, getRemaining, newLine, print and println. out object denotes the Output stream in the context of page. The class or the interface name of the object out is jsp.JspWriter. The out object is written as: Javax.servlet.jsp.JspWriter The object that write to the JSP’s output stream is defined by the out object. Methods of out Object: There are numerous methods available for out Object, such as: clear clearBuffer flush isAutoFlush… Read More

JSP Application Object

JSP Application Object In this JSP tutorial, you will learn about application object, the methods available in application object, getAttribute(String name), getAttributeNames, setAttribute(String objName, Object object), removeAttribute(String objName), getMajorVersion(), getMinorVersion(), getServerInfo(), getInitParameter(String name), getInitParameterNames, getResourceAsStream(Path) and log(Message) Application Object is used to share the data with all application pages. Thus, all users share information of a given application using the Application object. The Application object is accessed by any JSP present in the application. The class or the interface name of the object application is ServletContext. The application object is… Read More

JSP Implicit and Session Objects

JSP Implicit and Session Objects In this JPS tutorial, you will learn how to program using JSP, JSP expressions and Implicit Objects, JSP Session Object, methods of session object, getAttribute(String name), getAttributeNames and isNew(). JSP expressions: If a programmer wants to insert data into an HTML page, then this is achieved by making use of the JSP expression. General syntax: The general syntax of JSP expression is as follows: <%= expression %> The expression is enclosed between the tags <%= %> For example, if the programmer wishes to add 10… Read More

JSP Architecture

JSP Architecture In this JSP tutorial, you will learn about JSP Architecture, page-centric approach, dispatcher approach and steps in execution of a JSP file. JSP is a high-end technology that helps developers insert java code in HTML pages by making use of special JSP tags. The JSP are HTML pages but do not automatically have .html as file extension. JSP files have .jsp as extension. The following steps takes place in execution of a JSP file. JSP files are compiled by JSP engine into a servlet. This step creates the… Read More

JSP Page Directive

JSP Page Directive In this JSP tutorial, you will learn about JSP page directive, attributes of the page directive along with syntax, examples and explanations. autoFlush: autoFlush attribute is used to specify whether or not to automatically flush out the output buffer when it is full.  Syntax of autoFlush attribute available for page directive is written as: &lt;%@ page autoFlush = "true|false" %&gt; In the above example, page and autoFlush are keywords. True or false value can be set to autoFlush attribute, by default, its value is true . This means, the buffer… Read More

JSP Directive Tag and Scriptlet tag

JSP Directive Tag and Scriptlet tag In this JSP tutorial, you will learn about two types of Directive tag namely Include and Tag Lib and also Scriptlet tag used in Java Server Pages along with syntax, usage, example and explanation for each of the tag. Include directive: Include directive is a type of directive tag. If a programmer wants to include contents of a file inside another, then the Include directive is used. The file included can be either static ( HTML file) or dynamic (i.e., another tag file). The… Read More

JSP Introduction

JSP Introduction In this JSP tutorial, you will learn about JSP, usage of JSP, process of development, independency of layers and simplification of process. JSP or Java Server Pages, was developed by Sun Microsystems. JSP technology is object-oriented programming language and is based on Java language. In this section you will learn about JSP and some its important features. Usage of JSP: JSP is widely used for developing dynamic web sites. JSP is used for creating database driven web applications because it provides superior server side scripting support. Some of… Read More

JSP Environment Setup

Steps for Setting JSP Environment In this JSP tutorial, you will learn the steps for setting JSP environment in Microsoft Windows, setting the PATH and CLASSPATH, steps for downloading and installing the Tomcat web server. The Java Server Page or JSP is very affordable as most of the software needed for it is easily available for free or at low cost. The Java Developer Kit which is available for free The Tomcat web server if used is available for free. HTML editor would be needed to purchase. How to set… Read More

JSP Tags

JSP Tags In this JSP tutorial, you will learn about JSP tags, list of the tags used in Java Server Pages, declaration tag, general syntax of declaration tag, expression tag and general syntax of expression tag. Tags are a vital concept in Java Server Pages (JSP). Below is a list of tags used in JSP. This section discusses Declaration Tag and Expression Tag in detail; syntax, usage with examples and explanations for both. List of the tags used in Java Server Pages: Declaration tag Expression tag Directive tag Scriptlet tag Action… Read More

JSP Directives

JSP Directives In this JSP tutorial, you will learn about Directive tag with example, page directive, language, extends, import, session and buffer. Directive tag: The directive tag gives special information about the page to JSP Engine. This changes the way JSP Engine processes the page. Using directive tag, user can import packages, define error handling pages or session information of JSP page. General notation of directive tag is as follows: There are three types of directive tag. page Include Tag Lib Syntax and usage of directive tag page directive: General… Read More