aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSP Implicit variables in tag files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JSP Implicit variables in tag files " Watch "JSP Implicit variables in tag files " New topic
Author

JSP Implicit variables in tag files

Bharathi Kongara
Ranch Hand

Joined: Sep 15, 2005
Posts: 56
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
Bimal Patel
Ranch Hand

Joined: Aug 29, 2003
Posts: 130
Hi Bharathi,

I think thats not correct. Tag file itself is not a JSP file.


Work Hard, Expect The Worst...<br /> <br />Bimal R. Patel<br />(SCJP 1.2, SCWCD 1.4)
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Bharathi Kongara
Ranch Hand

Joined: Sep 15, 2005
Posts: 56
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.
Jay Tse
Greenhorn

Joined: Aug 12, 2005
Posts: 11
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Implicit variables in tag files
 
Similar Threads
Tag files and JSP
eror in the jsp custom tags
Error msg : 'pageContext' cannot be resolved in tag file
Taglib that translates into a series of other taglib calls
Body-content of TLD/tag ?