Jump to content
xisto Community
mahender1405241515

How To Connect To Web Server? How to connect to web server

Recommended Posts

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

and how to maintain session

Maintaining 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.