Package com.basiscomponents.db.export
Class HtmlExport
- java.lang.Object
-
- com.basiscomponents.db.export.HtmlExport
-
public class HtmlExport extends Object
-
-
Constructor Summary
Constructors Constructor Description HtmlExport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
writeHTML(ResultSet resultSet, Writer writer, HashMap<String,String> links, DataRow baseDR, boolean useLabel)
Uses the given Writer object to write the ResultSet's content as HTML <table> element to the output stream.
-
-
-
Method Detail
-
writeHTML
public static void writeHTML(ResultSet resultSet, Writer writer, HashMap<String,String> links, DataRow baseDR, boolean useLabel) throws Exception
Uses the given Writer object to write the ResultSet's content as HTML <table> element to the output stream.
Example Usage with an FileWriter object:
ResultSet rs = new ResultSet(); DataRow dr = new DataRow(); dr.setFieldValue("feld1", "TEST1"); dr.setFieldValue("feld2", "TEST2"); rs.add(dr); dr = new DataRow(); dr.setFieldValue("feld1", "TEST1"); dr.setFieldValue("feld3", "TEST3"); rs.add(dr); HashMap
links = new HashMap<>(); links.put("feld1", "/rest/test/{feld1}"); links.put("feld2", "/rest/test/{feld1}/{feld2}"); FileWriter fw = new FileWriter("D:/test.html"); ResultSetExporter.writeHTML(rs, fw, links); fw.flush(); fw.close(); - Parameters:
resultSet
- The ResultSet to export.writer
- A java.io.Writer Instance.links
- A HashMap with field name / URL pattern pairs, like http://xyz/a/{key}/gy.baseDR
- the data row, that holds the column sequence and the column labels (if available)useLabel
- indicates if the label instead of the field name should be used- Throws:
Exception
-
-