JSP - 8

 
Web Hosting
EziHosting provides fast, reliable web hosting solutions in Australia for both business and web developers.
Check it out what we have to offer...
 
Add Your Link
You can add your web site's link to the EziDirectory.
This will increase your site's traffic and link popularity!
Learn more...

 
Domain Names

Web Design
We specialise in Australian Web Design.
The EziHosting team can design your web site in days.
Contact us today for a free consultation and quote.

EziHosting is proud to be a corporate World Vision Sponsor - find out more...

Find out more about your secure certificate here.
Security and privacy issues
Earn 50¢
per click!
Become an
affiliate!

  Do you need
Technical Support?

Home

WEB HOSTING
Web Hosting Australia

F.A.Q.

EziSupport

Control Panel

Dedicated Servers

Special

 

DOMAIN NAMES
Australian Domain Names

TLDs

Int. Domains

Policy Stuff

 

DIRECTORY
Listing

Add your Site

 

MISCELLANEOUS
Web Design

Search Engine Optimisation.

Free Site Analysis

Toos & Tutorials

2 Free Carts!

EziMerchant

Secure Certificates

 

CONTACT US
Contact Details

E-Mail Us

 

JSP Tags

Another important syntax element of JSP are tags. JSP tags do not use <%, but just the < character. A JSP tag is somewhat like an HTML tag. JSP tags can have a "start tag", a "tag body" and an "end tag". The start and end tag both use the tag name, enclosed in < and > characters. The end starts with a / character after the < character. The tag names have an embedded colon character : in them, the part before the colon describes the type of the tag. For instance:

<some:tag>
body
</some:tag>

If the tag does not require a body, the start and end can be conveniently merged together, as

<some:tag/>

Here by closing the start tag with a /> instead of > character, we are ending the tag immediately, and without a body. (This syntax convention is the the same as XML.)

Tags can be of two types: loaded from an external tag library, or predefined tags. Predefined tags start with jsp: characters. For instance, jsp:include is a predefined tag that is used to include other pages.

We have already seen the include directive. jsp:include is similar. But instead of loading the text of the included file in the original file, it actually calls the included target at run-time (the way a browser would call the included target. In practice, this is actually a simulated request rather than a full round-trip between the browser and the server). Following is an example of jsp:include usage

<HTML>
<BODY>
Going to include hello.jsp...<BR>
<jsp:include page="hello.jsp"/>
</BODY>
</HTML>

Try it and see what you get. Now change the "jsp:include" to "jsp:forward" and see what is the difference. These two predefined tags are frequently very useful.

Exercise:
Write a JSP to do either a forward or an include, depending upon a boolean variable (hint: The concepts of mixing HTML and scriptlets work with JSP tags also!)

 

Next tutorial: JSP Sessions

 

 

 

Web Hosting Australia Monthly Special


At EziHosting, the Australian Web Hosting company,
we strive to become your internet technology partner
for the long run...

© 2003 EziHosting Australian Web Hosting - All Rights Reserved