Reviews : Java Books : Professional JSP Site Design :



Title: Professional JSP Site Design
ISBN: 1861005512
Price: $ 59.99
£ 43.99
C$ 89.95
© Wrox Press, Ltd.

Using the Tags – browsertags.jsp

Our second example makes use of the tags we designed, in a variety of ways. As you can see, whilst the tags allow a lot of flexibility the syntax is nice and simple, just right for the page designer:

<%@ taglib uri="http://www.wrox.com/taglib/browser" prefix="browser" %>

<html>
	<head>
	   <title>Browser Capabilities Filter and Tags</title>
	</head>
	<body>
	   <h1>Browser Support Tags!</h1>

	   <p>Your browser...</p>

	   <ul>
	   <browser:supportFor feature="frames" name="browser">
		<li>supports frames</li>
	   </browser:supportFor>

	   <browser:noSupportFor feature="frames" name="browser">
		<li>does not support frames</li>
	   </browser:noSupportFor>

	   <browser:is name="browser" browser="ie">
		<li>is IE</li>
	   </browser:is>
	   <browser:isNot name="browser" browser="ie">
		<li>is not IE</li>
	   </browser:isNot>
	   <browser:is name="browser" browser="lynx">
		<li>is Lynx</li>
	   </browser:is>
	
	   <browser:isNot name="browser" browser="lynx">
		<li>is not Lynx</li>
	   </browser:isNot>
	
	   <browser:is name="browser" 
	   		browser="IE" majorVer="4" minorVer="0">
		<li>is IE 4.0 or greater</li>
	   </browser:is>
	
	   <browser:isNot name="browser" 
	   		browser="IE" majorVer="4" minorVer="0">
		<li>is not IE 4.0 or greater</li>
	   </browser:isNot>
	
	   <browser:is name="browser" browser="IE" majorVer="6" minorVer="0"
			exact="true">
		<li>is IE 6.0</li>
	   </browser:is>
	   
	   <browser:isNot name="browser" 
	   		browser="IE" majorVer="6" minorVer="0"
			exact="true">
		<li>is not IE 6.0</li>
	   </browser:isNot>
	
	   <browser:is name="browser" majorVer="2">
		<li>is version 2.x or higher</li>
	   </browser:is>
	
	   <browser:isNot name="browser" majorVer="2">
		<li>is not version 2.x or higher</li>
	   </browser:isNot>
	
	   <browser:is name="browser" majorVer="2" exact="true">
		<li>is version 2.x</li>
	   </browser:is>
	
	   <browser:isNot name="browser" majorVer="2" exact="true">
		<li>is not version 2.x</li>
	   </browser:isNot>
	
	</ul>
	</body>
	</html>

In Internet Explorer the result is as we would expect:

With Lynx we again get the right answer:


Note:Color coded lines have been split for display purposes

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.