• <small id='0t48I'></small><noframes id='0t48I'>

      <bdo id='0t48I'></bdo><ul id='0t48I'></ul>

      <tfoot id='0t48I'></tfoot>

      1. <legend id='0t48I'><style id='0t48I'><dir id='0t48I'><q id='0t48I'></q></dir></style></legend>
        <i id='0t48I'><tr id='0t48I'><dt id='0t48I'><q id='0t48I'><span id='0t48I'><b id='0t48I'><form id='0t48I'><ins id='0t48I'></ins><ul id='0t48I'></ul><sub id='0t48I'></sub></form><legend id='0t48I'></legend><bdo id='0t48I'><pre id='0t48I'><center id='0t48I'></center></pre></bdo></b><th id='0t48I'></th></span></q></dt></tr></i><div id='0t48I'><tfoot id='0t48I'></tfoot><dl id='0t48I'><fieldset id='0t48I'></fieldset></dl></div>

        使用带有 Ajax 的单个提交按钮在 JSP 中提交两个 HTML 表单

        Submit two HTML forms in JSP using single submit button with Ajax(使用带有 Ajax 的单个提交按钮在 JSP 中提交两个 HTML 表单)
        • <legend id='JQDBr'><style id='JQDBr'><dir id='JQDBr'><q id='JQDBr'></q></dir></style></legend>

              <bdo id='JQDBr'></bdo><ul id='JQDBr'></ul>
              • <tfoot id='JQDBr'></tfoot>

                <i id='JQDBr'><tr id='JQDBr'><dt id='JQDBr'><q id='JQDBr'><span id='JQDBr'><b id='JQDBr'><form id='JQDBr'><ins id='JQDBr'></ins><ul id='JQDBr'></ul><sub id='JQDBr'></sub></form><legend id='JQDBr'></legend><bdo id='JQDBr'><pre id='JQDBr'><center id='JQDBr'></center></pre></bdo></b><th id='JQDBr'></th></span></q></dt></tr></i><div id='JQDBr'><tfoot id='JQDBr'></tfoot><dl id='JQDBr'><fieldset id='JQDBr'></fieldset></dl></div>

                1. <small id='JQDBr'></small><noframes id='JQDBr'>

                    <tbody id='JQDBr'></tbody>
                  本文介绍了使用带有 Ajax 的单个提交按钮在 JSP 中提交两个 HTML 表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的页面设计是这样的,我必须使用两个单击提交然后保存到数据库的表单,反之亦然.

                  My page design is such that I have to use two forms that submit on single click and then saved to database and vice verse.

                  我在一个带有 Struts 2 框架的 JSP 页面上使用它.我已经尝试过 Ajax 解决方案,但它们对我不起作用.

                  I am using this on a JSP page with Struts 2 Framework. I have tried the Ajax solutions but they are not working for me.

                  这是我的脚本(已更新):

                  $("#visitType").buttonset();
                  $("#patientCondition").buttonset();
                  $("input[type=submit], a, button").button().click(function(event) {
                    event.preventDefault();
                    var inputs=$('#visitType,#patientCondition ').find(':input').not(this);
                    var form_data={};
                    inputs.each(function(){
                      form_data[this.name]=$(this).val();
                    });
                    $.post('patientSoapAll',  form_data, function(response){  
                    });
                  });
                  

                  我的表格1:

                  <s:form action="PatientSoapAll" method="post">
                  
                          <div id="visitType">
                              <input type="radio" id="I" value="I" <s:if test='pSB.rOS == "I"'>checked</s:if> name="pSB.rOS" /><label for="I">I V</label> 
                              <input type="radio" id="R" value="R"<s:if test='pSB.rOS == "R"'>checked</s:if>name="pSB.rOS" /><label for="R">Regular   Visit</label> 
                              <input type="radio" id="P/N" <s:if test='pSB.rOS == "P/N"'>checked</s:if>name="pSB.rOS" /><label for="D/N">Re- Evaluation</label> 
                              <input type="radio" id="D/N"<s:if test='pSB.rOS == "D/N"'>checked</s:if> name="pSB.rOS" /><label for="
                      
                      P/N">Discharge</label>
                      </div>
                  </s:form>
                  

                  我的表格2:

                  <s:form action="PatientSoapAll" method="post">
                  
                      <div id="patientCondition">
                          <input type="radio" id="new" value="n"<s:if test='pSB.r2 == "n"'>checked</s:if> name="pSB.r2" /> <label for="new">New</label>
                          <input type="radio" id="noChange" value="nC" <s:if test='pSB.r2 == "nC"'>checked</s:if> name="pSB.r2" /><label for="noChange">No Change</label> 
                          <input type="radio" id="progressing" value="p"<s:if test='pSB.r2 == "p"'>checked</s:if> name="pSB.r2" /><label for="progressing">Progressing</label> 
                          <input type="radio" id="notProgressing" value="nP" <s:if test='pSB.r2 == "nP"'>checked</s:if>   name="pSB.r2" /><label for="notProgressing">Not Progressing</label>
                      </div>
                  </s:form>
                  

                  这是我的更新提交按钮.从 <div> 中移除并放置在表格内.

                  This is my Updated Submitted Button. Removed from <div> and placed inside a table.

                  <tr>
                    <td></td>
                    <td><input type="submit" value="Save Note" /></td>
                  </tr>
                  

                  我正在使用 Struts 2,我想将此提交按钮重定向到操作 PatientSoapAll.我正在使用 .do 的自定义扩展名而不是 .action(默认情况下).请告诉我如何将此提交按钮重定向到 Struts 2 中的相应操作类.

                  I am using Struts 2 and I want to redirect this submit button to an action PatientSoapAll. I am using custom extension of .do instead of .action(by default). Please tell me how can I redirect this submit button to respective action class in Struts 2.

                  推荐答案

                  找到了一个简单的解决方案.

                  Found an easy solution to it.

                  javascript:

                  javascript:

                  submitForms = function() {
                    $('#form2 :input').not(':submit').clone().hide().appendTo('#form1');
                      document.getElementById("form1").submit();
                  };
                  

                  提交按钮:

                  <input type="button" value="Save Note" onclick="submitForms()" />
                  

                  这篇关于使用带有 Ajax 的单个提交按钮在 JSP 中提交两个 HTML 表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)

                  <small id='lvGDT'></small><noframes id='lvGDT'>

                        • <i id='lvGDT'><tr id='lvGDT'><dt id='lvGDT'><q id='lvGDT'><span id='lvGDT'><b id='lvGDT'><form id='lvGDT'><ins id='lvGDT'></ins><ul id='lvGDT'></ul><sub id='lvGDT'></sub></form><legend id='lvGDT'></legend><bdo id='lvGDT'><pre id='lvGDT'><center id='lvGDT'></center></pre></bdo></b><th id='lvGDT'></th></span></q></dt></tr></i><div id='lvGDT'><tfoot id='lvGDT'></tfoot><dl id='lvGDT'><fieldset id='lvGDT'></fieldset></dl></div>
                        • <legend id='lvGDT'><style id='lvGDT'><dir id='lvGDT'><q id='lvGDT'></q></dir></style></legend>
                          <tfoot id='lvGDT'></tfoot>
                            <bdo id='lvGDT'></bdo><ul id='lvGDT'></ul>

                              <tbody id='lvGDT'></tbody>