【发布时间】:2023-03-19 06:03:01
【问题描述】:
我有一个包含用户名和按钮的 jsp 页面,当我单击按钮时,我想将用户名传递给模态,然后在单击模态按钮时,我将用户名发送到后端(struts2行动)。 (场景如下图所示)
我尝试通过 onClick 传递用户名:
<%-- Page.jsp --%>
<button onclick="document.forms[0].username.value='BOB'; toggle="modal" data-target="#myModal">
<fmt:message key='Delete user'/>
</button>
<jsp:include page="deleteUserModal.jsp"/>
在模式上我想读取 unsername 值:
<%-- Modal.jsp --%>
<button onclick="document.forms[0].username.value='???';document.forms[0].action='deleteMethod';document.forms[0].submit();">
<fmt:message key='delete'/>
</button>
有什么建议,
【问题讨论】:
标签: javascript jsp bootstrap-4 struts2 bootstrap-modal