Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Servlet + cookies ( Tomcat )

  • 20-03-2003 6:48pm
    #1
    Closed Accounts Posts: 1,719 ✭✭✭


    hi i have a slight problem. i am writing a servlet to login a user to a site. once the user is authenticated i send them a cookie. this cookies just stores some info.

    now here's the problem,once the cookie is sent to the client,how do i delete the cookie from them?

    currently i have a simple while loop that puts all the cookies into an array and blanks all the names and values.
    BUT this is the problem. the loop just adds cookies with a null name and value to the client.

    so my question is: how do i delete or blank the name and value of a cookie i sent to a client

    ohh and the cookie's expire when the session ends.


Comments

  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭Zab


    Why are you doing it like this? What I mean is, Tomcat will handle the session cookie for you, which will just contain a session ID. Then you can just use the session object in your servlet code to store various bits of information.... and they will all be defreferenced when the Tomcat kills the session. This way you can store all the information on the server, rather than the client ( except for the session ID ).

    Zab.

    PS: Tomcat also has authentication in it, which may be worth having a look at.


  • Closed Accounts Posts: 1,719 ✭✭✭Ruaidhri


    it's for a project.
    i want to authenticate users against a database of users. this is why i'm doing it this way.

    i'm only using tomcat to serve out the servlets and jsp's,nothing else.


Advertisement