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 the include directive?

528


What are the different scope values for the jsp objects?

498


Explain handling of runtime exceptions.

641


How can I prevent direct access to a jsp page from a browser?

479


What is jsp and why it is used?

451






What is the use of 'out' implicit object?

490


How can I extend the functionality of jsp?

507


How did you implement caching in jsp?

598


How to include a jsp file in another jsp file?

486


Why don’t we need to configure jsp standard tags in web.xml?

503


How we can configure init params in jsp?

530


Explain the jsp:setProperty action.

549


How we can disable session in jsp?

506


Can any one explain about the project Approximate shortest distance computing:A query dependent local landmark scheme

1333


How to send data from one page to another in jsp?

486