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


Please Help Members By Posting Answers For Below Questions

What is jsp taglib?

518


Is there a way I can set the inactivity lease period on a per-session basis?

490


What do you know about jsp tags?

530


How do we print “
creates a new line in html” in jsp?

677


How can I maintain session in JSP Page in the bases of user name and password:

583






What are custom tags in jsp?

563


What is a session in web?

531


What are the different directives in jsp?

498


What is the difference between servletcontext and pagecontext?

541


What are the two types of comments supported by jsp?

506


What is a scriptlet?

519


How do I run a jsp file in linux?

541


What is session getattribute in jsp?

539


List down the major differences between the jsp custom tags and java beans.

483


How is jsp better than servlet technology?

552