does anyone know how to readwrite a cookie through action form? I need to get the computer name the request is coming from. Hence, in the beginnning, I need to set the computer name using a persistent cookie.
I need to do something similar ... on a login page, prepopulate the username field with a cookie value. I'm assuming that it would be better do it in the ActionForm class instead of the JSP. Any ideas on how to reference the HttpServletRequest object from the ActionForm class ?
You can read cookie in ActionForm via HttpServletRequest, but I don't think you can write cookie in ActionForm as I don't see a way you can obtain a HttpServletResponse in ActionForm.
You can certainly write cookie in Action Class.
My guess is you want to set a cookie if validation failed. One solution is to set a cookie bean to the HttpServletRequest object in the ActionForm. When it forward to the JSP page after validation failed, you can then write the cookie in the JSP if a cookie bean is found.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.