Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Hai.. I want to pass the values from an Applet to a servlet and from there i want to print ..i am new to servlets so please give me an idea... Advance Thanzzz Bye manik
Passing data between applets and servlet is quite easy. I've implemented a solution passing data as serialized objects using ObjectOutputStream and ObjectInputStream. In the applet... URL url = new URL("servlet/myServlet"); Integer data = new Integer(1); Serializable objs = data; URLConnection con = url.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream()); out.writeObject(objs); out.flush(); out.close();
In the servlet.... public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ObjectInputStream in = new ObjectInputStream(req.getInputStream()); Integer myData = (Integer)in.readObject(); } And of course you can send data the other way. Hope this helps.
Please note that The Java Ranch has a naming policy, described here and "manik" is not a valid name. Please choose one which meets the requirements. Thanks.