EJB & JSP: Java On The Edge, Unlimited Edition by Lou Marco ISBN: 0764548026 Your Guide to Cutting-Edge J2EE Programming Techniques. Examining Some JSP Pages In this section, you ll see a few simple JSP pages and read a brief explanation of the JSP elements and how these elements produce dynamic content. A Simple JSP Page: Your Name Here and ereH emaN ruoY This JSP page code in Listing 3-1 requests that the user enter his or her name, after which it invokes a JSP that displays the user s name and the name spelled backward. Listing 3-1 shows an HTML page that contains a reference to a JSP followed by a JSP that generates the HTML containing the entered name and the name in reverse. Listing 31 shows the HTML page, forwardreverse.html, that requests user input. Listing 3-1: HTML page requesting a JSP 1 2 3 JSP Page to Display Name, Forward and Reverse 4 5 6

Enter Your Name Below

7
8 9 10
11 12 The HTML page above does not contain any JSP. Rather, the
tag on line 7 invokes a JSP named ShowForwardAndReverse.jsp when the user clicks the Submit button. If the user enters the name Lou Marco, the SUBMIT process encodes the data and passes it as a name-value pair, yourname=Lou+Marco, and then passes the following URL to the server: http://localhost:8080/forwardreverse.html?yourname=Lou+Marco. Note Use the Tomcat Web server, which has a JSP engine. See Appendix C for instructions on installing and configuring the Tomcat server. Listing 3-2 is the first of two examples that show slightly different ways to code ShowForwardAndReverse.jsp. Listing 3-2: A JSP page that prints name forward and reverse
Are you tired of finding web hosting providers listed as inexpensive?Just check our Inexpensive Web Hosting services.

Leave a Reply