You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mason Jones <ma...@clipshow.com> on 2000/07/14 20:11:07 UTC
ServletContext vs PageContext
I'm curious if anyone can shed some light on the relationship
between the ServletContext object and the PageContext object.
My issue is that I have a servlet form handler, and I want it to
be able to send some error information to a jsp page after
processing the form. For testing, I want to construct an error
string in the servlet, place it in the context as an attribute, and
then have the jsp page display it. But the servlet can't get a
PageContext object (can it?), so I figured I would do:
ServletContext.setAttribute("error", (Object)new String("Testing"));
Could the jsp page then do:
pageContext.getAttribute("error")
and find the attribute? If ServletContext() sets the attribute,
would it be page scope only? Can the servlet actually get a
PageContext object to use instead?
Thanks for any help and ideas.
________________________________________
Mason Jones mason(at)clipshow.com
Director of Software Development
ClipShow, Inc. www.clipshow.com
(650) 696-3164 fax (650) 696-3267