3.6.1.1 JSP directives
JSP directive tags define the attributes that apply to the entire JSP page. We
used
<%@ LANGUAGE= Java  %>
in our JSP pages, indicating that we will use
Java as the default language. Figure 72 shows a portion of our logout.jsp file.
Note that the JSP directive is located at the beginning of the file.
<%@ LANGUAGE="Java" %>
charset=ISO 8859 1">
MainPage
Figure 72. Portion of logout.jsp
A complete listing of all relevant JSP directives can be obtained from Sun's
JSP page at:
http://java.sun.com/products/jsp
3.6.1.2 Inline scripts
You can embed any valid Java code within a JSP file between the
<%
and
%>
tags. The Java codes can be intermingled with the HTML. Figure 73
illustrates how we embed HTML and Java into the JSP file.
HomePage
<% HttpSession session=request.getSession(true);
if (session.getValue("error") !=null){ %>
ERROR:
<% out.println(session.getValue("error"));
}
session.removeValue("error");
%>
Figure 73. Embedded HTML and Java in a JSP file
In Figure 73, we embedded the HTML by ensuring that we enclosed the
preceding Java statement with
<% %>
, provide some HTML codes, and then
Chapter 3. Building the Web server
99




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved