我有两个jsp文件。在第一个文件中显示文件的表,并且在代码中我可以访问一个值(文件的 ID)。这也是一个弹出窗口。如果文件分配了注释,则该注释将显示在表中。如果没有,则会在其位置显示一个用于添加注释的按钮。单击按钮后,我们调用第二个文件中的代码,并打开一个弹出窗口。我想访问第二个文件中的文件 ID。第一个文件(所以在这里我调用某个地方的 id${na.id}我将获取每个文件的 id):<div id="files-list-${bean.product.id}">        <table class="table">            <thead>                <tr>                    <th>File</th>                    <th>Notes</th>                </tr>            </thead>            <tbody>                <c:if test="${fn:length(bean.product.files)>0}">                 <c:forEach items="${bean.product.files}" var="na">                    <tr>                        <td>${na.name}</td>                        <td>                                                            <c:if test="${empty na.note}">                                <t:jquery func="myDialog('filesNotes',${bean.product.id},${bean.product.version})">Add note</t:jquery>                            </c:if>                            <c:if test="${not empty na.note}">                                ${na.note}                                                      </c:if>                        </td>                    </tr>                </c:forEach>                </c:if>            </tbody>        </table>    </div>第二个文件(弹出窗口)- 这里${bean.fileId}操作 URL 为空:<div id="filesNotes" class="classA" title="Notes">    <form:form role="form" method="POST" modelAttribute="bean" action="app/updateFile.ajax?id=${bean.product.id}&fileId=${bean.fileId}" onsubmit="return postAjaxForm(this)">        <form:hidden path="id" value="${bean.product.id}" />        <input type="hidden" name="version" value="${bean.product.version}" />        <form:textarea path="product.scratchpad" htmlEscape="true"  cssClass="form-control" rows="17" cols="63"/>    </form:form></div>myDialog 函数:(注意我不擅长 js 和前端:))function myDialog(id, oid, oversion){    if($("#"+id).length < 1){        alert("not found element #"+id);        return;
                    
                    
                1 回答
 
                    
                    
                            慕村9548890
                            
                                
                            
                        
                        
                                                
                    TA贡献1884条经验 获得超4个赞
我是通过以下方式做到的:
<c:set var="yourVar" value="yourValue" scope="session" />
然后使用隐藏输入
<form:hidden path="yourVar" value="${sessionScope.yourValue}>- 1 回答
- 0 关注
- 167 浏览
添加回答
举报
0/150
	提交
		取消
	