Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8794305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:14:00+00:00 2026-06-13T23:14:00+00:00

Grails 2.1.1 In my controller: def someAction() { def projectVersionInstance = ProjectVersion.get(params.id) Cookie cookie

  • 0

Grails 2.1.1

In my controller:

def someAction() {
   def projectVersionInstance = ProjectVersion.get(params.id)
   Cookie cookie = new Cookie("lastProjectVersion","${projectVersionInstance.id}")
   response.addCookie(cookie)
   .....
}

In my GSP:

<g:if test="${cookie(name: 'lastProjectVersion')}">
   ....
</g:if>

The content inside the g:if tag isn’t showing up. I even just tried the following:

<g:cookie name="lastProjectVersion" />

And I get nothing. I can display it in the controller and I can see it in the browser cookie management.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:14:01+00:00Added an answer on June 13, 2026 at 11:14 pm

    I had the problem too and it come from a redirect at the end of the method in controller.

    When I used it, I lost all the cookies I set, but not the JSESSIONID one.

    After googling, I found these help (http://www.zugiart.com/2011/04/http-redirect-and-cookies/).

    When defining your cookie, set the path to ‘/’ : cookie.path = ‘/’.

    Now, you can redirect too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Grails, one can 'bindData' in controller: Book b = new Book() bindData(b, params)
I need to test a controller, of action index (generated by the grails generate-all
The standard way of creating URLs in grails is: <a href=${createLink(controller:'news', action: 'show', params:
In grails 2.0 whats new http://grails.org/doc/2.0.0.RC1/guide/introduction.html#whatsNew it says: 1.1.3 Web Features Controller Actions as
Assume the following code in a Grails controller: def action = { ClassName o
I have this 2 following SQL Queries on my grails controller: def query1 =
problem with redirection in a grails in a controller. in Controller: def function1 =
I want to test a Grails controller which calls a service. I'd like to
I'd like to test a Grails controller that is sending out emails using the
i have created new domain in grails and from a controller i've tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.