• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlets, Tags, & Threads, Oh my!  RSS feed

 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I *think* this is a quick question:

I am reading a book called "Head First Servlets & JSP" (with which I'm sure the regulars on this site are familiar; it's where I heard about JavaRanch), and just read the discussion about servlets & thread safety.

This has driven me to go reexamine all my servlets. My question: would the same considerations apply to tags? The container would run single tags in multiple threads as well, wouldn't it? In fact, anything in a JSP eventually just becomes a servlet, right?

TIA
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More appropriate for the JSP forum. Thusly moved.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Allen Williams:
In fact, anything in a JSP eventually just becomes a servlet, right?


No. While the container will create a servlet from the JSP itself, elements in the JSP do not become servlets.

With regards to tags, there are no threading issues to worry about. Tag instances will be created local to the JSP in which they are executing.

With classic tags, you do need to be aware that tag instances can be reused within the same page (not the same as threading issues), but simple tags are not re-used.
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the difference in classic and simple tags? Or, you could just point me to a reference, and I'll be glad to do my on research.

Thanks.
 
Kamlesh Thakkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classic and simple tags differ in the way their lifecycle methods are called.
Simple tags as the name suggestes makes it really simple to develop the tags.... This topic is very well explained in Head First Servelets and Jsp
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Allen Williams:
What's the difference in classic and simple tags? Or, you could just point me to a reference, and I'll be glad to do my on research.


"Classic" tags are those implemented using the JSP 1.x Tag interface (usually by extending TagSupport). In JSP 2.0 "simple" tags were introduced which implement SimpleTag (usually via SimpleTagSupport).
[ September 24, 2006: Message edited by: Bear Bibeault ]
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gracias, gentlemen. I will continue in the book.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!