You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Luc Fouin <lu...@aptiwan.com> on 2005/02/22 11:14:42 UTC
[J2] Passing attributes from a portlet to a servlet...
hello,
here is my problem, i've got a servlet called by a porlet and i want to
get 2 different values: one in parameter, which is not a pb, and one
passing as an attribute...
i've done a :
> rReq.getPortletSession().setAttribute("listImage", m);
rReq is my javax.portlet.RenderRequest and m is an java.util.Map...
then i do:
> Enumeration en = rReq.getPortletSession().getAttributeNames();
> while (en.hasMoreElements()) {
> System.out.println(en.nextElement());
> }
to check that my attibute is passed, and it is...
but after, with :
> protected void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException {
> Enumeration en = req.getSession().getAttributeNames();
> while (en.hasMoreElements()) {
> System.out.println(en.nextElement());
> }
> }
no information is returned, there's nothing in my attributes...
i thought by reading the jsr-168 specs that a portlet and a sevlet were
sharing the same session??
thx, Luc
--
Luc FOUIN - Stagiaire Aptiwan
14 rue Niepce
75014 Paris
Tél : 06 77 95 17 24
Mél : luc.fouin@aptiwan.com
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
Re: [J2] Passing attributes from a portlet to a servlet...
Posted by Luc Fouin <lu...@free.fr>.
hello
Andrew Hill a écrit :
> Firstly you need to explicitly state that its Session Application Scope:
>
> PortletSession.setAttribute("listImage", m,
> PortletSession.APPLICATION_SCOPE);
i've just tried this, and it didn't work...
>
> Secondly check that your actually getting the same session in your
> servlet. If you dont see anything in the attributes it would indicate
> that its probably a different session, as even the PORTLET_SCOPE
> attributes would show up with some namespacing applied.
i don't really understand what you mean...
>
> How are you 'calling' the servlet? Is it in the same webapp?
actually, my servlet is in the same webapp, and is generating a png
image, so it's called by an <img> markup written in my portlet...
Luc
--
Luc FOUIN - Stagiaire Aptiwan
14 rue Niepce
75014 Paris
Tél : 06 77 95 17 24
Mél : luc.fouin@aptiwan.com
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
Re: [J2] Passing attributes from a portlet to a servlet...
Posted by Andrew Hill <an...@gridnode.com>.
Firstly you need to explicitly state that its Session Application Scope:
PortletSession.setAttribute("listImage", m,
PortletSession.APPLICATION_SCOPE);
Secondly check that your actually getting the same session in your
servlet. If you dont see anything in the attributes it would indicate
that its probably a different session, as even the PORTLET_SCOPE
attributes would show up with some namespacing applied.
How are you 'calling' the servlet? Is it in the same webapp?
Luc Fouin wrote:
> hello,
>
> here is my problem, i've got a servlet called by a porlet and i want to
> get 2 different values: one in parameter, which is not a pb, and one
> passing as an attribute...
>
> i've done a :
>
>> rReq.getPortletSession().setAttribute("listImage", m);
>
>
> rReq is my javax.portlet.RenderRequest and m is an java.util.Map...
> then i do:
>
>> Enumeration en =
>> rReq.getPortletSession().getAttributeNames();
>> while (en.hasMoreElements()) {
>> System.out.println(en.nextElement());
>> }
>
>
> to check that my attibute is passed, and it is...
>
> but after, with :
>
>> protected void doGet(HttpServletRequest req, HttpServletResponse res)
>> throws ServletException, IOException {
>> Enumeration en = req.getSession().getAttributeNames();
>> while (en.hasMoreElements()) {
>> System.out.println(en.nextElement());
>> }
>> }
>
>
>
> no information is returned, there's nothing in my attributes...
> i thought by reading the jsr-168 specs that a portlet and a sevlet were
> sharing the same session??
>
>
> thx, Luc
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org