>Is it possible to put arbitary contents into the VelocityContext from
>within my action or can only Action attributes be accessed from within
>the Velocity template?
If you're using the default WebWorkVelocityServlet, you're not going to
be able to directly manipulate the context. WebWork creates a context
for you with the ValueStack and the $req and $res objects.
Using action attributes in Velocity is relatively straightforward.
Here's an example:
<snip>
public class ListEmployees extends ActionSupport {
private List employees;
public List getEmployees() {
return employees;
}
</snip>
Action attributes can then be accessed though the velocity template:
<snip>
#action ("ListEmployees" $myAction)
#execute ($myAction)
#if ($result == "success")
#foreach ($employee in $myAction.Employees)
<b>$employee.Name</b>
</snip>
>What ways from the action class can you make available data to be
>accessed by Velocity from it's template.
I can usually get everything I need though the public accessor methods
in my action class or through the ValueStack.
>I currently have some data as an Action attribute but it's not visibile
>from within my Velocity template.
Make sure you are executing the action, not just using the #action
directive. In the above example, the employee list doesn't get populated
until execute() get called. (I did leave out the actual execute
implementation, mind you)
>Am I forced to create attributes in my Action for this or can I put
>anything I like on the valuestack from within my action and access that
>from the Velocity Template?
I not sure what objects you want to make available. Does the above
example help?
- Brock
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork