I'm not getting my error maybe someone can help... this is my jsp code :
<html> <body> <form action="UploadServlet" method="post" enctype="multipart/form-data"> <fieldset> <legend>Read a CSV File</legend> <span class="help-block">Uploads the csv to the server and executes the checked task.</span> <input type="file" name="file" size="50" /> <br> <br> <label class="radio"> <input type="radio" name="fileOptions" id="import" value="import" onchange="showRootDirectoryDiv()" checked>import : create tasks from csv import file </label> <label class="radio"> <input type="radio" name="fileOptions" id="create" value="create" onchange="showRootDirectoryDiv()">create : create directory from root-directory and import file </label> <label class="radio"> <input type="radio" name="fileOptions" id="differ" value="differ" onchange="showRootDirectoryDiv()">differ : differs tasks from csv import file to jira tasks of a specific FixVersion and creates a csv file with tasks, which are not in jira and creates a report about occurrence of all tasks (jQL-query is taken from properties) </label> <br> <div id="root-directory"> <label>Enter the root-directory</label> <input type="text" name="root-directory-create"> </div> <br> <button type="submit" class="btn">Upload File</button> </fieldset> </form> </body> </html> So now
String uploadOption = request.getParameter("fileOptions"); should always return a value because there's always a checked radio button (import by default).
But I'm ALWAYS getting null no matter what's selected?? I'm not getting it checked the name like 5 times but I'm always getting null.
mulipartas you are usingenctype="multipart/form-data"in which request parameters are unavailable unless you parser the request explicitly using some mulpipart parser like Apache Common FileUpload (The Servlet API does not support this functionality out of the box).