You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Herman Matthieu <mh...@atosorigin.com> on 2002/06/04 10:31:16 UTC

set Attribute in PageContext

I want to set Attribute in the page scope.

in my Action I have this code to get the PageContext :

	JspFactory factory = JspFactory.getDefaultFactory();
	PageContext pageC = factory.getPageContext(getServlet(), request,
response,"", true, 8192, false);

but when I compare the adresse of this PageC and the PageContext in my JSP
page it's not the same. So when I set an attribute, I can't get it in my JSP
Page.

How can I do?

Matthieu Herman

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: set Attribute in PageContext

Posted by Nicolas De Loof <ni...@cgey.com>.
Page scope does only exist during the execution of your JSP page (compiled
as a Servlet). As your action is called by ActionServlet,
JspFactory.getDefaultFactory(); returns a pageContext for the ActionServlet
(that has not been generated from a JSP file, so it's strange to call this
method from a Servlet).
The two pagecontext are not same objects. To pass datas to your JSP that
need not to stay in memory, use Request scope.

Nico

>
> I want to set Attribute in the page scope.
>
> in my Action I have this code to get the PageContext :
>
> JspFactory factory = JspFactory.getDefaultFactory();
> PageContext pageC = factory.getPageContext(getServlet(), request,
> response,"", true, 8192, false);
>
> but when I compare the adresse of this PageC and the PageContext in my JSP
> page it's not the same. So when I set an attribute, I can't get it in my
JSP
> Page.
>
> How can I do?
>
> Matthieu Herman
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>