Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Display cookie value in GSP (Groovy Server Pages) :

 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please Note: This Post is lengthy, but question is simple

I have added all these files for more clarity only. I have a section MyQuestion(please scroll down below) for the question

Iam trying to implement cookies for my application.
I have 3 files for the same. 1) A filter class, which intercepts every request 2) PCH class which has methods to handle cookie related things 3) PCD is a simple Java bean with getters and setters for all the fields, of which we want to create a cookie

Agenda
Create a Persistent cookie. Create only one cookie, with all fields separated by a , symbol. i.e if user enters from date and to date then the cookie will store <FD>,<td> i.e one single string.I implemented like this
1) MyFilter.java (intercepts every request).
//Has a reference to PCH. PCH is a singleton
import .....


2)PCH.java ( has methods for handling cookie related tasks)
//Above class has a reference to PCD. PCD is nothing but a Java Bean with all getters and setters for all fields creating cookie.
To handle multiple client requests,(for real time Scenarios),PCD is stored in a ThreadLocal .



3)PCD //getters and setters for all fields



My Question

1)Best approach to display in my Groovy Server Page?
My GSP looks like somehting below


When i reach this GSP, i have a cookie in format <FD>,<ED>,<Numberofbooks>
For example :singleCookie has value

2009-12-12,2010-12-12,2


Now i have to split this values and display in my GSP. I want to use GSP tags etc to get the cookie, populate "value" of the text fields and the select box from cookie value.So how to use the tags?

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Report post to moderator
Dupe of post moved from JSP forum. Closing this one.
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!