Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Servlet Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

7.4 Reading Parameters From a Form

Servlets often use standard HTML forms. The container parses the form input, and makes the names and values of the parameters available in the request object passed to the servlet.

The getParameter() function takes a parameter name and returns the value of the parameter, or an empty string if the request does not contain a parameter by that name. For example, the code below finds the value of the username parameter:

Some parameters contain more than one value, for example, the results from a checkbox. The function getParameterValues() returns an list containing the values submitted for a parameter. If the request does not contain a parameter by that name or the parameter has no value, getParameterValues() returns an empty list.

The code sample below shows one way to process a parameter with more than one value:

The getParameterNames() function returns a rwsf::Enumeration containing the names of all parameters in the request. The code below processes each parameter in the request:



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.