|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sas.Component | +--com.sas.servlet.beans.BaseTransformation | +--com.sas.servlet.beans.BaseCheckbox | +--com.sas.servlet.beans.html.Checkbox
Transformation bean for creating an HTML checkbox.
Problem: Create a document using JSP that contains a checkbox.
Solution: Write a Java scriptlet in a JSP page that uses the Checkbox Transformation Bean to create the HTML element.
JSP Page:
<html> <body> <p> This example shows a simple checkbox generated by the Checkbox Transformation Bean. </p> <FORM> <% // Create a new checkbox object com.sas.servlet.beans.CheckboxInterface checkbox = new com.sas.servlet.beans.html.Checkbox();
checkbox.setName("checkbox1"); checkbox.setSelected(true); checkbox.setValue("checked"); checkbox.setLabel("My new Checkbox"); checkbox.write(out); %> </FORM> </body> </html>
HTML output:
<html> <body> <p> This example shows a simple checkbox field generated by the Checkbox Transformation Bean. </p> <FORM> <INPUT TYPE=checkbox NAME="checkbox1" VALUE="checked" CHECKED> My new Checkbox </FORM> </body> </html>
Live element:
Constructor Summary | |
Checkbox()
Constructs a new Checkbox Transformation Bean |
|
Checkbox(String name)
Constructs a new Checkbox Transformation Bean |
|
Checkbox(String name,
String label)
Constructs a new Checkbox Transformation Bean |
|
Checkbox(String name,
String label,
boolean selected)
Constructs a new Checkbox Transformation Bean |
|
Checkbox(String name,
String label,
boolean selected,
String value)
Constructs a new Checkbox Transformation Bean |
Method Summary | |
void |
write(PrintWriter out)
Writes the transformed representation of the object |
Methods inherited from class com.sas.servlet.beans.BaseCheckbox |
getLabel,
getSelected,
getValue,
setLabel,
setSelected,
setValue |
Methods inherited from class com.sas.servlet.beans.BaseTransformation |
getCustomAttributes,
getDescription,
getName,
getParent,
getRequest,
getResponse,
setCustomAttributes,
setDescription,
setName,
setParent,
setRequest,
setResponse,
toString,
write,
write,
write |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Checkbox()
public Checkbox(String name)
name
- The checkbox namepublic Checkbox(String name, String label)
name
- The checkbox namelabel
- The initial text associated with an on checkboxpublic Checkbox(String name, String label, boolean selected)
name
- The checkbox namelabel
- The initial text associated with an on checkboxselected
- The initial state of the checkboxpublic Checkbox(String name, String label, boolean selected, String value)
name
- The checkbox namelabel
- The initial text to be displayed with the checkboxselected
- The initial state of the checkboxvalue
- The initial value associated with an on checkboxMethod Detail |
public void write(PrintWriter out) throws IOException
out
- The output stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |