JSP files have three important characteristics:
Three kinds of elements use the scripting language:
The JSP Source Editor provides code completion and syntax coloring facilities to help you construct valid JSP syntax.
The three types of JSP elements are:
The JSP Source Editor knows the syntax for most JSP constructs and offers tags to terminate JSP elements correctly. JSP syntax is similar to XML. Action elements have a start tag, including the element name, possibly with attributes, an optional body, and a matching end tag. For example:
<mytag1 attr1="attribute value" ...>...</mytag1>
or
<mytag2 attr1="attribute value" .../>
JSP tags are case-sensitive, as in XML and XHTML.
Elements that have distinct start and end tags with an enclosed body must start and end in the same file. You cannot begin a tag in one file and end that tag in another file. This rule also applies to elements in the alternate syntax. For example, a scriptlet has the syntax <% scriptlet %>. Both the opening <% characters and the closing %> characters must be in the same physical file.
Following the XML specification, an element described using an empty tag is indistinguishable from an element using a start tag, an empty body, and an end tag.
Attribute values always appear quoted. Both single and double quotes can be used. The entities ' and %quot; are available to describe single and double quotes in output text. You can also use \" and \' within quoted text.
The syntax for comments within JSP files is as follows:
<%-- and --%>
For more complete information about JSP syntax see JavaServer Pages Specification Version 1.2, available at http://java.sun.com/products/jsp/download.html .
See Also | |
---|---|
JavaServer Pages Technology |