[Top] [Prev] [Next] [Bottom]

Scriptlet

Contains a code fragment valid in the page scripting language.

JSP Syntax

<% code fragment %>

Examples

<%
	String name = null;
	if (request.getParameter("name") == null) {
%>

<%@ include file="error.html" %>

<%
	} else {
	foo.setName(request.getParameter("name"));
	if (foo.getName().equalsIgnoreCase("integra"))
		name = "acura";
	if (name.equalsIgnoreCase( "acura" )) {
%>

Description

A scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language.

Within scriptlet tags, you can do any of the following:

You must write plain text, HTML-encoded text, or other JSP tags outside the scriptlet.

Scriptlets are executed at request time, when the JSP engine processes the client request. If the scriptlet produces output, the output is stored in the out object, from which you can display it.

See Also



[Top] [Prev] [Next] [Bottom]

Copyright © 1999, Sun Microsystems, Inc. All rights reserved.