I have a dropdown which consist the language names. I am setting the value and displaying name of the dropdown by using a hashmap.
Map langCode = x.getCountryList();
for( Object key :langCode.keySet() )
{%>
System.out.println((String)key);
}
String name = request.getParameter("country");
request.setAttribute("code", name);
%>
Values are passed correctly to dropbox as it print all the values in console. the set attribute is accessed in the particular servlet. But it gives a null value. Do you have any idea?Thank you in advance
UPDATED
Map langCode = x.getCountryList();
for( Object key :langCode.keySet() )
{%>
/option>
}
String name = request.getParameter("country");
%>
/> .
In the servlet I used,
request.getParameter("code");
解决方案
update your jsp likewise,
...
/>
....
then get it from your servlet likewise,
request.getParameter("code"); // will return value of code
NOTE :
Remove from your jsp-code if above solution you gonna implement then,
request.setAttribute("code", name);