Posts

Showing posts with the label Jsp

What is Implicit Objects in jsp

Implicit Objects:- In this article, I will try to describe about the objects on the jsp page. There are two type of objects can be on a jsp page. Jsp Implicit Objects Jsp Explicit Objects What is Implicit Objects in jsp Objects which are directly available on the Jsp page are called Implicit object. Actually these objects are Java objects and Jsp container provide these objects on the Jsp page. These objects automatically instantiate on the Jsp page. Jsp has nine type of Implicit Objects. We are describing these implicit objects below. Object             Class application         javax.servlet.ServletContext config                 javax.servlet.ServletConfig exception           java.lang.Throwable out                  ...

JSP Directive Taglib

Taglib Directive :- Taglib Directive is used for include the tag from tag library. It defines the prefix for particular tag library. Syntax of Taglib Directivs is : <%@ taglib=" URIToTagLibrary "  prefix=" tagPrefix "%> Example : <%@ taglib uri="struts-bean.tld" prefix="bean"%> <%@ taglib uri="struts-html.tld" prefix="html"%> <%@ taglib uri="struts-logic.tld" prefix="logic"%> <HTML> <HEAD><title>Example Include Directive</title> </HEAD> <BODY>     <logic:empty>            // some logic here …............    </logic:empty> </BODY> </HTML> Taglib is used to define the custom tag library and used the tag of this library through the tag prefix.

JSP Directives Include

Include Directive - Include directives is used for include any static JSP or HTML file in the JSP page. Syntax of Include Directives :- <%@ include  file=”relative Path” %> Example:- First.jsp <HTML> <HEAD><title>Example Include Directive</title> </HEAD> <BODY>     <%@ include file="/second.jsp" %> </BODY> </HTML> second.jsp <h1>Include me</h1> More about :- Include directive works at compilation time of JSP. It statically include JSP or HTML file. Mean content of included file written in the main servlet. The included file might be open and available to all requests, or it might have security restrictions. The JSP page might be recompiled if the included file changes.

JSP Directives

JSP Directives -     JSP Directives is very powerful components in the Jsp. In this page you will learn about JSP Directives. JSP Directives are responsible for giving the special information about the jsp to the Jsp container. Jsp Directives tag syntax is : <%@ directive  attribute=”Value” %> JSP has three type of jps Directives tag. page taglib include page Directive : page Directive is used for manipulating the behaviour of the jsp page. Jsp page can be import the java file through the import attribute. If isErrorPage attribute will be true then jsp will work as a error page. There are list of attribute of page directive. autoFlush buffer     contentType errorPage extends import info isErrorPage isThreadSafe language pageEncoding session autoFlush Attribute :- autoFlush Attribute is used to flush the jsp page when buffer size is overflows. By-default the value of autoFlush attribute is true. If you will set value as fa...

JSP Components Declaratives Scriptlets Expressions

JSP Components -     JSP has mainly six type of components. 1. JSP Declaratives 2.JSP Scriptlets 3.JSP Expressions 4.Directives  5.Implicit Objects 6.Standard Actions  JSP Declaratives -        JSP Declaratives is used for embed Java code in class label. Any code which is written in JSP Declaratives will goes to scope of a class of servlet. JSP Declaratives is open with <%! and closed with %> syntax. If any variable is made in JSP Declaratives means this variable will be available for any where with in JSP. Example -     <HTML>          <HEAD>          <BODY>         <%!             public int getSum(int a, int b){                 return a+b;      ...

Java Server Page Life Cycle

JSP (Java Server Page) -     JSP means java server page with in the JSP you can write java code with in html code.     Ex -     <html>         <body>         <%             System.out.println(“This is my first JSP Page”);         %>         </body>     </html>     When any request will go for any jsp firstly JSP creates a Servlet for JSP and compiles to .class file then run over the web server. JSP Life Cycle -     There are three methods defines Life Cycle of JSP Page. 1._jspInit() 2._jspService() 3._jspDestroy() _jspInit() Method - _jspInit() method is called by jsp container for initializing the servlet of jsp page. This method is call at one time of any JSP life. _jspService() Met...

Recent Post

Recent Posts Widget