A revolutionary new library that enables any Java data structure (JDBC ResultSets, Plain Objects, HashTables etc) to be inserted into into any text-based format, such as HTML or XML. Its ideal for generating dynamic content for Servlets for websites or for generating XML files for Web Services.
This allows for the the html/xml or other document to be worked on independantly from the person working on the data as the document is completely separate from the code.
This is achieved by defining three specialised tags:
* igoup
* irow
* iwindow
which are inserted into a html/xml/txt file to make it into a template and injection library does the rest.
Advanced Features
* Formatting with Java's standard formatting class
* Extensible to any Java object through an interface
Example: Servlet/JDBC/HTML
The following example prints out all the records in a JDBC ResultSet.
ShowCustomer.html:
<html>
<body>
<irow name="Customers">
Id: #id
Name: #name
Address: #address
Phone: #phone
Email: #email
</irow>
</body>
</html>
----------------------------------------------------------------------------------------
ShowCustomer.java:
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// Target
InjectionTarget htmlTarget = new HTMLInjectionTarget("ShowCustomer.html");
// Data
ResultSet rs = getCustomers();
HashMap injections = new HashMap();
injections.put("Customers", new SQLInjection(rs));
// Stream
response.setContentType(CONTENT_TYPE);
OutputStream out = response.getOutputStream();
InjectionStreamer injectionStreamer;
injectionStreamer = new InjectionStreamer(htmlTarget);
injectionStreamer.streamTo(out, injections);
}