I have few text boxes and 4 to 5 Buttons in my jsp page, based on the button click and data in the form i need to perform operations.
But I am not able to use request.getParameter() in my servlet
My JSP code :
    <form action="UsageEngine" method="post" target="console" enctype="multipart/form-data">
        <input class="form-control" type="file" multiple name="filepath"    
            required>
<br> <input class="form-control" type="text"
            name="Grepfilename" placeholder="Command Line.."><br>
        <!-- <input class="form-control" type="text" name="FileToBeDownloaded" placeholder="File to be Downloaded"><br> -->
        <select class="form-control" name="env">
            <option>pinDap75a</option>
            <option>pinIap04a</option>
            <option>pinDap71a</option>
        </select><br>
        <button class="btn btn-danger" name="action" id="Irel"
            value="test" onclick="show()">Env Check</button>
        <button class="btn btn-success" name="action" value="process"
            onclick="show()">Process SFTP</button>
        <button class="btn btn-warning" name="action" id="grep" value="Grep"
            onclick="show()">Grep</button>
        <button class="btn btn-primary" name="action" id="Download"
            value="Download" onclick="show()">Init Irel</button>
        <button class="btn btn-info" name="action" id="Irel"
            value="completeIrel" onclick="show()">Complete Irel</button>
</form>
File upload is working fine. But I need to pass filename , environment details, and value of the button as well. For all these getParameter was very helpfull, but due to Multipart/form-data I am not able to use that.
upload.parseRequest(request); helps in listing down all the fields but I cannot use it for my application.
For my application it is like IF 1st button clicked{ do this function } , if s2nd Button{ do another action} like that.
Every Button tag has same name "Action" but with different value, so I read the value from the action and perform my function calls with if else conditions
COde :
 if (Action.equalsIgnoreCase("Grep")) {
            String Filenames = request.getParameter("Grepfilename");
            String[] GrepFileName = Filenames.split(",");
            try {
                for (int i = 0; i < GrepFileName.length; i++) {
                    GrepOutput.addAll(ExecEngine.ExecuteGrep(GrepFileName[i],
                            env));
                }
            } catch (JSchException e) {
                e.printStackTrace();
            } catch (SftpException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (ArrayIndexOutOfBoundsException e) {
                e.printStackTrace();
            }
            request.setAttribute("consoleOutputForSFTP", GrepOutput);
            request.getRequestDispatcher("/consoleOutput.jsp").forward(request,
                    response);
        } else if (Action.equalsIgnoreCase("Download")) {
            try {
                consoleOutputForSFTP = ExecEngine.deployIrelWrapper(env);
                request.setAttribute("consoleOutputForSFTP",
                        consoleOutputForSFTP);
                request.getRequestDispatcher("/consoleOutput.jsp").forward(
                        request, response);
            } catch (JSchException | InterruptedException e) {
                e.printStackTrace();
            }
        } else if (Action.equalsIgnoreCase("completeIrel")) {
            String GrepFileName = request.getParameter("Grepfilename");
            try {
                consoleOutputForSFTP = ExecEngine.deployFinalIrelWrapper(
                        GrepFileName, env);
                request.setAttribute("consoleOutputForSFTP",
                        consoleOutputForSFTP);
                request.getRequestDispatcher("/consoleOutput.jsp").forward(
                        request, response);
            } catch (JSchException | InterruptedException e) {
                e.printStackTrace();
            }
 
     
    