NOTE: Assuming that Apache Tomcat is installed in C:\apache-tomcat-7.0.2 and your environment is setup as per environment setup tutorial.

Let us keep above code in JSP file hello.jsp and put this file in C:\apache-tomcat-7.0.2\webapps\ROOT directory and try to browse it by giving URL http://localhost:8080/hello.jsp. This would generate following result:

JSP Declarations:

A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file.

JSP Actions:

JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.

There is only one syntax for the Action element, as it conforms to the XML standard:

<jsp:action_name attribute="value" />

Action elements are basically predefined functions and there are following JSP actions available:

Syntax

Purpose

jsp:include

Includes a file at the time the page is requested

jsp:useBean

Finds or instantiates a JavaBean

jsp:setProperty

Sets the property of a JavaBean

jsp:getProperty

Inserts the property of a JavaBean into the output

jsp:forward

Forwards the requester to a new page

jsp:plugin

Generates browser-specific code that makes an OBJECT or EMBED tag for the Java plugin

JSP Operators:

JSP supports all the logical and arithmetic operators supported by Java. Following table give a list of all the operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom.

Within an expression, higher precedence operators will be evaluated first.

Category

Operator

Associativity

Postfix

() [] . (dot operator)

Left to
right

Unary

++ - - ! ~

Right to left

Multiplicative

* / %

Left to right

Additive

+ -

Left to right

Shift

>> >>> <<

Left
to right

Relational

> >= < <=

Left to right

Equality

== !=

Left
to right

Bitwise AND

&

Left to right

Bitwise
XOR

^

Left to right

Bitwise OR

|

Left
to right

Logical AND

&&

Left to right

Logical OR

||

Left to
right

Conditional

?:

Right to left

Assignment

= += -= *= /= %=
>>= <<= &= ^= |=

Right to left

Comma

,

Left to
right

JSP Literals:

The JSP expression language defines the following literals:

Boolean: true and false

Integer: as in Java

Floating point: as in Java

String: with single and double quotes; " is escaped as \", ' is escaped as \', and \ is escaped as \\.