JSP directivesThe jsp directives are messages that tells the web container how to translate a JSP page into the corresponding servlet. There are three types of directives:
Syntax of JSP DirectiveJSP page directiveThe page directive defines attributes that apply to an entire JSP page. Syntax of JSP page directiveAttributes of JSP page directive
1)import
Example of import attribute2)contentTypeThe contentType attribute defines the MIME(Multipurpose Internet Mail Extension) type of the HTTP response.The default value is "text/html;charset=ISO-8859-1". Example of contentType attribute3)extendsThe extends attribute defines the parent class that will be inherited by the generated servlet.It is rarely used. 4)infoThis attribute simply sets the information of the JSP page which is retrieved later by using getServletInfo() method of Servlet interface. Example of info attributeThe web container will create a method getServletInfo() in the resulting servlet.For example: 5)bufferThe buffer attribute sets the buffer size in kilobytes to handle output generated by the JSP page.The default size of the buffer is 8Kb. Example of buffer attribute6)languageThe language attribute specifies the scripting language used in the JSP page. The default value is "java". 7)isELIgnored
8)isThreadSafe
<%@ page isThreadSafe="false" %> The web container in such a case, will generate the servlet as: 9)errorPageThe errorPage attribute is used to define the error page, if exception occurs in the current page, it will be redirected to the error page. Example of errorPage attribute10)isErrorPageThe isErrorPage attribute is used to declare that the current page is the error page. Note: The exception object can only be used in the error page.Example of isErrorPage attributeNext TopicJsp Include Directive |