java做的接口页面,在调用的时候,服务器端发生的onclick事件不能将值传到服务器外的文本框中,这个如何实现呢?

解决方案 »

  1.   

    服务器外页面代码为:Untitle.htm<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <script language=JavaScript   type=text/JavaScript>
    function clickss(){
    window.open("http://124.161.95.82:8001/CNC/SearchPartInterface.unicom?partname=运行维护部","tt","width=400,height=300");
    //window.open("a.htm","tt","width=400,height=300");
    }</script>
    <body><form id=f_form name=f_form  method=post ><label>
    <input type=text  name=chinaunicom_id />
    </label>
    <a href="#" onclick="clickss()"> 
    555</a></form>
    </body>
    </html>服务器端地址:http://124.161.95.82:8001/CNC/SearchPartInterface.unicom?partname=运行维护部
    onclick事件的代码为:。。
    function clicksk(user_id){
    alert("我要成功阿!我靠!");
    opener.document.f_form.chinaunicom_id.value = user_id;

    window.close();
    }
    。。<div class="div3">
    <table width="195px" border="0" cellpadding="0" cellspacing="0">
    <c:forEach var="trees" items = '${requestScope.lists}'>   <tr>
        <td width="65px"><a href="#" onclick="clicksk('${trees.u_id}')">${trees.u_id}</a></td>
    <td width="65px">${trees.u_name}</td>
        <td width="65px">${trees.dep_name}</td>
        
       </tr>
      
      
      </c:forEach>
    </table>


    </div>

    我考虑了click事件不能触发后不能向服务器外传送数据的原因是web安全的原因,并且测试了。net平台和java平台都不可以触发事件
      

  2.   

    不好意思,有点急写错了,就是一个调用页面,onclick事件如何跨服务器传值的问题!
      

  3.   

    如果是使用java去开发的,我建议你的onclick事件不是直接用网址跳转到另一个服务器而是在你的servlet里设置好参数后
    用Socket 连接传参数。