Hey Joe. Thanks for the responses, everyone!

Indeed, if I put objects in the Context using the Action (I'm using
ActionEvents - great feature!) it does indeed resolve the template
references correctly. However, my problem is that I need to "put them in and
leave them" - i.e., I was under the impression that the Context was supposed
to be persistent through a session. I guess it's not.

What I needed to know is, specifically, how to create a custom "Session",
where exactly one is created per visitor to the website and NOT a lone
instance or singleton (as appears to be the tactic with Pull Service). I
need this to be the "base" repository of data associated with one user's
session with the site - which allows objects fetched from the database to be
cached in memory and modified with minimal overhead.

It appears that the best way to go about this is to have my custom User
class either implement org.apache.turbine.om.security.User or extend
org.apache.turbine.com.security.TurbineUser. I'm preparing my own User /
Permissions schema, so I'll probably do the former. Then I'd set the "User"
field in RunData, which requires an org.apache.turbine.om.security.User.
That gives me the impression of being session-persistent, and the RunData is
available globally to the Context.

Does this seem to be the best solution to everyone out there?

~Andy

----- Original Message -----
From: "joeblack" <[EMAIL PROTECTED]>
To: "'Turbine Users List'" <[EMAIL PROTECTED]>
Sent: Monday, July 15, 2002 1:02 PM
Subject: RE: Velocity Context Objects being dropped


Hi, Andy:

I put my objects into TemplateContext in Action time and time again,
they always work. If the request link is
$link.setAction("FooAction").setPage("MyFooBar.vm"), I think you can get
the reference in .VM with no problem.
Use doPerform() or doXxxxxx() method in Action instead of
doBuildTemplate().
Good luck.


Joel

-----Original Message-----
From: Andy Whalen [mailto:[EMAIL PROTECTED]]
Sent: 2002��7��14�� 13:59
To: [EMAIL PROTECTED]
Subject: Velocity Context Objects being dropped

Hi,

As per the thousands of recommendations scattered throughout this
newsgroup, I have stuck with Turbine 2.1 to develop an intranet site.
This framework is tremendous!

I'm having one little problem: I'm using VM templates for my front end,
but for some reason, whenever I instantiate an object and insert it into
the Context, it disappears upon instantiation of the next page. I.e.,

in FooAction.java
    doBuildTemplate( data, context ) {
        context.put( "bar", new Bar() );
    }

then, on the next page that loads, MyFooBar.vm:

$bar.toString()

prints out an error message, "$bar.toString() is an invalid reference."
Indeed, if I do a S.o.p. of "context.get( "bar" )" in the class matching
MyFooBar.vm, it says "null".

Oh contrare!

The RunData object is there, but that's all - I can't get any other type
of object to "stick". In Turbine Velocity, there's no "merge" function
like in standalone Velocity, so I'm frankly out of ideas.

Does anyone have any wisdom they could impart upon me? I am in
desperation!

Best,

================================
Andy Whalen
http://www.andywhalen.com


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



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

Reply via email to