okay. изменил строку. Теперь на стороне сервлета:
| Код | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(CONTENT_TYPE); OutputStream out; ObjectOutputStream objStream; out=response.getOutputStream(); objStream=new ObjectOutputStream(out); int test=1; objStream.writeInt(test); }
|
на стороне аплета:
| Код | private int gettest()throws IOException{ URL url=new URL(getCodeBase(),"http://localhost:8080/WebModule1/mysevlet"); URLConnection con=url.openConnection(); con.setRequestProperty("Content-Type", "application/x-java-serialized-object"); con.setUseCaches(false); InputStream in=con.getInputStream(); ObjectInputStream objStream; objStream=new ObjectInputStream(in); int this_test_is=objStream.readInt(); return this_test_is; }
|
на строке
| Код | int this_test_is=objStream.readInt();
|
вылетает с ошибкой null . |