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 ...

Get Java™ After Hours: 10 Projects You'll Never Do at Work 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.