Results 1 to 1 of 1

Thread: Java - Reading Request Parameter Values

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Java - Reading Request Parameter Values

    The following code shows how http request parameters can be
    grabbed from an .html form and displayed. Code was tested on
    tomcat implementation 5.0.28 using JSP 2.0 and JSTL 1.1.
    Code:
     <%@ page contentType="text/html" %>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
      
     <html>
      <head>
       <title> JSP Example </title>
      </head>
      <body bgcolor = "black">
      <form action="usersetup.jsp" method="get">
      <table>
       <tr>
        <td>
         <font color = "green">
          First Name:
         </font>
        <input type = "text" name = "fname"/>
        </td>
       </tr>
       <tr>
        <td>
         <font color = "green">
          Last Name:
         </font>
        <input type = "text" name = "lname"/>
        </td>
       </tr>
       <tr>
        <td>
         <font color = "green">
          Address:
         </font>
         <input type = "text" name = "address"/>
        </td>
       </tr>
       <tr>
        <td>
         <font color = "green">
          City:
         </font>
         <input type = "text" name = "city"/>
        </td>
       </tr>
       <tr>
        <td>
         <font color = "green">
          State:
         </font>
         <input type = "text" name = "state"/>
        </td>
       </tr>
       <tr>
        <td>
         <input type = "submit" name = "send data"/>
        </td>
       </tr>
      </table>  
     </form>
       <font color = "green">
        You Entered: <br>
        First Name: <c:out value = "${param.fname}"/><br>
        Last Name: <c:out value = "${param.lname}"/><br>
        Address: <c:out value = "${param.address}"/><br>
        City: <c:out value = "${param.city}"/><br>
        State: <c:out value = "${param.state}"/><br>
       </font>
      </body>
     </html>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width