ccl.servlet
Class CSV
java.lang.Object
|
+--ccl.servlet.CSV
- public class CSV
- extends java.lang.Object
This class encapsulates printing of spread sheet csv
data generated by a servlet.
Constructor Summary |
CSV(javax.servlet.http.HttpServletResponse response)
All following output goes to the given
HttpServletResponse object. |
Method Summary |
void |
close()
This method just closes any open stream. |
void |
endLine()
This method ends a row. |
static void |
exportCSV(javax.servlet.http.HttpServletResponse response,
java.sql.ResultSet result)
This method does not print html output but instead
creates a csv file which can be used to import into
a spread sheet application like Excel or StarCalc. |
void |
printValue(java.lang.String value)
Fills data into one field. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CSV
public CSV(javax.servlet.http.HttpServletResponse response)
throws java.io.IOException
- All following output goes to the given
HttpServletResponse object. The content type is
set immediately to text/html and a html and head
section is opened as well.
Use the close method on this object to finish the
html page. To 'close' the already open head section
make sure you printed a title with 'printTitle'.
endLine
public void endLine()
- This method ends a row. Next data will appear in a new
line.
printValue
public void printValue(java.lang.String value)
- Fills data into one field.
close
public void close()
- This method just closes any open stream.
There should be no following invokation on this object.
exportCSV
public static void exportCSV(javax.servlet.http.HttpServletResponse response,
java.sql.ResultSet result)
throws java.io.IOException,
java.sql.SQLException
- This method does not print html output but instead
creates a csv file which can be used to import into
a spread sheet application like Excel or StarCalc.
The data is taken from the given result set.
- Throws:
java.io.IOException
- in case anything goes wrong
writing output to the http
servlet response.java.sql.SQLException
- in case anything goes wrong
with the database.