Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

pageContext implicit variable inside a tag file

 
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?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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 VI Editor Ubuntu
  • 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 VI Editor Ubuntu
  • 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 VI Editor Ubuntu
  • 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
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic