0

jsp でさまざまなボタンを使用する方法と、押したボタンのそれぞれのページを送信する方法を知りたいです。

私は次のコードを試してみました:

<html>
<head> </head>
<body>
   <%-- scriptlet here --%>
   <%
       if(request.getParameter("btnSubmit_1")!=null)
        {
            // means submit_1  is pressed.
            // in java script we do give action as fallows
            /**document.frm2.action="sub-faconline.jsp";
            //document.frm2.target="right_f";
            //document.frm2.submit();****
            my question how can we do above java script code in scriplet in jsp
         }
       else if(request.getParameter("btnSubmit_2")!=null)
       {

           // i want to give some jsp page name here for action. 
        }
   %>



   <form name="frm2" method="post">
   <input type="button" id="btnSubmit_1" name="btnSubmit_1" value="btnSubmit_1" />
  <input type="button" id="btnSubmit_2" name="btnSubmit_2" value="btnSubmit_2"/> 
  </form>
  </body>
  </html>
4

1 に答える 1