String id = customer.getId();
String relativePath = "/WEB-INF/classes/customerData/" + id
+ ".ser";
System.out.println("2");
String realPath = getServletContext().getRealPath(relativePath);
// 将对象序列化到文件中
FileOutputStream fos = new FileOutputStream(realPath);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(customer);
我用这段代码进行序列化的时候,E:\大二(下)\workplace1\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\6_1_3\WEB-INF\classes\customerData\4628514254221416162.ser (系统找不到指定的路径。)
会出现这样的错误,
求教!!!
Java
序列化
web
javabean
------解决方案--------------------
请确认 /WEB-INF/classes/customerData/ 目录存在且一般用户可写