I've never used the velocity generator before so I may be off-base. But IIUC ...
I don't think you generally add objects into the map. Rather, the map comes pre-populated with objects that your code needs: request, response, etc. e.g.: public class YourGenerator extends ComposerGenerator { public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException { super.setup(resolver, objectModel, src, par); Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT); //System.out.println("request: "+request+"; rtf gen setup called @ "+new java.util.Date()); String filename = request.getParameter("filename"); Note how in this generator, you can get a hold of the request object from out of the object map. So the "export-object" parameter that you were referring to is a means of transferring these objects from Cocoon's object map into a place where velocity can find them. According to the docs: " Default Java objects exported to the Velocity context: * request (org.apache.cocoon.environment.Request) - * The Cocoon current request template (java.lang.String) - * The path of the template file currently being evaluated response (org.apache.cocoon.environment.Response) - * The Cocoon response associated with the current request context (org.apache.cocoon.environment.Context) - * The Cocoon context associated with the current request parameters (org.apache.avalon.framework.parameters.Parameters) - Any parameters passed to the generator in the pipeline " That seems to pretty much cover most of the important object map objects that I think you'd want to pass to velocity, so it doesn't seem like there'd be much need to use this parameter. I suppose if you wanted to, though, you could add an object of your own to the object map (see the generator code above; you could do this in an action too), and then have that object get copied over to velocity using the "export-object" parm. Whew! Sorry for being so long winded. Hope this helps. Best I could do. Someone correct me if I'm wrong. DR At 04:23 PM 12/20/01 +0000, you wrote: >Anyone? >Help? > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: 20 December 2001 00:18 > > To: [EMAIL PROTECTED] > > Subject: How do I add objects to the objectModel Map > > > > > > Hi > > > > I hope this is straightforward... > > > > How do I add objects to the objectModel Map? > > > > http://xml.apache.org/cocoon/userdocs/generators/velocity-gene >rator.html >says: ><export-object key="objectMapKey" name="velocityContextName"/> (optional; >0..n) - Export the object specified by key from the Cocoon object map to the >Velocity context of the template. The object can be accessed from the >template as name. Be careful to use a valid VTL variable name. > >I've looked through the code but can't figure this one out. > >David > > >--------------------------------------------------------------------- >Please check that your question has not already been answered in the >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > >To unsubscribe, e-mail: <[EMAIL PROTECTED]> >For additional commands, e-mail: <[EMAIL PROTECTED]> > >--------------------------------------------------------------------- >Please check that your question has not already been answered in the >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > >To unsubscribe, e-mail: <[EMAIL PROTECTED]> >For additional commands, e-mail: <[EMAIL PROTECTED]> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>