JSP Syntax (5)

Source: Internet
Author: User
Tags expression html tags reference
The js| syntax contains a valid program segment.



JSP syntax

<% Code Fragment%>

Example

<%

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")) {

%>

Describe

A scriptlet can contain multiple JSP statements, methods, variables, expressions



Because of scriptlet, we can do the following things:



Declare the variable or method (reference declaration) that will be used.

Write a JSP expression (a reference expression).

Use any suppressed objects and any objects declared with <jsp:useBean>

Write JSP statements (if you are using the Java language, these statements must conform to the Java Language specification).

Any text, HTML tags, JSP elements must be outside the Scriptlet

When the JSP receives the customer's request, the scriptlet is executed, and if Scriptlet has the displayed content, the displayed content is present in the Out object.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.