You
can create JSP files or edit those you created, add data from other Java™ beans,
and customize the result tables.
JSP files allow you to do the following and more:
- Access a Java bean when the page is processed.
- Embed variables in the page and get or display the value of bean properties
at runtime.
- Format the variable data.
- Repeat a block of HTML tagging that contains embedded variables and the
HTML formatting tags.
When a Web server like WebSphere® Application Server processes
the JSP file, it performs the following actions:
- Preprocesses the JSP file into executable code.
- Instantiates the Java bean.
- Places the resulting data into the output page (replacing the special
tags).
- Sends it as an HTML stream (for example) to a Web browser.
You can customize the JSP file, adding your own text and images using JavaScript™,
HTML, or JSP scriptlet tagging in Page Designer. These tags and script will
be included in the HTML file created by the Web server and returned to the
requesting browser.
Double-click a JSP file to open the file in Page
Designer. Using the Page Designer
JSP menu, you can insert the following
JSP elements:
- Beans
- Expressions, scriptlets, and declarations
- Forward and Include
- Include directives
- Get and Set properties
- Plug-ins
- Comments
- Custom tags
After adding these elements, you can select them and edit the contents
in the Attributes view, or use the Source page to edit or add additional content
using content assist. You can also edit using the Quick Edit view. You can
drag-and-drop or use smart double-click to add elements from the Snippets
view.
If you use JSP expressions in attribute values along with other
text, the entire attribute value must be enclosed in quotation marks. Even
though this is not technically required by Web servers during production,
it is required in the development environment in order for links fix-up, highlighting,
and content assist to work correctly. For example, a tag such as:
<IMG src=file<%=object.getFileNumber()%>.gif%>
should
be written as:
<IMG src="file<%=object.getFileNumber()%>.gif">
or,
better, entirely inside the JSP expression, as in:
<IMG src=<%="file"+object.getFileNumber()+".gif"%>>
or,
the best way to write it is with quotes
and inside the JSP expression,
as in:
<IMG src="<%="file"+object.getFileNumber()+".gif"%>">