日期:2014-05-18  浏览次数:20595 次

页面间的值传递
问题:一个新增页面,其中客户名称:【文本框】文本框旁边有个查询超链接,点击超链接进入查询页面,查询完后点击单条记录在返回新增页面中的客户名称的文本框中。

新增页面中部分代码:
Java code

 <td width="15%" align="right"><font color="RED" size="2">*</font>抵押单位名称:</td>
                    <td width="35%" class="fieldname"><html:text property="pledgeDydwmc" styleClass="inputtext" onkeydown="dealEnter();"/>
                      <a  href="/CAPledgeCusNameAction.do?action=query" target="_blank">
                      查询
                      </a>
                    </td>



查询页面:
Java code

        <td align="middle"><%=(((Integer)request.getAttribute("pageNumber")).intValue() - 1) * ((Integer)request.getSession().getAttribute("perNum")).intValue() + recordNumber.intValue()+1%></td>
        <td><bean:write name="item" property="cus_cd"/></td>
        <td><bean:write name="item" property="cus_name_cn"/></td>
        


怎么把<bean:write name="item" property="cus_name_cn"/>的值在传回新增页面的文本框中。

------解决方案--------------------
用 window.open() 打开页面。 在打开的页面关闭前,用 window.opener.form名称.元素名.value 赋值
------解决方案--------------------
就是我刚才说的那种方式就可以了,表单不用提交的。你在原页面用window.open打开。在被打开的页面里可以通过 window.opener得到打开页面的表单元素。从而对其进行赋值。明白了吗?
------解决方案--------------------
你这个东西得用ajax要不弹出页面咋执行查询还能返回当前页面.
首先用var s=window.showModalDialog("b.html"); 
打开查询页面,查询页面用AJAX执行后台返回结 果,关闭这个窗口的时候执行这个方法
window.returnValue="查询结果"; 
self.close(); 
然后文本框中用S赋值

------解决方案--------------------
我以前是这样做的,LZ试试,我还没有测试:
HTML code

<td width="15%" align="right"><font color="RED" size="2">*</font>抵押单位名称:</td>
                    <td width="35%" class="fieldname"><html:text property="pledgeDydwmc"         styleClass="inputtext" onkeydown="dealEnter();" [color=#FF0000]styleId="entName"[/color] />
                      <a  href="/CAPledgeCusNameAction.do?action=query" target="_blank">
                      查询
                      </a>
                    </td>