Note: It is advised to go through Scriptlet and Expression before proceeding this Declaration. We know the three building blocks of JSP code are Scriptlet, Expression and Declaration. Let us focus on Declaration here. Declaration represents the global area of a JSP page where you can write global (instance) variables and methods. These variables and […]
↧
JSP Made Simple: What is Declaration in JSP with Example?
↧
What are JSP Scriptlet, Expression and Declaration Example?
Scriptlet, Expression and Declaration are the three building blocks of JSP code. Let us see the appropriate places when to use them and finally we will do one example where all the three are used. Note: It is advised to go through the separate examples on Scriptlets, expressions and declarations before going through this. Here, […]
↧
↧
JSP Made Simple: Using Java Methods in JSP
Note: It is advised to go through "JSP Scriptlet, Expression and Declaration – all in one example" to know their scope and usage in JSP coding before proceeding this topic. We know earlier, JSP declaration represents a global area for the whole JSP file where programmer can declare variables and methods that can be used […]
↧
JSP Made Simple: Understanding JSP Comments – 3 Styles
We know JSP code contains static HTML code and dynamic JSP code. There are two types of of comments supporting static HTML and one type of comment supporting dynamic code. JSP 3 types of Comments Content comments (also popular as HTML comments) JSP comments (also known as Hidden comments) Scripting comments (also called as Java […]
↧
JSP Made Simple: Using JSP implicit object config Example
Note: It is advised to read about ServletConfig interface in Servlets where at length discussed its importance, methods and one example using ServletConfig is shown in Servlet web xml init param Example using ServletConfig. config is one of the 9 implicit objects, JSP supports. config is an object of javax.servlet.ServletConfig interface. This interface is used […]
↧
↧
Using implicit object application in JSP with Example
"application" is one of the 9 implicit objects, JSP supports. The "application" object represents an object of javax.servlet.ServletContext interface. This we have seen in Servlets. Let us write a different program with JSP code. application object represents a global object that can be used by all JSPs of the project. Any JSP can place values […]
↧
JSP Made Simple: Using implicit object out in JSP Example
"out" is one of the 9 implicit objects, Java supports. It represents an object of javax.servlet.jsp.JspWriter, a subclass of character stream java.io.Writer. Any data given to out object goes as output stream which is sent to client as response. That is, Programmer uses out object to send data to client. It is equivalent to PrintWriter […]
↧
JSP Made Simple: Using implicit object session JSP Example
We know the HTTP Protocol nature (stateless and connectionless) is to break the connection (earlier established between Web client with Web server) when the response is delivered to client. If the same client would like to send another request to the same server, it should establish a new connection and send a fresh request again. […]
↧
JSP Made Simple: Using implicit object request JSP Example
1. What is request implicit object in JSP? request is one of the 9 implicit objects, JSP supports. request is an object of javax.servlet.http.HttpServletRequest interface. Being implicit, it comes into existence (or created) automatically and the Programmer can use the object in his code without the necessity of creation. 2. With request object what Programmer […]
↧
↧
JSP Made Simple: Using implicit object response JSP Example
"response" is one of the 9 implicit objects, JSP supports. It is an object of javax.servlet.http.HttpServletResponse interface. This object is used by the Programmer to send cookies to the client, to use HTTP status codes in programming and to redirect the client to a new page. Following are some important methods of HttpServletResponse that can […]
↧
JSP Made Simple: Using implicit object exception JSP Example
"exception" is one of the 9 implicit objects, supported by Java. "exception" is an object of java.lang.Throwable, available to the programmer to be used directly in the code without creating it. The exception object cannot be used always and everywhere in the JSP code. It is specially used in combination with "errorPage" and "isErrorPage". 1. […]
↧
JSP Made Simple: JSP Directives Tutorial
1. What is JSP directive? JSP directive directs or instructs the container how it should behave with a few aspects of JSP code processing. A JSP directive influences JSP code structure in general on the whole. A JSP directive gives the special instructions to container, the rules that can be applied to the whole JSP […]
↧
JSP Page Directive Tutorial – 14 Attributes and Examples
"page directive" is one of the 3 directives, Java supports. "page" directive gives information, to the container, that can be applied to whole JSP file (page). General Syntax: <%@ page attributeName=”value” %> To give the information, page directive uses 14 attributes. Each attribute gives a special processing information to the container. Following is the attribute […]
↧
↧
JSP Made Simple: JSP page import directive Example
"import" is one of the 14 attributes JSP page directive supports. It is used to import packages in JSP. Example: <%@ page import="java.util.List" %> : imports only one interface List <%@ page import="java.util.*" %> : imports all the classes and interface <%@ page import="java.net.*" %> <%@ page import="java.io.*" %> In above three separate import statements, […]
↧
JSP page contentType directive set to text/plain Example
Content type in Servlets/JSP is nothing but the format of data being sent by Web server to client as response. It is received by the browser on the client system and displayed to the user. The general format and also the default is text/html, that is, either simple text or text with HTML tags (of […]
↧
JSP Exception Handling – errorPage, isErrorPage, exception
"errorPage" and "isErrorPage" are the two of 14 attributes suppoted by page directive. 1. What is "errorPage"? Any JSP file declared with errorPage, when generates exceptions, can send the exceptions to another JSP file that is declared with isErrorPage. errorPage attribute is used to specify the address of another JSP file where isErrorPage is set […]
↧
JSP page pageEncoding directive Example
"pageEncoding" is one of the 14 attributes supported by JSP page directive. pageEncoding is used to read correctly the file data characters available on OS file system by JSP. If pageEncoding attribute is ignored by the Programmer, sometimes, it may lead problems with Cyrillic and Chinese characters especially with PHP language. A file may contain […]
↧
↧
JSP Made Simple: JSP page directive buffer Example
1. What is buffer in JSP? JSP first writes the response data to the buffer and when the buffer is full, the data is sent to client. "buffer" is one of the 14 attributes of page directive. When the PrintWriter object is closed with out.close(), the unfilled buffer is flushed to the client. 2. What […]
↧
JSP Made Simple: JSP page directive autoFlush Example
One of the advantages with JSP is that Designers gave many handles to control the behaviour of container. One such one is autoFlush attribute of page directive. 1. What is autoFlush? autoFlush is one of the 14 attributes, JSP supports. It takes boolean values true or false. It indicates the container to flush the data […]
↧
String Methods Java – valueOf() Example with Screenshot
Many methods exist in java.lang.String class used for different string manipulations like checking the availability of a character, to extract a part of a string or to convert a data type to string etc. String.valueof() converts all primitive data types and objects into string form and returns. Original primitive data type is not changed. The […]
↧