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 a hidden comment in jsp?

708


Tell us about the stages (phases) of the jsp life cycle.

704


What is the jsp:setproperty action?

732


How does jsp engines instantiate tag handler classes instances?

661


Can you use javascript in jsp?

697


How to create menu in jsp with example?

703


What are the jsp standard actions?

762


Explain the jsp:setProperty action.

749


Why jsp is faster than servlet?

692


What are scriptlets in jsp?

751


Explain jsp lifecycle methods?

744


How to connect jsp and java file?

749


What is client side technology?

671


Explain jsp technology?

720


What is difference between custom jsp tags and beans?

775