如果只是“applet根本找不到servlet”这个错误,没有其他错误的话,你还是先配置jbuilder吧,可能是路径的问题
解决方案 »
- 急救!页面跳转返回没有数据的问题。
- 帮帮忙,myeclipse 引入Jquery.js文件 问题?
- jsp中text的值如何在程序中设定
- tomcat启动问题
- JSP上传文件 多个INPUT 的情况, 怎么搞?
- 客户提出,输入EMAIL帐号和密码后,能将其所在的邮箱信息导出来。请问能实现吗?如果实现啊?
- 如何才能提高BS程序的开发效率(维护功能)
- 捆饶了我2天的Hibernate问题
- 请问,记录有上万条,数据库在mssql2000,分页显示记录???????????
- session.getValue()和session.getAttribute()有什么区别?
- jsp连接oracle奇怪问题,在线等待!
- 一个问题了,不知道难不难,在线!
URL url = new URL("http://localhost:8080/testservlet");总是拒绝访问,为何?
//
// Applet client-side code to send a student object
// to a servlet in a serialized fashion.
//
// A POST method is sent to the servlet.
//URL studentDBservlet = new URL( webServerStr );
URLConnection servletConnection = studentDBservlet.openConnection(); // inform the connection that we will send output and accept input
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
// Don't use a cached version of URL connection.
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches (false);// Specify the content type that we will send binary data
servletConnection.setRequestProperty ("Content-Type", "application/octet-stream");
// send the student object to the servlet using serialization
outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
// serialize the object
outputToServlet.writeObject(theStudent);
outputToServlet.flush();
outputToServlet.close();//-------------------------------------// Listing 5
//
// Applet client-side code to read a serialized
// vector of student objects from a servlet.
//
//// connect to the servlet
URL studentDBservlet = new URL( servletLocation );
URLConnection servletConnection = studentDBservlet.openConnection();
// Don't used a cached version of URL connection.
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches(false);// Read the input from the servlet.
//
// The servlet will return a serialized vector containing
// student entries.
//
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
studentVector = (Vector) inputFromServlet.readObject();
//接收APPLET传过来的数据
ObjectInputStream input = new ObjectInputStream(request.getInputStream());
Vector in_vector = (Vector) input.readObject();
input.close();
//返回数据到APPLET中
ObjectOutputStream output = new ObjectOutputStream(response.getOutputStream());
output.writeObject(out_vector);
output.flush();
output.close();
APPLET中:
//传数据到SERVLET中
outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
outputToServlet.writeObject(out_vector);
outputToServlet.flush();
outputToServlet.close();//接受SERVLET数据
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
inVector = (Vector) inputFromServlet.readObject();