Alessandro, and all,

I am trying to access the portlet from within an action method - in this case 
doUpdate(rundata, context).

    public void doUpdate(RunData rundata, Context context) {

        JetspeedRunData jrundata = (JetspeedRunData) rundata;
        Portlet portlet = (Portlet) context.get("portlet");


It is in the context.get() that I have the issue when using the action input 
parameter.  From the doUpdate() method, I don't see a way to get the Portlet object 
other than through the context object, which returns null.  I specifically need that 
portlet object so that I can use it when setting the PortletSessionState.setAttribute 
method.  Is there another way to get the portlet from within the doUpdate method which 
does not return null when the action is added as an input form parameter? 

I tried looking for many different paths, but no luck.  It could very well be my lack 
of knowledge on how to get the portal object from the doUpdate method, but something 
tells me I have run across a posting like this before which had not been resolved.

Jason Trust

-----Original Message-----
From: Alessandro La Rocca [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 11, 2004 10:57 AM
To: 'Jetspeed Users List'
Subject: R: buildNormalContext called twice?

Within my JSP portlet, I get it as follows:

  Portlet portlet = (Portlet) request.getAttribute("portlet");
  if (portlet != null)  
    isShortDetail =
portlet.getPortletConfig().getInitParameter("short_detail").equalsIgnore
Case("true");

Alessandro

-----Messaggio originale-----
Da: Jason Trust [mailto:[EMAIL PROTECTED] 
Inviato: gioved� 11 marzo 2004 16.29
A: Jetspeed Users List
Oggetto: RE: buildNormalContext called twice?


Alessandro,

Thanks for the quick reply.
What you suggested does stop the "double" calls to buildXXXContext
methods, however, it causes another issue.  Now I am unable to get the
portlet returned from the context.

Portlet portlet = (Portlet) context.get("portlet");

It returns null now, which cause problems when adding data to the
PortletSessionState, which I need when storing attributes at the portlet
instance level.

For now I am going to have to deal with the "double" calls.  It seems
that this is more like a bug?

Jason Trust


-----Original Message-----
From: Alessandro La Rocca [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 11, 2004 4:08 AM
To: 'Jetspeed Users List'
Subject: R: buildNormalContext called twice?

I don't know the reason, but I solved that problem adding the following
into my JspPorlet.

    <INPUT type="hidden" NAME="action"
VALUE="portlets.MyPortletAction"/>

Note that the same information is specified within the portlet entry of
the xreg:

    <parameter name="action" value="portlets.SelezionaContrattoAction"
hidden="true"
            cachedOnName="true" cachedOnValue="true"/>

It sounds strange, but it works.

BR, Alessandro

-----Messaggio originale-----
Da: Jason Trust [mailto:[EMAIL PROTECTED] 
Inviato: mercoled� 10 marzo 2004 20.50
A: Jetspeed Users List
Oggetto: RE: buildNormalContext called twice?


Found this posting about changing from a JspPortlet to
GenericMVCPortlet, but I am already using a GenericMVCPortlet and on a
form submission, the buildNormalContext is being called only once on the
portlet that has the doUpdate called, but it is being called twice for
another portlet.

 

http://www.mail-archive.com/[EMAIL PROTECTED]/msg11357.ht
ml

 

If it helps, here is the output in my log:

 

2004-03-10 14:32:17,062 [Thread-9] 

DEBUG GenericMVCAction - Action: try executing events

INFO  PartsSearchAction - *** doUpdate ***

INFO  PartsSearchAction - *** doUpdate - getMode = 0

INFO  PartsSearchAction - *** doUpdate test-values = null ***

DEBUG GenericMVCAction - GenericMVCAction: retrieved context:
[EMAIL PROTECTED]

DEBUG GenericMVCAction - GenericMVCAction: retrieved portlet:
[EMAIL PROTECTED]

DEBUG GenericMVCAction - GenericMVCAction: building normal

INFO  PartsSearchAction - *** buildNormalContext ***

INFO  PartsSearchAction - *** buildNormalContext portlet.getID() =
P-fb363f03ee-10000 ***

INFO  PartsSearchAction - *** buildNormalContext test-values = ALMOST
THERE!!! ***

 

 

A little further down:

 

2004-03-10 14:32:17,078 [Thread-9] 

DEBUG GenericMVCAction - GenericMVCAction: building normal

INFO  PartsSearchAction - *** buildNormalContext ***

INFO  PartsSearchAction - *** buildNormalContext portlet.getID() =
P-fb363f9e69-10001 ***

INFO  PartsSearchAction - *** buildNormalContext test-values = ALMOST
THERE!!! ***

DEBUG GenericMVCAction - GenericMVCAction: retrieved context:
[EMAIL PROTECTED]

DEBUG GenericMVCAction - GenericMVCAction: retrieved portlet:
[EMAIL PROTECTED]

DEBUG GenericMVCAction - GenericMVCAction: building normal

INFO  PartsSearchAction - *** buildNormalContext ***

INFO  PartsSearchAction - *** buildNormalContext portlet.getID() =
P-fb363f9e69-10001 ***

INFO  PartsSearchAction - *** buildNormalContext test-values = ALMOST
THERE!!! ***

 

 

So I have 2 portlets, which happen to be the same portlet, just two
instances on my pane - notice the id's are different.

 

Any thoughts as to why it is being called twice?

Luckily I am not doing anything yet expensive in the buildNormalContext
method, but I would be worried about this behavior if I were going to.

 

Jason Trust

 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to