- Form parameters are key,value pairs where both are string objects.
- A Form parameter can be associated with single or multiple values.
public String getParameter(String pname) ---- returns the value associated with the specified
parameter.
public String[] getParameterValues(String pname) ---- returns all values associated with specified
paremter.
public Enumeration getParameternames() ---- returns all formParameter names associated with
the request.
public Map getParameterMap() ---- returns map object containing parameter names
as keys and parameter values as map values.
key String value String[]
---------------- ---------------------
user { degree }
course { SCJP,SCWCD }
age { 67 }
Sales { 1000 }
Programme to retrieve the above parameters :
Map m=req.getParameterMap();
for(object o1 : m) {
mapentry m1=(map.entry)o1;
String pname=(String) m1.getkey();
String[] pValues=(String[])m1.getValue();
out.println(pname);
for(String s1:pValues)
{
out.println(s1);
}
}
No comments:
Post a Comment