Each submit button calls the same servlet with slightly different parameters.
If you wish to have different behaviour based on the button that is pressed you need to test which button was pressed.
If you click the add button the parameters name=????
and add=Add
will be submitted. So if you add some code along the lines of.
if (request.getParameter("add") != null){
// do add
} else if (request.getParameter("sort") != null){
// do sort
}
you should get what you want.