sloppycode.net
DataProducer
A class for separating the presentation layer from the data layer in Java.


Download Dataproducer


Dataproducer, available for php,java servlets and asp is used to seperate the presentation layer from the data layer in web applications. With it you can specify single and multiple row tags inside a html template, which are then replaced with data that you specify. Please note this is the first version of the class and features little error handling. More features and error handling will be added in the next version. For this Java version, tag libaries would be a better solution most of the time.

Methods
dp.doDataProducer(startTag,endTag,data,contents)
Replaces all data between starttag and endtag, with the contents of data, a Vector with each element being a Hashtable. The template it uses is the 'contents' variable. Returns the parsed template as a string.

dp.doSingleDataProducer(data,contents)
Replaces single data tags, specified in data which is a Hashtable. 'contents' is the html template, the method returns the parsed template as a string.

dp.openTemplate(filename)
Opens 'filename' as a template (usually a html file), and returns it as a string.
Example The example opens a html template, replaces 3 single tags, and 3 rows of data


› Home
› C#
› Snippets
› Articles
› Tools
› Taglines
› ASP
› Dictionary Object
› FSO
› Unix cheat sheet
› Gaming
› CSS
› Yak
› Umbraco
› About
› Contact
› Privacy
› Projects
› Search
› Sitemap





Buy on Amazon



Buy on Amazon



Buy on Amazon



Buy on Amazon