All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.io.Writer | +----java.io.PrintWriter | +----nl.nmg.servlet.HTMLWriter
PrintWriter
that adds methods for printing HTML elements, especially form elements.
<INPUT type="checkbox">
form element
without a label or value
and checked
attributes.
<INPUT type="checkbox">
form element
without a label or a value
attribute.
<INPUT type="checkbox">
form element
without a value
attribute.
<INPUT type="checkbox">
form element
without value
and checked
attributes.
<INPUT type="checkbox">
form element
without a label.
<INPUT type="checkbox">
form element.
<SELECT>
form elements that
can be used to select a date.
<SELECT>
form elements that
can be used to select a date.
<SELECT>
form elements that
can be used to select a date.
<INPUT type="file">
form element
without size
and maxlength
attributes.
<INPUT type="file">
form element
without a maxlength
attribute.
<INPUT type="file">
form element.
<INPUT type="hidden">
form element.
<SELECT>
form element for multiple selections
with the values for labels, without a selected option.
<SELECT>
form element for multiple selections
with the values for labels.
<SELECT>
form element for multiple selections.
<INPUT type="password">
form element without
value
, size
and maxlength
attributes.
<INPUT type="password">
form element
without size
and maxlength
attributes.
<INPUT type="password">
form element
without a maxlength
attribute.
<INPUT type="password">
form element.
<INPUT type="radio">
form element
without a label or value
and checked
attributes.
<INPUT type="radio">
form element
without a label or a value
attribute.
<INPUT type="radio">
form element
without a value
attribute.
<INPUT type="radio">
form element
without value
and checked
attributes.
<INPUT type="radio">
form element
without a label.
<INPUT type="radio">
form element.
<INPUT type="reset">
form element
without a value
attribute.
<INPUT type="reset">
form element.
<SELECT>
form element with the values
for labels, without a selected option.
<SELECT>
form element with the values
for labels.
<SELECT>
form element.
<INPUT type="submit">
form element
without name
and value
attributes.
<INPUT type="submit">
form element
without a value
attribute.
<INPUT type="submit">
form element.
<TEXTAREA>
form element
without wrap
, cols
and
rows
attributes.
<TEXTAREA>
form element
without a wrap
attribute.
<TEXTAREA>
form element.
<TEXTAREA>
form element.
<INPUT type="text">
form element without
value
, size
and maxlength
attributes.
<INPUT type="text">
form element
without size
and maxlength
attributes.
<INPUT type="text">
form element
without a maxlength
attribute.
<INPUT type="text">
form element.
public HTMLWriter(Writer out)
public HTMLWriter(Writer out, boolean autoFlush)
public HTMLWriter(OutputStream out)
public HTMLWriter(OutputStream out, boolean autoFlush)
public void printHiddenInput(String name, String value)
<INPUT type="hidden">
form element.
If the value is null
, a comment is printed instead.
name
attribute
value
attribute
or null
if no form element should be printed.
public void printTextInput(String name, String value, int size, int maxlength)
<INPUT type="text">
form element.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
maxlength
attribute
or -1 if it should not be set
public void printTextInput(String name, String value, int size)
<INPUT type="text">
form element
without a maxlength
attribute.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
public void printTextInput(String name, String value)
<INPUT type="text">
form element
without size
and maxlength
attributes.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
public void printTextInput(String name)
<INPUT type="text">
form element without
value
, size
and maxlength
attributes.
name
attribute
or null
if it should not be set
public void printPasswordInput(String name, String value, int size, int maxlength)
<INPUT type="password">
form element.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
maxlength
attribute
or -1 if it should not be set
public void printPasswordInput(String name, String value, int size)
<INPUT type="password">
form element
without a maxlength
attribute.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
public void printPasswordInput(String name, String value)
<INPUT type="password">
form element
without size
and maxlength
attributes.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
public void printPasswordInput(String name)
<INPUT type="password">
form element without
value
, size
and maxlength
attributes.
name
attribute
or null
if it should not be set
public void printFileInput(String name, int size, int maxlength)
<INPUT type="file">
form element.
name
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
maxlength
attribute
or -1 if it should not be set
public void printFileInput(String name, int size)
<INPUT type="file">
form element
without a maxlength
attribute.
name
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
public void printFileInput(String name)
<INPUT type="file">
form element
without size
and maxlength
attributes.
name
attribute
or null
if it should not be set
public void printSubmitInput(String name, String value)
<INPUT type="submit">
form element.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
public void printSubmitInput(String value)
<INPUT type="submit">
form element
without a value
attribute.
name
attribute
or null
if it should not be set
public void printSubmitInput()
<INPUT type="submit">
form element
without name
and value
attributes.
public void printResetInput(String value)
<INPUT type="reset">
form element.
value
attribute
or null
if it should not be set
public void printResetInput()
<INPUT type="reset">
form element
without a value
attribute.
public void printCheckboxInput(String name, String value, boolean checked, String label)
<INPUT type="checkbox">
form element.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
checked
attribute
null
if there should be no label.
public void printCheckboxInput(String name, String value, boolean checked)
<INPUT type="checkbox">
form element
without a label.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
checked
attribute
public void printCheckboxInput(String name, boolean checked, String label)
<INPUT type="checkbox">
form element
without a value
attribute.
name
attribute
or null
if it should not be set
checked
attribute
null
if there should be no label.
public void printCheckboxInput(String name, boolean checked)
<INPUT type="checkbox">
form element
without a label or a value
attribute.
name
attribute
or null
if it should not be set
checked
attribute
public void printCheckboxInput(String name, String label)
<INPUT type="checkbox">
form element
without value
and checked
attributes.
name
attribute
or null
if it should not be set
null
if there should be no label.
public void printCheckboxInput(String name)
<INPUT type="checkbox">
form element
without a label or value
and checked
attributes.
name
attribute
or null
if it should not be set
public void printRadioInput(String name, String value, boolean checked, String label)
<INPUT type="radio">
form element.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
checked
attribute
null
if there should be no label.
public void printRadioInput(String name, String value, boolean checked)
<INPUT type="radio">
form element
without a label.
name
attribute
or null
if it should not be set
value
attribute
or null
if it should not be set
checked
attribute
public void printRadioInput(String name, boolean checked, String label)
<INPUT type="radio">
form element
without a value
attribute.
name
attribute
or null
if it should not be set
checked
attribute
null
if there should be no label.
public void printRadioInput(String name, boolean checked)
<INPUT type="radio">
form element
without a label or a value
attribute.
name
attribute
or null
if it should not be set
checked
attribute
public void printRadioInput(String name, String label)
<INPUT type="radio">
form element
without value
and checked
attributes.
name
attribute
or null
if it should not be set
null
if there should be no label.
public void printRadioInput(String name)
<INPUT type="radio">
form element
without a label or value
and checked
attributes.
name
attribute
or null
if it should not be set
public void printTextArea(String name, int cols, int rows, String wrap, String value)
<TEXTAREA>
form element.
name
attribute
or null
if it should not be set
cols
attribute
or -1 if it should not be set
rows
attribute
or -1 if it should not be set
wrap
attribute
or null
if it should not be set
<TEXTAREA>
and
</TEXTAREA>
tags or null
if it should be empty.
public void printTextArea(String name, int cols, int rows, String wrap)
<TEXTAREA>
form element.
name
attribute
or null
if it should not be set
cols
attribute
or -1 if it should not be set
rows
attribute
or -1 if it should not be set
wrap
attribute
or null
if it should not be set
public void printTextArea(String name, int cols, int rows)
<TEXTAREA>
form element
without a wrap
attribute.
name
attribute
or null
if it should not be set
cols
attribute
or -1 if it should not be set
rows
attribute
or -1 if it should not be set
public void printTextArea(String name)
<TEXTAREA>
form element
without wrap
, cols
and
rows
attributes.
name
attribute
or null
if it should not be set
public void printSingleSelect(String name, String values[], String selected, String labels[])
<SELECT>
form element.
name
attribute
or null
if it should not be set
<OPTION>
form elements.
<OPTION>
that should
have a selected
attribute.
<OPTION>
form elements.
public void printSingleSelect(String name, String values[], String selected)
<SELECT>
form element with the values
for labels.
name
attribute
or null
if it should not be set
<OPTION>
form elements.
<OPTION>
that should
have a selected
attribute.
public void printSingleSelect(String name, String values[])
<SELECT>
form element with the values
for labels, without a selected option.
name
attribute
or null
if it should not be set
<OPTION>
form elements.
public void printMultipleSelect(String name, int size, String values[], boolean selected[], String labels[])
<SELECT>
form element for multiple selections.
name
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
<OPTION>
form elements.
values
.
If one of the booleans is true, the corresponding option
gets a selected
attribute.
<OPTION>
form elements.
public void printMultipleSelect(String name, int size, String values[], boolean selected[])
<SELECT>
form element for multiple selections
with the values for labels.
name
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
<OPTION>
form elements.
values
.
If one of the booleans is true, the corresponding option
gets a selected
attribute.
public void printMultipleSelect(String name, int size, String values[])
<SELECT>
form element for multiple selections
with the values for labels, without a selected option.
name
attribute
or null
if it should not be set
size
attribute
or -1 if it should not be set
<OPTION>
form elements.
public void printDateSelect(String prefix, int lowestYear, int highestYear, Date selected, boolean allowNull)
<SELECT>
form elements that
can be used to select a date. "_day
",
"_month
" and "_year
" are added to the
prefix to make the name attributes for the form elements.
name
attributes
null
if no date should be selected
public void printDateSelect(String prefix, int lowestYear, int highestYear, Date selected)
<SELECT>
form elements that
can be used to select a date. "_day
",
"_month
" and "_year
" are added to the
prefix to make the name attributes for the form elements. The
form elements allow for empty dates.
name
attributes
null
if no date should be selected.
public void printDateSelect(String prefix, int lowestYear, int highestYear)
<SELECT>
form elements that
can be used to select a date. "_day
",
"_month
" and "_year
" are added to the
prefix to make the name attributes for the form elements. The
form elements allow for empty dates, no date is selected.
name
attributes
public void printText(BufferedReader in, boolean allowHtml) throws IOException
allowHtml
the following transformations are done:
allowHtml
is false.
allowHtml
is false.
<A HREF>
tags.
<UL>
, <LI>
and </UL>
tags.
<BR>
.
This method is meant to be used to print text entered by people that know little to no HTML. It tries to do its best to generate nice looking HTML, but the algorithm has to guess a lot of the time. So do not be surprised when the output is not what you expected. Have a look at the code, and try to fix it. :)
BufferedReader
that can be read to get the text
or null
to print nothing.
false
when making
something like a guestbook)
public void printText(BufferedReader in) throws IOException
BufferedReader
that can be read to get the text
or null
to print nothing.
public void printText(String text, boolean allowHtml)
null
to print nothing
false
when making
something like a guestbook)
public void printText(String text)
null
to print nothing
public void printDate(String format, Date value)
null
to use the default format
(see the documentation for SimpleDateFormat)
null
to print nothing
public void printDate(Date value)
null
to print nothing
All Packages Class Hierarchy This Package Previous Next Index