You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by David Sean Taylor <da...@bluesunrise.com> on 2002/05/09 21:46:29 UTC

context

Raphael,

Why is there more than one context?

In a turbine action, if I do

        Context context = TurbineVelocity.getContext(data);
	  context.put("thing", thing);

And then in a velocity  page, I try

	$thing

It doesn't find it.

Thanks,

David



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


RE: context

Posted by David Sean Taylor <da...@bluesunrise.com>.
> Isn't the controller going to drop whatever you've placed in 
> the context 
> after the action is run?
> 
> I haven't looked at the code for TurbineVelocity but it looks 
> like the 
> VelocityPortletController uses the getContext() method which 
> is getting a 
> new (blank) context object.
> 
> 
> public class VelocityPortletController extends 
> AbstractPortletController {
>     public ConcreteElement getContent( RunData rundata )
>     {
>         // create a blank context and with all the global application
>         // Pull Tools inside
>         Context context = TurbineVelocity.getContext();
>         
>         context.put( "data", rundata );
>         context.put( "controller", this );
> 	....
> 

Yes, that's 'how', but not 'why'.
I was under the impression that there should only be one context, the
'Velocity Context'.
It confused me to find out there are more than one. Just wanted to know
why it was implemented this way.



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


Re: context

Posted by "David G. Powers" <je...@pssp.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 09 May 2002 12:46 pm, David Sean Taylor wrote:
> Raphael,
>
> Why is there more than one context?
>
> In a turbine action, if I do
>
>         Context context = TurbineVelocity.getContext(data);
> 	  context.put("thing", thing);
>
> And then in a velocity  page, I try
>
> 	$thing
>
> It doesn't find it.
>
> Thanks,
>
> David


Isn't the controller going to drop whatever you've placed in the context 
after the action is run?

I haven't looked at the code for TurbineVelocity but it looks like the 
VelocityPortletController uses the getContext() method which is getting a 
new (blank) context object.


public class VelocityPortletController extends AbstractPortletController
{
    public ConcreteElement getContent( RunData rundata )
    {
        // create a blank context and with all the global application
        // Pull Tools inside
        Context context = TurbineVelocity.getContext();
        
        context.put( "data", rundata );
        context.put( "controller", this );
	....


There is an empty buildContext method in VelocityPortletController that you 
might use.  Place the context objects in a session var (or use setTemp) and 
then write a custom buildContext method to pull the object into the context.

Then again - I may be wayyyyyy off base!

DP



- -- 
David G. Powers
PowerSource
-----BEGIN PGP SIGNATURE-----
Comment: Verify the authenticity of this message with the public key available at http://pssp.com/dgp_pk.asc

iD8DBQE82yOcjmjAPDT0/nERArB+AJ9oxRCZeoP3b3GscvprwwZw43i4dACg5n1I
nt4A2LDtQHiDaTGMFLwC6AQ=
=oUC+
-----END PGP SIGNATURE-----

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


Re: context

Posted by ra...@networks.groupvu.com.
David Sean Taylor wrote:

>Raphael,
>
>Why is there more than one context?
>
>In a turbine action, if I do
>
>        Context context = TurbineVelocity.getContext(data);
>	  context.put("thing", thing);
>
>And then in a velocity  page, I try
>
>	$thing
>
>It doesn't find it.
>  
>

I don't think it's a good idea to use the global app context for the 
protlet as they may otherwise
screw jetspeed application context by mistake (think for example that 
you want to display a dynamic
object from the context in the bottom navigation...).
So VelocityPortlet creates an independant context for each instance.

-- 
Raphaƫl Luta - raphael.luta@networks.groupvu.com
Professional Services Manager
Vivendi Universal Networks - Paris




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