This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

ThreadLocal and Freemarker

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All :

I love Jforum , deeply from my heart.
because look at the code, you can find the
cleverness is everywhere. I love the way it
does property mapping , property file change
monitoring, i can go on and on and on....

As I explained why I wants to explore jforum,
there are a few questions.

1>Why ThreadLocal is used? I mean ServletRequest and ServletResponse
are per instance for each thread isn't? and the Servlet Container handles
all the threading issues, why do we need threadlocal

2>Why do we use Freemarker instead of JSP? I know ,it got be something Freemarker
is better then jsp isn't? but what is it?

Rafael you might be the best people to answer this question, any ideas ? thanks

confused confucius
[originally posted on jforum.net by confucius]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeh! I also wander why Freemaker instead of apache velocity
[originally posted on jforum.net by AngryChineseMan]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

AngryChineseMan wrote:yeh! I also wander why Freemaker instead of apache velocity


You can read a comparison of Freemarker & Velocity on the Freemarker web site: http://freemarker.sourceforge.net/fmVsVel.html
[originally posted on jforum.net by GatorBait3]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ThreadLocal is handy when you need "global" access from everywhere. Without that, you'll have to pass the variables to all methods, which is a pain in the ass.

Back to the times when JForum started, we had many issues with Velocity, specially with their very very poor macro support.

JForum3 is going to use JSP.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks rafael!

sum up what you have said:

because you want have a static access method, without passing object reference
around, so you used threadLocal.

but HttpServletRequest.setAttribute(java.lang.String name, java.lang.Object o) seems
a good way for saving objects, all you need is just passing httpServletRequest around
isn't?


[originally posted on jforum.net by confucius]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, but imagine that I can use ThreadLocals *everywhere* without passing the httpservelt to every method I need.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic