我用applet开发了一个客户端程序,使用JWS发布,动态配置jnlp,启动没有任何问题,
但是启动的客户端始终访问不了指定的servlet,无法完成与服务器的交互,
如果在eclipse里面直接run java applet启动是能够访问到指定的servlet的
请问各位这是为什么?代码如下:
URLConnection con = null;
        try {
            URL urlServlet = new URL(strUrl); //strUrl即指定的servlet
            con = urlServlet.openConnection();
            con.setDoInput(true);
            con.setDoOutput(true);
            con.setUseCaches(false);
            con.setRequestProperty(
                "Content-Type",
                "application/x-java-serialized-object");
            
        } catch (MalformedURLException e) {
            con = null;
        } catch (IOException e) {
            con = null;
        }}if (con == null) {
            return;
        }
        
        OutputStream outstream = null;
        ObjectOutputStream oos = null;
        try {
            outstream = con.getOutputStream();
            oos = new ObjectOutputStream(outstream);
            oos.writeObject(input); //input要传递到servlet的参数
            oos.flush();
            oos.close();
        } catch (IOException e) {
        } finally {
         if( oos != null ){
         try { oos.close(); } catch(Exception e){ }
         }
         if( outstream != null ){
         try { outstream.close(); } catch(Exception e){ }
         }
        }

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【ty713】截止到2008-07-29 14:21:00的历史汇总数据(不包括此帖):
    发帖的总数量:1                        发帖的总分数:0                        每贴平均分数:0                        
    回帖的总数量:0                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:0                        结贴的总分数:0                        
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:1                        未结的总分数:0                        
    结贴的百分比:0.00  %               结分的百分比:---------------------
    无满意结贴率:---------------------无满意结分率:---------------------
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
      

  2.   

    是不是需要在什么地方进行安全设置
    或者连接的方式不是使用URLConnection,而是其他的方式