pageContext

JSP implicit object pageContext example program (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>jsp.ourownjava.com</title> </head> <body> <!– jsp implicit object pageContext example –> <!– how to set attribute into jsp implicit object pageContext –> <% pageContext.setAttribute(“attribute1″, “attribute1Value”); %> <!– how to […]
Continue reading…

 

page

What is JSP implicit object page? The page variable is an alias for ‘this’, that refers to the servlet instance. JSP implicit object page example program (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>jsp.ourownjava.com</title> </head> <body> <!– jsp implicit object page […]
Continue reading…

 

out

How to access JSP implicit object out in a JSP file? <%out.print(“to the screen”);%> JSP implicit object out example program <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>jsp.ourownjava.com</title> </head> <body> <!– jsp implicit object out example –> JSP implicit object out class […]
Continue reading…

 

config

How to access servlet config parameters in jsp? Servlet config init parameter : <%=config.getInitParameter(“servletConfigParm1″)%> JSP Implicit Object config Example (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>jsp.ourownjava.com</title> </head> <body> <!– jsp implicit object config example –> JSP implicit object config class […]
Continue reading…

 

application

How to access servlet context parameters in jsp? Servlet context parameter : <%=application.getInitParameter(“param1″)%> JSP Implicit Object application Example (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>jsp.ourownjava.com</title> </head> <body> <!– jsp implicit object application example –> JSP implicit object application class : […]
Continue reading…

 

Implicit Objects

JSP implicit objects are a collection of java objects that the JSP/Servlet container makes available to developers in each and every jsp page. How to access the JSP implicit objects? JSP implicit objects can be accessed as variables via any JSP scripting elements. JSP implicit objects can be accessed programmatically by JavaBeans and Servlets. JSP […]
Continue reading…

 

Expressions

Expression is used to insert the value of a java language expression. Expression values are converted into String object and would be put into the implicit out object. JSP Expression Syntax <%= scripting-language-expression %> JSP Expression Sample Program (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> […]
Continue reading…

 

Declarations

Declaration is used to declare variables and methods in a JSP page’s scripting language. All variables and methods in JSP declaration would be translated into declaration inside respective Servlet class. JSP declaration syntax <%! scripting language declaration %> JSP declaration sample code (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 […]
Continue reading…

 

Directives

JSP directives tells the web container how to translate a JSP page into a Servlet. Types of directives Sample code for page directive (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!– page import directive –> <%@ page import=”java.util.*” %> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>jsp.ourownjava.com</title> </head> […]
Continue reading…

 

Scriptlet

Scriptlet let developers write java code within jsp file. Though this is not a recommended practice from the code maintenance perspective its widely used in the initial version of jsp applications. JSP Scriptlet Syntax <% java code fragment %> Simple Example (github) <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” […]
Continue reading…