Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2007, 03:23 AM
Registered User
 
Join Date: May 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default how Set Multiple values in cookies

Hello Friends
 m using cookies in jsp
  i want to store startMonth and endMonth fields data in cookies
   so for startDate m using

"Cookie ck=new Cookie("startmonth",request.getParameter("startMon th"));
  response.addCookie(ck);"
  but i wana store endDate also in cookie so what is the way to store
  it in cookies
 m using

"Cookie ck1=new Cookie("startMonth",request.getParameter("startMon th"));
  response.addCookie(ck1);"
"Cookie ck2=new Cookie("endMonth",request.getParameter("endMonth") );
  response.addCookie(ck2);"

is this the proper way to create two cookies objects for stoaring two values in cookies

if yes then what if i wana store 10 values in cookies


 
Old May 31st, 2007, 06:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

You can also append the values in to a single string using a unique seperator like '|' character and while parsing read the cookie and tokenize them into different values.

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using VB to get and set values in exchange 5.5 elfranger VB.NET 2002/2003 Basics 0 April 20th, 2004 07:50 AM
Help: Cookies not getting set (c#) meetali ASP.NET 1.0 and 1.1 Professional 5 April 8th, 2004 01:13 PM
Help: Cookies not getting set (c#) meetali ASP.NET 1.0 and 1.1 Basics 0 April 7th, 2004 02:52 PM
Can't set cookies meckeard ASP.NET 1.0 and 1.1 Basics 7 September 8th, 2003 12:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.