O'Reilly logo

Java™ After Hours: 10 Projects You'll Never Do at Work by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Request Objects

When the user clicks the Submit button in ch05_04.html, the ACTION attribute in the HTML makes the browser send the data in the HTML controls to ch05_05.jsp:

<HTML>
    <HEAD>
        <TITLE>Enter your name</TITLE>
    </HEAD>

    <BODY>
        <H1>Enter your name</H1>
        <FORM NAME="form1" ACTION="ch05_05.jsp" METHOD="POST">
            <INPUT TYPE="TEXT" NAME="text">
            <INPUT TYPE="SUBMIT" VALUE="Submit">
        </FORM>
    </BODY>
</HTML>

In ch05_05.jsp, the request object gives you access to the data sent from the HTML form. This object is built in to the JSP framework, much like the out object, so it's already available to you as soon as your code starts. It's an object of the javax.servlet.http.HttpServletRequest class, and you can see the significant methods of javax.servlet.http.HttpServletRequest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required