Java 在同一页面中使用发送数据,并使用JSP显示结果(表单),而不更改(表单)编码

Java 在同一页面中使用发送数据,并使用JSP显示结果(表单),而不更改(表单)编码,java,forms,jsp,jstl,hashtag,Java,Forms,Jsp,Jstl,Hashtag,这是一种没有标签的表单,对于提交按钮,它不像普通表单那样使用。它用于提交数据 问题是如何使用???发送数据 另外,当我同时点击搜索按钮时,没有收到任何数据 使用标准表单时,两者都可以显示结果。这段代码是用相同的页面JSP编写的 -无法更改第一个编码,因为它是赋值,需要解决。-在代码中添加一个表单标记,如 <div id="main_search"> <table> <tr> <td>Product</td>

这是一种没有标签的表单,对于提交按钮,它不像普通表单那样使用。它用于提交数据

问题是如何使用???发送数据

另外,当我同时点击搜索按钮时,没有收到任何数据

使用标准表单时,两者都可以显示结果。这段代码是用相同的页面JSP编写的


-无法更改第一个编码,因为它是赋值,需要解决。-

在代码中添加一个表单标记,如

<div id="main_search">
  <table>
    <tr>
      <td>Product</td>
      <td>:</td>
      <td>
        <input type="checkbox" name="product" class="prod_checkbx" value="Bilateral-VC">Bilateral-VC
        <br>
        <input type="checkbox" name="product" class="prod_checkbx" value="Bilateral Non-VC">Bilateral Non-VC
        <br>
        <input type="checkbox" name="product" class="prod_checkbx" value="Budget Domestic">Budget Domestic
        <br>
        <input type="checkbox" name="product" class="prod_checkbx" value="Budget High">Budget High
        <br>
        <input type="checkbox" name="product" class="prod_checkbx" value="Budget International">Budget International
        <br>
        <input type="checkbox" name="product" class="prod_checkbx" value="IDD Buffet Base">IDD Buffet Base
        <br>
        <input type="checkbox" name="product" class="prod_checkbx" value="Premium">Premium
        <br>
      </td>
    </tr>
    <tr>
      <td>Destination</td>
      <td>:</td>
      <td>
        <input id="destination" type="text" name="destination" />
      </td>
    </tr>
    <tr>
      <td colspan="9" align="center">
        <a id="search" name="search" class="button orange small" style="cursor:pointer" href="#">SEARCH</a>
      </td>
    </tr>
  </table>
</div>

<div id="search_result" style="overflow: auto;">
  <h2>Floor Price Edit</h2>
  <table id="result-tbl" class="searchTable">
    <tr>
      <th>Destination</th>
      <th>Product</th>
    </tr>
    <tr>
      <% String dest=r equest.getParameter( "destination"); %>
        <td>
          <%=d est %>
        </td>
    </tr>
    <% if (dest !=n ull) { %>
      <sql:setDataSource var="db" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3307/icars" user="root" password="" />
      <sql:query var="dest_result" dataSource="${dbsource}">
        SELECT * from icx_pricing_desk WHERE DESTINATION LIKE '
        <%=d est %>%'
      </sql:query>
      <c:forEach var="row" items="${dest_result.rows}">
        <tr>
          <td>
            <c:out value="${row.DESTINATION}" />
          </td>
        </tr>
      </c:forEach>
      <% } %>
        <td>
          <% String products[]=r equest.getParameterValues( "product"); %>
            <% if(products !=n ull) { %>
              <% for(int i=0; i<products.length; i++) { %>
                <%=products[i]%>
                  <sql:query var="prod_result" dataSource="${db }">SELECT * FROM icx_pricing_desk WHERE PRODUCT = '
                    <%=products[i]%>'</sql:query>
                  <c:forEach var="row" items="${prod_result.rows}">
                    <tr>
                      <td>
                        <c:out value="${row.PRODUCT}" />
                      </td>
                    </tr>
                  </c:forEach>
                  <% } } %>
        </td>
  </table>
</div>
要记住的事情

表单标签:methodPOST,Form1的名称 方法在标记的onclick上调用
查看抽象细节,您的需求看起来可以使用AJAX调用AJAX调用???你知道有什么网站可以告诉我吗???更好的视频教程..嗯。。但是我不是说过第一个编码不能改变吗。。让我们只说第一个编码是个问题。。我需要解决它唯一的区别是表单标记和onclick方法。如果你想提交一个页面,那么必须要提交一个表单。
<form name="form1" method="POST">
   <table>

   <!-- Your code ->

    <a  id="search" name="search" class="button orange small" style="cursor:pointer" href="javascript:void(0);" onclick="document.form1.submit();">SEARCH</a>

   </table>
</form>