Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Cookies, please help!

Status
Not open for further replies.

Zoomby2000

Technical User
Feb 22, 2001
1
DE
Hi!

I want to set a Cookie with "response.addCookie(Cookie)", and then "Cookie.setMaxAge(...)". That works fine on my local Tomcat, but on the Server it doesn't work! What could it be??

Thanks, Chris
 
if you've made it work well i'd like to ask you something : i've seen that the code to get a cookie value is :


public String getCookie(HttpServletRequest request) {

String value="";
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (int i=0; i < cookies.length; i++) {
if (cookies.getName().equals(&quot;MyCookie&quot;)) {
value = cookies.getValue();
break;
}
}
}
return value;
}

what i want to know is what is this HttpServletRequest request ? what kind of parameter is it ? i've found nothing about it Best regards X-),
Elise
 
HttpServletRequest has methods by which you can find out about incoming information such as form data, HTTP request headers and the clients hostname. HttpServletResponse lets you specify outgoing information such as HTTP status codes and lets you obtain a PrintWriter used to send the document content back to the client.

The doGet and doPost methods require HttpServletRequest and HttpServletResponse for obtaining information about the request and for sending the response, respectively. HttpServletResponse/Request are imported from javax.servlet.http.

Seeya,

Tim --
Tim <tim@planetedge.co.uk>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top