RE: Portlets execution flow

2004-09-06 Thread Oscar Ruiz
Hi all,
guess you are talking about velocity templates here.

But, how can i do the same with a JSP template?, I cannot get the event
executed before any buildNormalContext of any portlet.

The following does not work:

form method=post action=jetspeed:dynamicUri/
 input type=hidden name=js_peid value=%=jspeid%
 input type=hidden name=action value=portlets.myJspPortletAction/
 input type=submit name=eventSubmit_doUpdate value=Save/

Thanks.


From: Bob Fleischman [EMAIL PROTECTED]
Subject: Portlets execution flow
Date: Mon, 16 Aug 2004 00:17:56 -0400
Content-Type: text/plain;
charset=utf-8

Ahh!! You've discovered one of the 'gotchas' of direct action calls.

When you call an action directly with $jslink.getAction(myaction,
$portlet) the context does not yet contain the portlet and so you can not
use it for getUser or any other Portlet specific call to save state. You
can, however, still impact services, or database connectivity. This approach
will fire the action BEFORE anything else, which seems to be its major
appeal.

I have found it much easier to use a form action of
$jslink.getPortletById($portlet.getID()) with a button name of
eventSubmit_doUpdate and then I send other parameters via hidden fields on
the form.

That way I am certain the correct instance of the correct portlet is being
referenced.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 4:18 AM
To: Jetspeed Users List
Subject: RE: Portlets execution flow


Correction* 

The action event does call the public void doBrowse_refresh(RunData, 
Context) method. 
There was a Null pointer Exeption thrown in there when it tried to fetch 
and use the portlet object in the Context .
 Apparently this exception caused the rundata only method to be called.


Med vennlig hilsen/Kind regards,

Bjorn Vidar Remme
Application Engineer






Bjorn Vidar Remme
09.08.2004 20:52

To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow

Hi Bob, 

What you are saying makes sense. The trouble was that I was using 
qualified action names, but I still had major problems. I then reluctantly 
came to the conclusion that there was something fundamentally wrong with 
my code. 

Looking over the code again I remember changing the form method from POST 
to GET because my action event would not fire if I used POST. A major 
mistake! Changing the method caused the action parameter in the URL to be 
ignored. And the code executed as if I where using $jslink alone. 

It took me a while to figure out what was going on. Overriding the 
executeEvents() methods and logging any Exceptions thrown gave me the 
answer. When I supply an action in the URL it looks for an event method 
with the signature 'public void doBrowse_X(RunData rundata)' and not 
'public void doBrowse_refresh(RunData, Context)'.

No wonder my event was not triggered because I used the Context variation.

I then changed my code and it worked just as you said. Brilliant!

The only consequence of removing the Context as a parameter is that we 
must find an alternative way to get the portlet id. Probably submitting it 
as a parameter.


Thanks, you really saved the day!!!


Kind regards,
Bjorn Vidar Remme







Bob Fleischman [EMAIL PROTECTED]
06.08.2004 18:18
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow


Bjorn:

You can limit the impact of which class runs your method via the action by
qualifying the action.

That is: use action=Myportlet2.doUpdate rather than action=doUpdate.  With
the second method any portlet which has a doUpdate method will fire.

As to having several Portlets share a current model. We have found that it
is best to have a separate action class that modifies the model. Then 
using
the setAction style described in this thread you can update the common 
model
first. That action will be called before any rendering.

Your portlet should then be limited to building up your context. Otherwise
you are duplicating your efforts by putting model update code in 2 places.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 06, 2004 10:41 AM
To: Jetspeed Users List
Subject: Re: Portlets execution flow

Hi all, 

Well the trouble by using setAction() is that the action is executed for 
all the portlets (if a suitable method exists). You can easily test this 
by adding multiple instances of the same portlet to a page (same action 
class) or multiple portlets with different action classes but the same 
event name. You will then see that the action event is executed once for 
all the portlets.

The pattern is thus (AE=action event, BNC=buildNormalContext):
AE for portlet A, BNC for portlet A, AE for portlet B, BNC for portlet B 
etc..

Not what we want at all, we just want the action event to fire once

RE: Portlets execution flow

2004-08-15 Thread Bob Fleischman
Ahh!! You've discovered one of the 'gotchas' of direct action calls.

When you call an action directly with $jslink.getAction(myaction, $portlet) the 
context does not yet contain the portlet and so you can not use it for getUser or any 
other Portlet specific call to save state. You can, however, still impact services, or 
database connectivity. This approach will fire the action BEFORE anything else, which 
seems to be its major appeal.

I have found it much easier to use a form action of 
$jslink.getPortletById($portlet.getID()) with a button name of eventSubmit_doUpdate 
and then I send other parameters via hidden fields on the form.

That way I am certain the correct instance of the correct portlet is being referenced.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 4:18 AM
To: Jetspeed Users List
Subject: RE: Portlets execution flow


Correction* 

The action event does call the public void doBrowse_refresh(RunData, 
Context) method. 
There was a Null pointer Exeption thrown in there when it tried to fetch 
and use the portlet object in the Context .
 Apparently this exception caused the rundata only method to be called.


Med vennlig hilsen/Kind regards,

Bjorn Vidar Remme
Application Engineer






Bjorn Vidar Remme
09.08.2004 20:52

To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow

Hi Bob, 

What you are saying makes sense. The trouble was that I was using 
qualified action names, but I still had major problems. I then reluctantly 
came to the conclusion that there was something fundamentally wrong with 
my code. 

Looking over the code again I remember changing the form method from POST 
to GET because my action event would not fire if I used POST. A major 
mistake! Changing the method caused the action parameter in the URL to be 
ignored. And the code executed as if I where using $jslink alone. 

It took me a while to figure out what was going on. Overriding the 
executeEvents() methods and logging any Exceptions thrown gave me the 
answer. When I supply an action in the URL it looks for an event method 
with the signature public void doBrowse_X(RunData rundata) and not 
public void doBrowse_refresh(RunData, Context).

No wonder my event was not triggered because I used the Context variation.

I then changed my code and it worked just as you said. Brilliant!

The only consequence of removing the Context as a parameter is that we 
must find an alternative way to get the portlet id. Probably submitting it 
as a parameter


Thanks, you really saved the day!!!


Kind regards,
Bjorn Vidar Remme







Bob Fleischman [EMAIL PROTECTED]
06.08.2004 18:18
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow


Bjorn:

You can limit the impact of which class runs your method via the action by
qualifying the action.

That is: use action=Myportlet2.doUpdate rather than action=doUpdate.  With
the second method any portlet which has a doUpdate method will fire.

As to having several Portlets share a current model. We have found that it
is best to have a separate action class that modifies the model. Then 
using
the setAction style described in this thread you can update the common 
model
first. That action will be called before any rendering.

Your portlet should then be limited to building up your context. Otherwise
you are duplicating your efforts by putting model update code in 2 places.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 06, 2004 10:41 AM
To: Jetspeed Users List
Subject: Re: Portlets execution flow

Hi all, 

Well the trouble by using setAction() is that the action is executed for 
all the portlets (if a suitable method exists). You can easily test this 
by adding multiple instances of the same portlet to a page (same action 
class) or multiple portlets with different action classes but the same 
event name. You will then see that the action event is executed once for 
all the portlets.

The pattern is thus (AE=action event, BNC=buildNormalContext):
AE for portlet A, BNC for portlet A, AE for portlet B, BNC for portlet B 
etc..

Not what we want at all, we just want the action event to fire once.
This is why I specify the portlet ID in the action like this: 
$jslink.getAction(myaction, $portlet)

The action event is then executed only once, but as I described in my 
previous post the pattern is (clicking on portlet B): BNC-A, AE -B, BNC-B 
and not the desired AE-B, BNC-A, BNC-B.


Note: I am using getAction() because setAction() is deprecated according 
to the documentation. It does the same thing.
 

Kind regards,
Bjorn Vidar Remme






[EMAIL PROTECTED]
06.08.2004 15:54
Please respond to Jetspeed Users List
 
To: Jetspeed Users List [EMAIL PROTECTED]
cc

RE: Portlets execution flow

2004-08-10 Thread Bjorn Vidar Remme
Correction* 

The action event does call the public void doBrowse_refresh(RunData, 
Context) method. 
There was a Null pointer Exeption thrown in there when it tried to fetch 
and use the portlet object in the Context .
 Apparently this exception caused the rundata only method to be called.


Med vennlig hilsen/Kind regards,

Bjorn Vidar Remme
Application Engineer






Bjorn Vidar Remme
09.08.2004 20:52

To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow

Hi Bob, 

What you are saying makes sense. The trouble was that I was using 
qualified action names, but I still had major problems. I then reluctantly 
came to the conclusion that there was something fundamentally wrong with 
my code. 

Looking over the code again I remember changing the form method from POST 
to GET because my action event would not fire if I used POST. A major 
mistake! Changing the method caused the action parameter in the URL to be 
ignored. And the code executed as if I where using $jslink alone. 

It took me a while to figure out what was going on. Overriding the 
executeEvents() methods and logging any Exceptions thrown gave me the 
answer. When I supply an action in the URL it looks for an event method 
with the signature public void doBrowse_X(RunData rundata) and not 
public void doBrowse_refresh(RunData, Context).

No wonder my event was not triggered because I used the Context variation.

I then changed my code and it worked just as you said. Brilliant!

The only consequence of removing the Context as a parameter is that we 
must find an alternative way to get the portlet id. Probably submitting it 
as a parameter


Thanks, you really saved the day!!!


Kind regards,
Bjorn Vidar Remme







Bob Fleischman [EMAIL PROTECTED]
06.08.2004 18:18
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow


Bjorn:

You can limit the impact of which class runs your method via the action by
qualifying the action.

That is: use action=Myportlet2.doUpdate rather than action=doUpdate.  With
the second method any portlet which has a doUpdate method will fire.

As to having several Portlets share a current model. We have found that it
is best to have a separate action class that modifies the model. Then 
using
the setAction style described in this thread you can update the common 
model
first. That action will be called before any rendering.

Your portlet should then be limited to building up your context. Otherwise
you are duplicating your efforts by putting model update code in 2 places.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 06, 2004 10:41 AM
To: Jetspeed Users List
Subject: Re: Portlets execution flow

Hi all, 

Well the trouble by using setAction() is that the action is executed for 
all the portlets (if a suitable method exists). You can easily test this 
by adding multiple instances of the same portlet to a page (same action 
class) or multiple portlets with different action classes but the same 
event name. You will then see that the action event is executed once for 
all the portlets.

The pattern is thus (AE=action event, BNC=buildNormalContext):
AE for portlet A, BNC for portlet A, AE for portlet B, BNC for portlet B 
etc..

Not what we want at all, we just want the action event to fire once.
This is why I specify the portlet ID in the action like this: 
$jslink.getAction(myaction, $portlet)

The action event is then executed only once, but as I described in my 
previous post the pattern is (clicking on portlet B): BNC-A, AE -B, BNC-B 
and not the desired AE-B, BNC-A, BNC-B.


Note: I am using getAction() because setAction() is deprecated according 
to the documentation. It does the same thing.
 

Kind regards,
Bjorn Vidar Remme






[EMAIL PROTECTED]
06.08.2004 15:54
Please respond to Jetspeed Users List
 
To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:Re: Portlets execution flow


Bjorn, Oscar -

I have never seen the problems you are mentioning below - my action 
handler methods ALWAYS execute before the build*() methods on the active 
portlets.  We are currently using Velocity-based portlets.  When we 
specify the action parameter in a form, we use the following code 
template:

form method=post action=$jslink 
or
form method=post action=$jslink.setAction(portlets.FooAction)

The first version uses the default action as specified in the xreg for 
the portlet - this is what we use in most cases.  The second version uses 
any action you specify - as long as the action package you are using is 
declared to Turbine using the module.packages key (see 
TurbineResources.properties, and look for that key.)

For an example of the first version, look at the source in 
/tutorial/tutorials/9/templates/vm/portlets/html/coffees-browser.vm 
(directly

RE: Portlets execution flow

2004-08-09 Thread Bjorn Vidar Remme
Hi Bob, 

What you are saying makes sense. The trouble was that I was using 
qualified action names, but I still had major problems. I then reluctantly 
came to the conclusion that there was something fundamentally wrong with 
my code. 

Looking over the code again I remember changing the form method from POST 
to GET because my action event would not fire if I used POST. A major 
mistake! Changing the method caused the action parameter in the URL to be 
ignored. And the code executed as if I where using $jslink alone. 

It took me a while to figure out what was going on. Overriding the 
executeEvents() methods and logging any Exceptions thrown gave me the 
answer. When I supply an action in the URL it looks for an event method 
with the signature ?public void doBrowse_X(RunData rundata)? and not 
?public void doBrowse_refresh(RunData, Context)?.

No wonder my event was not triggered because I used the Context variation.

I then changed my code and it worked just as you said. Brilliant!

The only consequence of removing the Context as a parameter is that we 
must find an alternative way to get the portlet id. Probably submitting it 
as a parameter?


Thanks, you really saved the day!!!


Kind regards,
Bjorn Vidar Remme







Bob Fleischman [EMAIL PROTECTED]
06.08.2004 18:18
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:RE: Portlets execution flow


Bjorn:

You can limit the impact of which class runs your method via the action by
qualifying the action.

That is: use action=Myportlet2.doUpdate rather than action=doUpdate.  With
the second method any portlet which has a doUpdate method will fire.

As to having several Portlets share a current model. We have found that it
is best to have a separate action class that modifies the model. Then 
using
the setAction style described in this thread you can update the common 
model
first. That action will be called before any rendering.

Your portlet should then be limited to building up your context. Otherwise
you are duplicating your efforts by putting model update code in 2 places.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 06, 2004 10:41 AM
To: Jetspeed Users List
Subject: Re: Portlets execution flow

Hi all, 

Well the trouble by using setAction() is that the action is executed for 
all the portlets (if a suitable method exists). You can easily test this 
by adding multiple instances of the same portlet to a page (same action 
class) or multiple portlets with different action classes but the same 
event name. You will then see that the action event is executed once for 
all the portlets.

The pattern is thus (AE=action event, BNC=buildNormalContext):
AE for portlet A, BNC for portlet A, AE for portlet B, BNC for portlet B 
etc..

Not what we want at all, we just want the action event to fire once.
This is why I specify the portlet ID in the action like this: 
$jslink.getAction(myaction, $portlet)

The action event is then executed only once, but as I described in my 
previous post the pattern is (clicking on portlet B): BNC-A, AE -B, BNC-B 
and not the desired AE-B, BNC-A, BNC-B.


Note: I am using getAction() because setAction() is deprecated according 
to the documentation. It does the same thing.
 

Kind regards,
Bjorn Vidar Remme






[EMAIL PROTECTED]
06.08.2004 15:54
Please respond to Jetspeed Users List
 
To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:Re: Portlets execution flow


Bjorn, Oscar -

I have never seen the problems you are mentioning below - my action 
handler methods ALWAYS execute before the build*() methods on the active 
portlets.  We are currently using Velocity-based portlets.  When we 
specify the action parameter in a form, we use the following code 
template:

form method=post action=$jslink 
or
form method=post action=$jslink.setAction(portlets.FooAction)

The first version uses the default action as specified in the xreg for 
the portlet - this is what we use in most cases.  The second version uses 
any action you specify - as long as the action package you are using is 
declared to Turbine using the module.packages key (see 
TurbineResources.properties, and look for that key.)

For an example of the first version, look at the source in 
/tutorial/tutorials/9/templates/vm/portlets/html/coffees-browser.vm 
(directly from cvs) as well as the related xreg files.  An example of the 
second version is at: 
http://portals.apache.org/jetspeed-1/tutorial/7/events.html.

Good luck,
Eric




Bjorn Vidar Remme [EMAIL PROTECTED] 
08/06/2004 04:10 AM
Please respond to
Jetspeed Users List [EMAIL PROTECTED]


To
Jetspeed Users List [EMAIL PROTECTED]
cc

Subject
Re: Portlets execution flow






Hi Oscar, 

Note: This answer does not solve your problem, it only confirms it. Read 
on if you are interested.

We are using Jetspeed 1.6-dev and we struggle

Re: Portlets execution flow

2004-08-06 Thread Bjorn Vidar Remme
Hi Oscar, 

Note: This answer does not solve your problem, it only confirms it. Read 
on if you are interested.

We are using Jetspeed 1.6-dev and we struggle with the same problem 
(Velocity portlets in our case). The idea was to have multiple portlets on 
the page share information stored in rundata. The BuildNormalContext() 
method builds the context based entirely on data stored in rundata. We use 
a system to store data in the rundata based on portlet id / portlet group 
(parameter) and global for all. 
We then write action handlers that performs all the logic and updates the 
rundata.

Of course this relies on the fact that the action event is executed BEFORE 
the buildNormaContext() methods are executed.

Specifying the action for a specific portlet like this:
form action=$jslink.getPortletById($portlet.ID) name=RundataTest 
method=GET
or this:
form 
action=$jslink.getAction(portlets.test.general.Rundata_TestAction, 
$portlet) name=RundataTest method=GET

executes the action specifically for that particular portlet. Exactly what 
we wanted.

But, then we noticed that the some of the portlets displayed old data!
The pattern for the problem was top-bottom-left-right as you describe. 

Lets say we have two portlets A  B (AE=Action Event, 
BNC=BuildNormalContext). 
1. Clicking on portlet A executes: AE for A - BNC for A - BNC for B 
(Perfect!). 
2. Clicking on portlet B executes: BNC for A - AE for B - BNC for B 
(Disaster!)

In case 2 portlet A is diplayed using old values from the rundata object. 
Oh dear...

The only answer I have received on this problem is that in JSR168 
(Jetspeed-2 implements this) the action event should always be executed 
before the portlets are rendered in an undefined order. 
Very cute, but migrating to Jetspeed-2 is not an option for the moment.

It would be nice to get an opinion from an experienced Jetspeed developer 
on how much work it would be to modifiy Jetspeed-1 to behave in this way 
to.
Right now we have to be really careful when planning the actions/flow in 
the portal and this is quite a limitation for the moment.



Kind regards,
Bjorn Vidar Remme






Oscar Ruiz [EMAIL PROTECTED]
05.08.2004 13:33
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:Portlets execution flow


Hi all,

can anyone clarify me how multiple MVC portlets (JSP for instance) are
executed and output displayed?

There is obviously an order in which portlet controllers are called,
apparently from top to bottom and left to right.

*apparently* the View component (JSP) is executed right after the
Controller, hence if portlets are sharing a Model the whole thing results 
in
a disaster.

Is there a way of rendering the page (i.e. execute the View components)
after all controllers have completed?

Many thanks.

Oscar.



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




Re: Portlets execution flow

2004-08-06 Thread Jeremy Ford
What if you use the following form?
form action=$jslink.setAction(myaction) name=RundataTest
 input type=submit name=eventSubmit_doSomething/
/form
This should fire the action before anything else.  As long as your portlets 
do not store data in the portletsessionstate, then this should be fine.

Jeremy Ford
[EMAIL PROTECTED]

From: Bjorn Vidar Remme [EMAIL PROTECTED]
Reply-To: Jetspeed Users List [EMAIL PROTECTED]
To: Jetspeed Users List [EMAIL PROTECTED]
Subject: Re: Portlets execution flow
Date: Fri, 6 Aug 2004 11:10:55 +0200
Hi Oscar,
Note: This answer does not solve your problem, it only confirms it. Read
on if you are interested.
We are using Jetspeed 1.6-dev and we struggle with the same problem
(Velocity portlets in our case). The idea was to have multiple portlets on
the page share information stored in rundata. The BuildNormalContext()
method builds the context based entirely on data stored in rundata. We use
a system to store data in the rundata based on portlet id / portlet group
(parameter) and global for all.
We then write action handlers that performs all the logic and updates the
rundata.
Of course this relies on the fact that the action event is executed BEFORE
the buildNormaContext() methods are executed.
Specifying the action for a specific portlet like this:
form action=$jslink.getPortletById($portlet.ID) name=RundataTest
method=GET
or this:
form
action=$jslink.getAction(portlets.test.general.Rundata_TestAction,
$portlet) name=RundataTest method=GET
executes the action specifically for that particular portlet. Exactly what
we wanted.
But, then we noticed that the some of the portlets displayed old data!
The pattern for the problem was top-bottom-left-right as you describe.
Lets say we have two portlets A  B (AE=Action Event,
BNC=BuildNormalContext).
1. Clicking on portlet A executes: AE for A - BNC for A - BNC for B
(Perfect!).
2. Clicking on portlet B executes: BNC for A - AE for B - BNC for B
(Disaster!)
In case 2 portlet A is diplayed using old values from the rundata object.
Oh dear...
The only answer I have received on this problem is that in JSR168
(Jetspeed-2 implements this) the action event should always be executed
before the portlets are rendered in an undefined order.
Very cute, but migrating to Jetspeed-2 is not an option for the moment.
It would be nice to get an opinion from an experienced Jetspeed developer
on how much work it would be to modifiy Jetspeed-1 to behave in this way
to.
Right now we have to be really careful when planning the actions/flow in
the portal and this is quite a limitation for the moment.

Kind regards,
Bjorn Vidar Remme


Oscar Ruiz [EMAIL PROTECTED]
05.08.2004 13:33
Please respond to Jetspeed Users List
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc:
Subject:Portlets execution flow
Hi all,
can anyone clarify me how multiple MVC portlets (JSP for instance) are
executed and output displayed?
There is obviously an order in which portlet controllers are called,
apparently from top to bottom and left to right.
*apparently* the View component (JSP) is executed right after the
Controller, hence if portlets are sharing a Model the whole thing results
in
a disaster.
Is there a way of rendering the page (i.e. execute the View components)
after all controllers have completed?
Many thanks.
Oscar.

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

_
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement

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


Re: Portlets execution flow

2004-08-06 Thread OlsonE
Bjorn, Oscar -

I have never seen the problems you are mentioning below - my action 
handler methods ALWAYS execute before the build*() methods on the active 
portlets.  We are currently using Velocity-based portlets.  When we 
specify the action parameter in a form, we use the following code 
template:

form method=post action=$jslink 
or
form method=post action=$jslink.setAction(portlets.FooAction)

The first version uses the default action as specified in the xreg for 
the portlet - this is what we use in most cases.  The second version uses 
any action you specify - as long as the action package you are using is 
declared to Turbine using the module.packages key (see 
TurbineResources.properties, and look for that key.)

For an example of the first version, look at the source in 
/tutorial/tutorials/9/templates/vm/portlets/html/coffees-browser.vm 
(directly from cvs) as well as the related xreg files.  An example of the 
second version is at: 
http://portals.apache.org/jetspeed-1/tutorial/7/events.html.

Good luck,
Eric




Bjorn Vidar Remme [EMAIL PROTECTED] 
08/06/2004 04:10 AM
Please respond to
Jetspeed Users List [EMAIL PROTECTED]


To
Jetspeed Users List [EMAIL PROTECTED]
cc

Subject
Re: Portlets execution flow






Hi Oscar, 

Note: This answer does not solve your problem, it only confirms it. Read 
on if you are interested.

We are using Jetspeed 1.6-dev and we struggle with the same problem 
(Velocity portlets in our case). The idea was to have multiple portlets on 

the page share information stored in rundata. The BuildNormalContext() 
method builds the context based entirely on data stored in rundata. We use 

a system to store data in the rundata based on portlet id / portlet group 
(parameter) and global for all. 
We then write action handlers that performs all the logic and updates the 
rundata.

Of course this relies on the fact that the action event is executed BEFORE 

the buildNormaContext() methods are executed.

Specifying the action for a specific portlet like this:
form action=$jslink.getPortletById($portlet.ID) name=RundataTest 
method=GET
or this:
form 
action=$jslink.getAction(portlets.test.general.Rundata_TestAction, 
$portlet) name=RundataTest method=GET

executes the action specifically for that particular portlet. Exactly what 

we wanted.

But, then we noticed that the some of the portlets displayed old data!
The pattern for the problem was top-bottom-left-right as you describe. 

Lets say we have two portlets A  B (AE=Action Event, 
BNC=BuildNormalContext). 
1. Clicking on portlet A executes: AE for A - BNC for A - BNC for B 
(Perfect!). 
2. Clicking on portlet B executes: BNC for A - AE for B - BNC for B 
(Disaster!)

In case 2 portlet A is diplayed using old values from the rundata object. 
Oh dear...

The only answer I have received on this problem is that in JSR168 
(Jetspeed-2 implements this) the action event should always be executed 
before the portlets are rendered in an undefined order. 
Very cute, but migrating to Jetspeed-2 is not an option for the moment.

It would be nice to get an opinion from an experienced Jetspeed developer 
on how much work it would be to modifiy Jetspeed-1 to behave in this way 
to.
Right now we have to be really careful when planning the actions/flow in 
the portal and this is quite a limitation for the moment.



Kind regards,
Bjorn Vidar Remme






Oscar Ruiz [EMAIL PROTECTED]
05.08.2004 13:33
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:Portlets execution flow


Hi all,

can anyone clarify me how multiple MVC portlets (JSP for instance) are
executed and output displayed?

There is obviously an order in which portlet controllers are called,
apparently from top to bottom and left to right.

*apparently* the View component (JSP) is executed right after the
Controller, hence if portlets are sharing a Model the whole thing results 
in
a disaster.

Is there a way of rendering the page (i.e. execute the View components)
after all controllers have completed?

Many thanks.

Oscar.



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





Re: Portlets execution flow

2004-08-06 Thread Bjorn Vidar Remme
Hi all, 

Well the trouble by using setAction() is that the action is executed for 
all the portlets (if a suitable method exists). You can easily test this 
by adding multiple instances of the same portlet to a page (same action 
class) or multiple portlets with different action classes but the same 
event name. You will then see that the action event is executed once for 
all the portlets.

The pattern is thus (AE=action event, BNC=buildNormalContext):
AE for portlet A, BNC for portlet A, AE for portlet B, BNC for portlet B 
etc..

Not what we want at all, we just want the action event to fire once.
This is why I specify the portlet ID in the action like this: 
$jslink.getAction(myaction, $portlet)

The action event is then executed only once, but as I described in my 
previous post the pattern is (clicking on portlet B): BNC-A, AE -B, BNC-B 
and not the desired AE-B, BNC-A, BNC-B.


Note: I am using getAction() because setAction() is deprecated according 
to the documentation. It does the same thing.
 

Kind regards,
Bjorn Vidar Remme






[EMAIL PROTECTED]
06.08.2004 15:54
Please respond to Jetspeed Users List
 
To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:Re: Portlets execution flow


Bjorn, Oscar -

I have never seen the problems you are mentioning below - my action 
handler methods ALWAYS execute before the build*() methods on the active 
portlets.  We are currently using Velocity-based portlets.  When we 
specify the action parameter in a form, we use the following code 
template:

form method=post action=$jslink 
or
form method=post action=$jslink.setAction(portlets.FooAction)

The first version uses the default action as specified in the xreg for 
the portlet - this is what we use in most cases.  The second version uses 
any action you specify - as long as the action package you are using is 
declared to Turbine using the module.packages key (see 
TurbineResources.properties, and look for that key.)

For an example of the first version, look at the source in 
/tutorial/tutorials/9/templates/vm/portlets/html/coffees-browser.vm 
(directly from cvs) as well as the related xreg files.  An example of the 
second version is at: 
http://portals.apache.org/jetspeed-1/tutorial/7/events.html.

Good luck,
Eric




Bjorn Vidar Remme [EMAIL PROTECTED] 
08/06/2004 04:10 AM
Please respond to
Jetspeed Users List [EMAIL PROTECTED]


To
Jetspeed Users List [EMAIL PROTECTED]
cc

Subject
Re: Portlets execution flow






Hi Oscar, 

Note: This answer does not solve your problem, it only confirms it. Read 
on if you are interested.

We are using Jetspeed 1.6-dev and we struggle with the same problem 
(Velocity portlets in our case). The idea was to have multiple portlets on 


the page share information stored in rundata. The BuildNormalContext() 
method builds the context based entirely on data stored in rundata. We use 


a system to store data in the rundata based on portlet id / portlet group 
(parameter) and global for all. 
We then write action handlers that performs all the logic and updates the 
rundata.

Of course this relies on the fact that the action event is executed BEFORE 


the buildNormaContext() methods are executed.

Specifying the action for a specific portlet like this:
form action=$jslink.getPortletById($portlet.ID) name=RundataTest 
method=GET
or this:
form 
action=$jslink.getAction(portlets.test.general.Rundata_TestAction, 
$portlet) name=RundataTest method=GET

executes the action specifically for that particular portlet. Exactly what 


we wanted.

But, then we noticed that the some of the portlets displayed old data!
The pattern for the problem was top-bottom-left-right as you describe. 

Lets say we have two portlets A  B (AE=Action Event, 
BNC=BuildNormalContext). 
1. Clicking on portlet A executes: AE for A - BNC for A - BNC for B 
(Perfect!). 
2. Clicking on portlet B executes: BNC for A - AE for B - BNC for B 
(Disaster!)

In case 2 portlet A is diplayed using old values from the rundata object. 
Oh dear...

The only answer I have received on this problem is that in JSR168 
(Jetspeed-2 implements this) the action event should always be executed 
before the portlets are rendered in an undefined order. 
Very cute, but migrating to Jetspeed-2 is not an option for the moment.

It would be nice to get an opinion from an experienced Jetspeed developer 
on how much work it would be to modifiy Jetspeed-1 to behave in this way 
to.
Right now we have to be really careful when planning the actions/flow in 
the portal and this is quite a limitation for the moment.



Kind regards,
Bjorn Vidar Remme






Oscar Ruiz [EMAIL PROTECTED]
05.08.2004 13:33
Please respond to Jetspeed Users List
 
To: 'Jetspeed Users List' [EMAIL PROTECTED]
cc: 
Subject:Portlets execution flow


Hi all,

can anyone clarify me how multiple MVC portlets (JSP for instance) are
executed and output displayed?

There is obviously an order

RE: Portlets execution flow

2004-08-06 Thread Bob Fleischman
Bjorn:

You can limit the impact of which class runs your method via the action by
qualifying the action.

That is: use action=Myportlet2.doUpdate rather than action=doUpdate.  With
the second method any portlet which has a doUpdate method will fire.

As to having several Portlets share a current model. We have found that it
is best to have a separate action class that modifies the model. Then using
the setAction style described in this thread you can update the common model
first. That action will be called before any rendering.

Your portlet should then be limited to building up your context. Otherwise
you are duplicating your efforts by putting model update code in 2 places.

Bob

-Original Message-
From: Bjorn Vidar Remme [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 06, 2004 10:41 AM
To: Jetspeed Users List
Subject: Re: Portlets execution flow

Hi all, 

Well the trouble by using setAction() is that the action is executed for 
all the portlets (if a suitable method exists). You can easily test this 
by adding multiple instances of the same portlet to a page (same action 
class) or multiple portlets with different action classes but the same 
event name. You will then see that the action event is executed once for 
all the portlets.

The pattern is thus (AE=action event, BNC=buildNormalContext):
AE for portlet A, BNC for portlet A, AE for portlet B, BNC for portlet B 
etc..

Not what we want at all, we just want the action event to fire once.
This is why I specify the portlet ID in the action like this: 
$jslink.getAction(myaction, $portlet)

The action event is then executed only once, but as I described in my 
previous post the pattern is (clicking on portlet B): BNC-A, AE -B, BNC-B 
and not the desired AE-B, BNC-A, BNC-B.


Note: I am using getAction() because setAction() is deprecated according 
to the documentation. It does the same thing.
 

Kind regards,
Bjorn Vidar Remme






[EMAIL PROTECTED]
06.08.2004 15:54
Please respond to Jetspeed Users List
 
To: Jetspeed Users List [EMAIL PROTECTED]
cc: 
Subject:Re: Portlets execution flow


Bjorn, Oscar -

I have never seen the problems you are mentioning below - my action 
handler methods ALWAYS execute before the build*() methods on the active 
portlets.  We are currently using Velocity-based portlets.  When we 
specify the action parameter in a form, we use the following code 
template:

form method=post action=$jslink 
or
form method=post action=$jslink.setAction(portlets.FooAction)

The first version uses the default action as specified in the xreg for 
the portlet - this is what we use in most cases.  The second version uses 
any action you specify - as long as the action package you are using is 
declared to Turbine using the module.packages key (see 
TurbineResources.properties, and look for that key.)

For an example of the first version, look at the source in 
/tutorial/tutorials/9/templates/vm/portlets/html/coffees-browser.vm 
(directly from cvs) as well as the related xreg files.  An example of the 
second version is at: 
http://portals.apache.org/jetspeed-1/tutorial/7/events.html.

Good luck,
Eric




Bjorn Vidar Remme [EMAIL PROTECTED] 
08/06/2004 04:10 AM
Please respond to
Jetspeed Users List [EMAIL PROTECTED]


To
Jetspeed Users List [EMAIL PROTECTED]
cc

Subject
Re: Portlets execution flow






Hi Oscar, 

Note: This answer does not solve your problem, it only confirms it. Read 
on if you are interested.

We are using Jetspeed 1.6-dev and we struggle with the same problem 
(Velocity portlets in our case). The idea was to have multiple portlets on 


the page share information stored in rundata. The BuildNormalContext() 
method builds the context based entirely on data stored in rundata. We use 


a system to store data in the rundata based on portlet id / portlet group 
(parameter) and global for all. 
We then write action handlers that performs all the logic and updates the 
rundata.

Of course this relies on the fact that the action event is executed BEFORE 


the buildNormaContext() methods are executed.

Specifying the action for a specific portlet like this:
form action=$jslink.getPortletById($portlet.ID) name=RundataTest 
method=GET
or this:
form 
action=$jslink.getAction(portlets.test.general.Rundata_TestAction, 
$portlet) name=RundataTest method=GET

executes the action specifically for that particular portlet. Exactly what 


we wanted.

But, then we noticed that the some of the portlets displayed old data!
The pattern for the problem was top-bottom-left-right as you describe. 

Lets say we have two portlets A  B (AE=Action Event, 
BNC=BuildNormalContext). 
1. Clicking on portlet A executes: AE for A - BNC for A - BNC for B 
(Perfect!). 
2. Clicking on portlet B executes: BNC for A - AE for B - BNC for B 
(Disaster!)

In case 2 portlet A is diplayed using old values from the rundata object. 
Oh dear...

The only answer I have received on this problem is that in JSR168 
(Jetspeed

Portlets execution flow

2004-08-05 Thread Oscar Ruiz
Hi all,

can anyone clarify me how multiple MVC portlets (JSP for instance) are
executed and output displayed?

There is obviously an order in which portlet controllers are called,
apparently from top to bottom and left to right.

*apparently* the View component (JSP) is executed right after the
Controller, hence if portlets are sharing a Model the whole thing results in
a disaster.

Is there a way of rendering the page (i.e. execute the View components)
after all controllers have completed?

Many thanks.

Oscar.



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