[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
JavaBeans
JSP directives

Use JSP directives (enclosed within <%@ and %>) to specify:

The scripting language being used The interfaces a servlet implements The classes a servlet extends The packages a servlet imports The general syntax of the JSP directive is:

<%@ directive_name ="value" %>

where the valid directive names are:

language

The scripting language used in the file. At this time, the only valid value and the default value is java, for the Java programming language. The scope of this directive spans the entire file. When used more than once, only the first occurrence of the directive is significant. Example:

<%@ language ="java" %>

method

The name of the method generated by the embedded Java code (scriptlet). The generated code becomes the body of the specified method name. The default method is service. When used more than once, only the first occurrence of the directive is significant. Example:

<%@ method ="doPost" %>

import

A comma-separated list of Java language package names or class names that the servlet imports. This directive can be specified multiple times within a JSP file to import different packages. Example:

<%@ import ="java.io.*,java.util.Hashtable" %>

content_type

The MIME type of the generated response. The default value is text/html. When used more than once, only the first occurrence of this directive is significant. This directive can be used to specify the character set in which the page is to be encoded. Example:

<%@ content_type ="text/html; charset=iso-8859-1" %>

implements

A comma-separated list of Java language interfaces that the generated servlet implements. You can use this directive more than once within a JSP file to implement different interfaces. Example:

<%@ implements ="javax.servlet.http.HttpSessionContext" %>

extends

The name of the Java language class that the servlet extends. The class must be a valid class and does not have to be a servlet class. The scope of this directive spans the entire JSP file. When used more than once, only the first occurrence of the directive is significant. Example:

<%@ extends ="javax.servlet.http.HttpServlet" %>



last edited (August 9, 2003) by malhar, Number of views: 1797, Current Rev: 1

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.