JSP programming (II)-Basic JSP syntax (4)-scriptlet

Source: Internet
Author: User

Contains a validProgramSegment.

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 (). inclusignorecase ("Integra "))
Name = "Acura ";
If (name. inclusignorecase ("Acura ")){
%>

Description

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

Because of scriptlet, we can do the following:

declare the variables or methods to be used (refer to Declaration ).
compile a JSP expression (reference expression ).
use any implied object and any object declared with
to write JSP statements (if you are using Java, these statements must comply with Java Language Specification ).
any text, HTML tag, and JSP elements must be excluded from scriptlet
when JSP receives the customer's request, the scriptlet will be executed. If the scriptlet contains the displayed content, the displayed content is included 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.