how can we retrieve the values in jsp by using custom tags
Answer Posted / shiraz khan
Tag handler class is not a servlet or jsp, so it doesn't
have access to many implicit objects which are available in
jsp. It, however, has a reference to PageContext using which
we can call :
pageContext.getAttribute(name) // looks in page scope only
pageContext.getAttribute(name,scope) // looks in specified
scope
alternatively we can also also get references to other
scopes using :
pageContext.getRequest()
pageContext.getSession()
pageContext.getServletContext()
pageContext.getServletConfig()
And yes, this pageContext implicit object is given to the
tag class by container, during initialisation of this tag
class when setPageContext(PageContext) is called by container
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why jsp and servlets are used?
Explain translation phase.
How can we retrieve warnings?
What is pagecontext?
What do you know about writing custom jsp tags?
How can I use the results of my method? ea: <%! method (int x) { stuff return y; } %> <% out.println(y); %> how can I make this work? "y" is a variable made during the method.
How does jsp engines instantiate tag handler classes instances?
Explain how you understand the action tag and jsp action elements.
What is page scope?
How are the jsp requests handled?
HOW CAN WE COMPARE TWO PDF FILES USING JSP ?
What are the primary differences between the jsp custom tags and java beans?
How to deactivate el usage on jsp?
What is an expression language?
Is jsp used?