First JSP Example

You are now ready to write and deploy your first JSP. The JSP in Listing 13.3 is a very simple JSP that uses EL to provide information about the request. EL is discussed in detail in the section “Element Language.”

Listing 13.3. Full Text of request-info.jsp
<HTML>
  <HEAD>
    <TITLE>Request Information</TITLE>
  </HEAD>
  <BODY>
    <P>Server ${header.Host}</P>
    <P>Header Accept-Encoding ${header["Accept-Encoding"]}</P>
    <P>Remote Host ${pageContext.request.remoteHost}</P>
    <P>Request Locale ${pageContext.request.locale}</P>
  </BODY>
</HTML>

Start up the J2EE RI and run deploytool and perform the following steps to deploy this JSP:

NOTE

This process is very similar to deploying servlets covered in Day 12. Alternatively you can use deploytool ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.