• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pageContext implicit variable inside a tag file

 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that all implicit variables should be available inside a tag file, because that too is a jsp.
However in the final exam in HFSJ, Q4, option D is:

<%@ attribute name="data %>
<%pageContext.getOut().print(data+data);%>

They say that this is not invalid because: "The JSP variable pageContext is not available here. However replacing pageContext with getJspContext() would work here instead."

Can someone please explain? Why cant the pageContext implicit variable be available in the tag file?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe you should refer to "JSP.8.8 Implicit Objects" in the specification
 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot find any related information in the spec. There is no explicit list of implicit objects that can be used in a tag file. They list only the directives available in tag files.

I read an article on java.net that says that jspContext is the implicit variable available in tag files in place of pageContext.

I would appreciate it if someone can explain or point to a specific line in the spec.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Links to the specs are here :
http://faq.javaranch.com/view?ScwcdLinks

Download the JSP spec and refer to JSP.8.8, where the list of implicit objects used in Tag Files is described.
 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no section JSP8.8.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
page 1-186 (pdf page 222/478)
 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Duh. I just realized that the I ve been reading a draft and not the final version all this time.

Thanks for you help (and patience). Apologies.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The links seems bad. Please download it here :
http://jcp.org/aboutJava/communityprocess/final/jsr152/index.html

I'll fix the link
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic