Reading Parameter

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Reading Parameter as PDF for free.

More details

  • Words: 243
  • Pages: 7




Handling The Client Request: FORM DATA Objectives    





Reading individual request parameters Reading entire set of request parameter Handling missing and malformed data Filtering special characters out of request parameter Automatically filling in a data object with request parameter values. Dealing with incomplete form submission.



Reading single values: 





To read a request parameter, you simply call the getParameter() methods of HttpServletRequest, supplying casesensitive parameter name. An empty String is returned if parameter exists but it does not have any value. Null is returned if there was no such parameter.



getParameterValues() 



If same parameter name might appear in the form data more than once, you should call getParameterValues() instead of getParameter() The return value of getParameterValues is null for non existent parameter names and is a none element array when



getParameterNames() and getParameterMap() 





The getParameterNames() returns an empty Enumeration(not null) . Enumeration is an interface that merely guarantees that actual class will have hasMoreElements and nextElement. An alternative to getParameterNames is getParameterMap. This method returns a Map.



Reading input in multiple character sets: setCharacterEncoding() 

By default request.getParameter interprets inp1ut using the server’s current character set. To change the default use setCharacterEncoding() method of ServletRequest.



Using default values when parameters are missing   

The value is null The value is an empty string The value is not empty string of wrong format.

Related Documents

Reading Parameter
November 2019 27
Table Parameter
July 2020 17
Parameter Polar
November 2019 35
Bsc Parameter
May 2020 15
Parameter Ka.pptx
April 2020 19
Plastic Parameter
May 2020 15