Обмен содержимого div с другой страницы JSP - PullRequest
1 голос
/ 01 мая 2020

У меня в основном 4 страницы:

affiliates-manage. jsp (содержит код ниже):

<%@ include file="/includes/core.jsp" %>
<div name="tableframe" id="tableframe">
  <c:import url = "{URL}/servlets/Vendors.Affiliates">
    <c:param name = "SESSIONID" value = "${sessionid}" />
    <c:param name = "ACTION" value = "-1"/>
    <c:param name = "ROWTEMPLATEURL" value = "{URL}/affiliates-manage-tablerow.html"/>
    <c:param name = "NEXT_PAGE" value = "{URL}/affiliates-manage-start.jsp"/>
    <c:param name = "ERROR_PAGE" value = "{URL}/error_frame.jsp"/>
  </c:import>
</div>

affiliates-manage-start. jsp (содержит код ниже ):

function submitForm (action, target, nextpage, affiliateid) {
  var form = document.affiliates;
  form.ACTION.value = action;
  form.target = target;
  form.NEXT_PAGE.value = nextpage;
  form.ERROR_PAGE.value = (target == "_parent") ? "{URL}/error.jsp" : "{URL}/error_frame.jsp";
  form.AFFILIATEID.value = affiliateid;
  form.submit ();
}

function editAffiliate (affiliateid) {
  submitForm (1, "tableframe", "{URL}/affiliates-manage-edit.jsp", affiliateid);
}

affiliates-manage-tablerow. html (содержит код ниже):

<a href="javascript:editAffiliate (##AFFILIATEID##)">##AFFILIATEID##</a>

affiliates-manage-edit. jsp (отображает таблицу для редактирования информация о партнерах):

<%@ include file="/includes/core.jsp" %>
<div class="transfer-section">
  <form name="affiliates" action="{URL}}/servlets/Vendors.Affiliates" method="post">
    <input type="hidden" name="ACTION" value="11" />
    <input type="hidden" name="AFFILIATEID" value="${param.AFFILIATEID}" />
    <input type="hidden" name="NEXT_PAGE" value="{URL}/affiliates-manage-edited.html" />
    <input type="hidden" name="ERROR_PAGE" value="{URL}/error_frame.jsp" />
    <table class="table" style="margin-bottom: 1rem; width: 70%; border: 1px solid #a9a9a9;">
      <thead>
        <tr class="table-category text-center">
          <th class="sort-column">Product&nbsp;Name</th>
          <th class="sort-column">Default&nbsp;Percentage</th>
          <th class="sort-column">Custom&nbsp;Percentage</th>
        </tr>
        ${param.TABLEDATA}
      </thead>
    </table>
    <input type="button" value="Save" onclick="submitForm (affiliates);" class="save-btn" style="margin-right: .3rem;" />
    <input type="button" value="Cancel" onclick="location.reload();" class="save-btn" />
  </form>
</div> <!-- end .transfer-section -->

Моя цель - поменять содержимое tableframe на содержимое affiliates-manage-edit.jsp для выбранного партнера (affiliateid). Я попытался добавить $('#tableframe').load('affiliates-manage-edit.jsp'); и $('#tableframe').load('affiliates-manage-edit.jsp, affiliateid'); в submitForm() внутри editAffiliate(), и он все правильно открывает в новом окне (которое мне не нужно), но в исходном окне оно не отображается ${param.TABLEDATA} информация (не заполняется). Я пробовал несколько разных вещей, и .load() приблизил меня к этому моменту.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...