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
    <TITLE>Request Information</TITLE>
    <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>

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


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.