Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JSP Implicit variables in tag files

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

I've a doubt in the final mock exam. Please help me on that.....

Question 4: I'm not sure why option D is not correct. Why the JSP implict variable pageContext is not available in a tag file? The tag file is by itself a JSP, right?

Thanks for yout time,

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

I think thats not correct. Tag file itself is not a JSP file.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tags are Java classes. There are no implicit variables in Java classes.

JSPs, on the other hand, must first run through a translator before becoming servlets, which are Java classes. Implicit variables are simply words that the JSP translator understands - it knows how to turn them into meaningful servlet code.
 
Bharathi Kongara
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you guys are talking about the tag handler classes, which are Java classes. But the question I asked is about a tag file, a jsp file renamed with .tag or .tagx extension.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Tag File is not the same as a JSP page. It is a JSP fragment. Some of the differences between Tag Files and JSP pages are the directives they use. Tag Files do not use the Page directive, but add three more directives - variable, attribute and tag. Also, when a Tag File is used in a JSP page, its body cannot have any scripting elements, just like Simple Tags. Similarly, because of the internal (web container) implementation of Tag Files, they share more in common with Simple Tags than Classic Tags. Hence, they have access to the JspContext (like Simple Tags) instead of PageContext (like Classic Tags) implicit object.

Hope this helps.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic