Hi all,
I want to retrieve selected item from listbox in a jsp page and send it to a servlet. I am not able to get selected value. Can u please tell me how to get selected value.
In servlet i am trying to get the selected value by using getparameter() function, but its not working.
This is the code i hve given in jsp page:
<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Unblock Page</title>
</head><br><br>
<body background ="bluebg1.jpg" text="DarkBlue">
<select name = "urllist" size="1" >
<%Iterator itr;%>
<% List data= (List)request.getAttribute("data");
for (itr=data.iterator(); itr.hasNext(); )
{
String s=itr.next().toString();
%>
<option value = "<%=s%>" > <%=s%> </option>
<%}%>
</select>
<form action="./unblock" method="post"><h1 align="center"><input type="submit" value="Unblock" ></h1></form>
<%
String urllist = request.getParameter("urllist");
System.out.println("String in jsp"+urllist);
%>
</body>
</html>