|
|
How To Connect To Web Server? - How to connect to web server | ||
Discussion by mahender with 4 Replies.
Last Update: May 13, 2006, 6:46 am | |||
How to connect to a web server using java program and how to maintain session
Mon Dec 12, 2005 Reply New Discussion
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).
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).
Sat Feb 18, 2006 Reply New Discussion
QUOTE
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.
Sat May 6, 2006 Reply New Discussion
If you do not want to use cookies, the session info can be encoded in the URL as a parameter. Use the function encodeURL().
Sat May 13, 2006 Reply New Discussion
Eclipse And Jbuilder: Generates Compatible Code ? (3)
|
(18) Download Java Ebooks Java Books
|
Index




