mahender1405241515 0 Report post Posted December 12, 2005 How to connect to a web server using java program and how to maintain session Share this post Link to post Share on other sites
Jack Cheng 0 Report post Posted February 18, 2006 Can you elaborate how what you mean by connecting to web server... like what a browser does, or setting up a web server that supports JSP and servlets. For the "browser" thing, you'll need to use sockets, of which you can find more about from the Java API. For the server, you'll need a servlet compliant server, such as Tomcat. For more information on Tomcat, go to its website (tomcat.apache.com). As for the session, it depends on where you need it. In a JSP, you can just use the implicit object session and call its getAttribute, setAttribute, and removeAttribute methods to modifiy session objects (notice I said objects, so primitive data types don't work). In a servlet, you'll need to first get the session by calling request.getSession() (and this is assuming your servlet is a subclass of HttpServlet, so the request is an HttpServletRequest). Share this post Link to post Share on other sites
yordan 10 Report post Posted May 6, 2006 and how to maintain sessionMaintaining a session will probably be the most critical thing. Maybe you will have to design a cookie in charge to hold the data your session needs. Share this post Link to post Share on other sites
yeh 0 Report post Posted May 13, 2006 If you do not want to use cookies, the session info can be encoded in the URL as a parameter. Use the function encodeURL(). Share this post Link to post Share on other sites