Friday, February 11, 2005, 4:45:50 PM, Luke Shannon wrote:
> Hello;
>
> I have a web application that generates a web site based on the data in a
> DB.
>
> Right now I create the html for each page in memory, adding in the dynamic
> content, and than write it to file using a plain old FileWriter.
>
> As you can imagine making changes to the html is a pain (all quotes need to
> be escaped, need to modified java code and update the server each time).
>
> I would like to have something like FreeMarker, where the presentation code
> is outside of the java code. This way changes can be made to the
> presentation of the page by someone who doesn't know java.
This is what FreeMarker is about.
> How hard is it to write files to the server (not direct output to the
> browser)? How much control would I have of the folder structure the files
> were written to?
Full control, since FreeMarker doesn't deal with such things. I mean, it
just writes output into a Wrier, and then where do you send/store that
is up to you. Basically it doesn't even know about Servlet-s or HTTP.
> Is there example code for doing something similar to what I
> am asking?
There are at least two projects that are about file generation: The
built in ANT task of FreeMarker, and FMPP (this last knows a lot of file
generation tricks, like when a single template generates multiple output
files itself, or when it renames its own output file, etc). But I guess
you will not need to look into those tricks doesn't require to much
FreeMarker specific knowledge.
--
Best regards,
Daniel Dekany
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
|