velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Rodriguez" <jr...@columbia.edu>
Subject RE: Generating Static HTML Pages
Date Mon, 10 Jan 2005 06:23:16 GMT
I just finished working on this.
I wrote a VelocityServlet which prompted the user that files had been
autogenerated after a form submission.

The code goes like this:

//write static html output 
//(different from the context object passed to handleRequest)

VelocityContext staticOutputContext = new VelocityContext();
...//add objects to context for static html generation

//this will the writer used by Velocity's engine for output
OutputStreamWriter writer = 
	new OutputStreamWriter(new FileOutputStream(filename), "UTF-8");

//load the static html template
Template staticTemplate = getTemplate(path of template);

//let Velocity do its thing :)
staticTemplate.merge(staticOutputContext, writer);


*Essentially the thing to note is the Writer object used*

Good luck.
-John

-----Original Message-----
From: Luke [mailto:luke@lukeshannon.com] 
Sent: Monday, January 03, 2005 3:53 AM
To: Velocity Users List; john@rothfield.com
Subject: Re: Generating Static HTML Pages

Thanks. I need to do some further research. At least now I know more
about
what to look into.

Luke

----- Original Message ----- 
From: "John Rothfield" <john@rothfield.com>
To: "Velocity Users List" <velocity-user@jakarta.apache.org>
Sent: Sunday, January 02, 2005 9:16 PM
Subject: Re: Generating Static HTML Pages


> There is more than one approach. Using the servlet and wget means you
> can use servlets.
>
> Luke wrote:
> > One more question. Am I using the wrong tool? For the simple
creation of
> > html pages would it be easier just to use the FileWriter class?
> >
> > ----- Original Message ----- 
> > From: "John Rothfield" <john@rothfield.com>
> > To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> > Sent: Sunday, January 02, 2005 6:11 PM
> > Subject: Re: Generating Static HTML Pages
> >
> >
> >
> >>You surely can write the pages, I can't tell you off the top of my
head
> >>how. You can also use the unix command wget for the same purpose if
you
> >>are using servlets. Its a web spider.
> >>
> >>Luke wrote:
> >>
> >>>Hello;
> >>>
> >>>I have just installed and ran a few Velocity examples. I was hoping
for
> >
> > a package that would physically write the html files to the server.
> >
> >>>Is this possible with Velocity? Is there another package I should
be
> >
> > looking at?
> >
> >>>Thanks,
> >>>
> >>>Luke
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail:
velocity-user-help@jakarta.apache.org
> >>
> >
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
velocity-user-help@jakarta.apache.org
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message