I am trying to select a value from a dropdown list in an HTML form. This is a snippet from my page:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Upload file</title>
</head>
<body>
<form action="upload" enctype="multipart/form-data" method="post">
<table border="1">
<tr>
<td>CSV or TXT file:</td>
<td><input type="file" name="csvfile" /></td>
</tr>
<tr>
<td>Delimiter</td>
<td class="tdLabel"><label for="yourDelimiter"
class="label"> Enter your delimiter: </label></td>
<td><select name="yourDelimiter"
id="yourDelimiter">
<option value="-1">Select delimiter</option>
<option value="|">pipe</option>
<option value="\t">tab</option>
<option value="\s">space</option>
</select></td>
<tr>
<td></td>
<td><input type="submit" value="submit"></td>
</tr>
</table>
</form>
</body>
</html>
I am trying to read the entered delimiter value in my Servlet code using the below code:
String delimiter=request.getParameter("yourDelimiter");
But the selected value is never coming in the delimiter String. It is always coming as null. I am new to Web Projects. Can someone please help me to get this correct.