• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

setMaxAge on cookie using JSTL

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know how to set the max age of a cookie using scripting



But how do I set the max age of a cookie that I have created/set through JSTL?



I would appreciate any feedback.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no way to call general methods under the JSTL/EL.

I'd set the cookie in the servlet controller for the JSP rather than on the page. Setting cookies is not a function of the view.
 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just realized that the cookie is not really being set. At least no cookie files or implicit cookies show up when I "View Cookies" through Mozilla Firefox.

You mentioned I should set the cookie in the controller servlet...well I am using JSF and therefore don't normally have access to the FacesServlet. So should I resort back to scripting in this case?
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a JSF fan here so you might want to have this moved to the JSF forum for advice from someone who uses it (just say the word and I'll make the shift).

But prior to resorting to scripting, I'd define a custom action (tag) to take care of the whole thing.
 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear Bibeault, I'll take that advice into consideration. One more thing...what is it that you don't like about JSF?
 
reply
    Bookmark Topic Watch Topic
  • New Topic