Q:

Processing form after modal submit in JSP

I am displaying a modal after a button click . The code of button for opening a modal is as follows : 
 <button type="button" name="btnEditIP" data-toggle="modal" data-target="#myModal" class="sultan_btn">Edit IP</button>\

The code of modal is as follows : 
<div id="myModal" class="modal fade">
     <div class="modal-dialog">
        <div class="modal-content">
            <form id="ipForm" class="form-horizontal" role="form" method="post" action="info_edit.jsp">
                  <div class="modal-header modal-header-warning">
                      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                          <h4 class="modal-title ">Please Enter IP Address</h4>
                  </div>

                  <div class="modal-body"> 
                     <div class="form-group">
                          <label for="inputName">IP Address</label>
                          <input type="text" class="form-control" name="ip"/>
                 </div> 

                 </div>
                 <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="button" name="btnSave" id="btnSave" class="btn btn-primary" data-dismiss="modal">Save</button>
                 </div>
            </form>
        </div>
   </div>

 
In edit_info.jsp page, I am trying to determine whether the btnSave button is pressed by the following code : 
if ((request.getParameter("btnSave") == null) ? false : true) {
      out.println("Form submitted");
}
else{
     out.println("Form not submitted");
}

Although , I am pressing the Save button in modal , I am always getting this message , "Form not submitted!" .That means , either the form is not submitted or there is an error in pressing button . 
I am not sure where is the error . I have tried a lot but could not identified where is the error . Please help me to solve this error . 

A:

Please change request.getAttribute("btnSave") to request.getParameter("btnSave").
Because getParameter() returns http request parameters. 
EDIT

I am not sure if one would see btnSave server side since the button
  name would not be sent ?

We can use type="submit" to send the pressed button's name to the server. 
<input type="submit" name="btnSave" value="SAVE"/>

Also Check: 
Difference between getAttribute() and getParameter()

Difference between type='button' and type='submit'

How do I call a specific Java method on click/submit event of specific button in JSP?

