title: Multiple buttons in JSP
body: <p>I need to have several buttons with different functions in my web-project, but i don't know the right way to realize it.
  I did it this way just for test:</p>
  
  <pre><code>&lt;input name="command" type="hidden" value="redirect"&gt;&lt;/input&gt;
  &lt;input type="submit" name="page" value="Make order"&gt;&lt;/input&gt;
  &lt;input type="submit" name="page" value="See bills"&gt;&lt;/input&gt;
  &lt;input type="submit" name="page" value="See orders"&gt;&lt;/input&gt;
  </code></pre>
  
  <p>And then in the command i switch throw enum of page names to find out, which button was clicked. One button should just redirect client to another page, and the others should invoke their own commands.</p>
  
  <p>I know it's a bad practice to postprocess a form <code>submit</code>, so i'm looking for another way to do it. I was advised to use JS <code>onclick</code>, but i don't have any experience in it and can't find any simple examples suitable to my project.</p>
  
  <p><strong>Edited</strong></p>
  
  <p>I have Action classes for ViewBillAction and ViewOrderAction. Also i have such class to define required action:</p>
  
  <pre><code>public class Redirect implements Action {
  
  @Override
  public String execute(TransferredData requestInformation) {
      String pageName = requestInformation.getRequestParameter("page");
      Action action;
      switch (pageName.toUpperCase()) {
      case "MAKE ORDER":
          return JSPManager.INSTANCE.getProperty(JSPManager.ORDER_PAGE_PATH);
      case "VIEW BILLS":
          action = new ViewBillsCommand();
          return action.execute(requestInformation);
      case "VIEW ORDERS":
          action = new ViewRequestsCommand();
          return action.execute(requestInformation);
  </code></pre>
  
  <p>The main problem is i don't know to HOW handle the button click events in JS at all. But this is the way i should do it and i would be very grateful for a simple example.</p>