[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" %>
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
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" %>
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
