Home | | Web Technology | Parameter Data

Chapter: Web Technology : Host Objects

Parameter Data

Here's a simple example that reads parameters named param1, param2, and param3, listing their values in a bulleted list.

PARAMETER DATA

 

Reading Parameters

 

Here's a simple example that reads parameters named param1, param2, and param3, listing their values in a bulleted list. Note that, although you are required to specify response settings (content type, status line, other HTTP headings) before beginning to generate the content, there is no requirement that you read the request parameters at any particular time.

Front End to ShowParameters

 

Here's an HTML form that sends a number of parameters to this servlet. Right click on the source code link to download the HTML. Left click on the link to try it out on-line. It uses POST to send the data (as should all forms that have PASSWORD entries), demonstrating the value of having servlets include both a doGet and a doPost. However, just for the sake of illustration, a version using GET can also be downloaded or tried out on-line.

 

PostForm.html

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML>

<HEAD>

 

<TITLE>A Sample FORM using POST</TITLE> </HEAD>

 

<BODY BGCOLOR="#FDF5E6">

<H1 ALIGN="CENTER">A Sample FORM using POST</H1>

 

<FORM ACTION="/servlet/hall.ShowParameters"

METHOD="POST">

Item Number:

 

<INPUT TYPE="TEXT"

NAME="itemNum"><BR> Quantity:

 

<INPUT TYPE="TEXT"

NAME="quantity"><BR> Price Each:

<INPUT TYPE="TEXT" NAME="price"

VALUE="$"><BR> <HR>

First Name:

 

<INPUT TYPE="TEXT"

NAME="firstName"><BR> Last Name:

<INPUT TYPE="TEXT"

NAME="lastName"><BR> Middle Initial:

 

<INPUT TYPE="TEXT"

NAME="initial"><BR> Shipping Address:

<TEXTAREA NAME="address" ROWS=3

COLS=40></TEXTAREA><BR> Credit Card:<BR>

 

<INPUT TYPE="RADIO"

NAME="cardType"

VALUE="Visa">Visa<B

R>

<INPUT TYPE="RADIO" NAME="cardType"

 

VALUE="Master Card">Master

Card<BR> <INPUT TYPE="RADIO" NAME="cardType"

VALUE="Amex">American

Express<BR> <INPUT TYPE="RADIO"

NAME="cardType"

VALUE="Discover">Discover<BR

> <INPUT TYPE="RADIO" NAME="cardType"

VALUE="Java SmartCard">Java

SmartCard<BR> Credit Card Number:

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Web Technology : Host Objects : Parameter Data |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.