|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface that must be implemented for all Transformation Beans. "Transformation Bean" is the name given to a Java component which consumes data from either a model or via property sets and transforms the data into a different representation that will be streamed to a client (or other consumer). A very common type of Transformation Bean will be one that consumes data from a webAF model (such as DataSetInterface) and represents the data in HTML (such as a TABLE).
Transformation Beans are intended to be used by servlet developers and JSP (Java ServerPages) writers.
The com.sas.servlet.beans package contains generic interfaces that define different types of beans. The final implementation will be language-specific, with the classes residing in a sub-package such as com.sas.servlet.beans.html. It is anticipated that languages other than HTML (such as XML, JavaScript, and DHTML) may implement the generic interfaces as well.
As an illustration consider the following JSP example (while this example is not complete, it should serve to demonstrate the use of a Transformation Bean)
Problem: Create a document using JSP that contains a drop-down list box (an HTML SELECT element) that allows the client to select a color.
Solution: Write a Java scriptlet in a JSP page that uses a SELECT Transformation Bean to create the HTML element. No knowledge of the underlying SELECT format is necessary. A collection of colors is created and used as a model to the Transformation Bean.
JSP Page:
<html> <head> <title>Select Bean</title> </head> <body> <p>This example shows a simple drop-down combo box generated by the Select bean.</p> <% // Create a new select object com.sas.servlet.beans.SelectInterface select = new com.sas.servlet.beans.html.Select();
// Create the model com.sas.collection.StringCollection model = new com.sas.collection.StringCollection(); model.add("Red"); model.add("Green"); model.add("Orange");
// Set the model select.setModelInterface(model);
// Output the select select.write(out); %> </body> </html>
HTML output:
<html> <head> <title>Select Bean</title> </head> <body> <p>This example shows a simple drop-down combo box generated by the Select bean.</p> <SELECT NAME="Select Box" SIZE=1> <OPTION VALUE="Red">Red <OPTION VALUE="Green">Green <OPTION VALUE="Orange">Orange </SELECT> </body> </html>
Live element:
Method Summary | |
String |
getCustomAttributes()
Gets the custom attributes |
String |
getDescription()
Gets the description that will be used to describe this bean to the user. |
String |
getName()
Gets the name that will be used to identify the content when it is submitted to the server |
Object |
getParent()
Gets the parent object, such as the servlet |
com.sas.servlet.beans.HttpServletRequest |
getRequest()
Gets the current request object. |
com.sas.servlet.beans.HttpServletResponse |
getResponse()
Gets the current response object. |
void |
setCustomAttributes(String value)
Sets any custom attributes. |
void |
setDescription(String value)
Sets the description that will be used to describe this bean to the user. |
void |
setName(String value)
Sets the name that will be used to identify the content when it is submitted to the server |
void |
setParent(Object parent)
Sets the parent object, such as the servlet. |
void |
setRequest(com.sas.servlet.beans.HttpServletRequest request)
Sets the request object. |
void |
setResponse(com.sas.servlet.beans.HttpServletResponse response)
Sets the response object. |
void |
write(com.sas.servlet.beans.HttpServletRequest req,
com.sas.servlet.beans.HttpServletResponse resp)
Writes the transformed representation of the object. |
void |
write(OutputStream out)
Writes the transformed representation of the object. |
void |
write(PrintWriter out)
Writes the transformed representation of the object. |
void |
write(Writer out)
Writes the transformed representation of the object. |
Methods inherited from interface com.sas.ViewInterface |
attachModel,
detachModel,
getModelInterface,
getRequiredInterfaces,
getViewInterfaceSupportInfo,
refresh,
removeInterfaceTraps,
setModelInterface,
setRequiredInterfaces,
setViewInterfaceSupportInfo,
supportsRequiredInterfaces,
trapInterfaceEvents |
Methods inherited from interface com.sas.ModelInterface |
attachView,
detachView |
Methods inherited from interface com.sas.LinkPropertiesInterface |
addLink,
getLinkInfo,
isLinked,
queryLinks,
queryLinks,
removeAllLinks,
removeLink,
setLinkInfo |
Methods inherited from interface java.beans.PropertyChangeListener |
propertyChange |
Methods inherited from interface java.io.ObjectInputValidation |
validateObject |
Method Detail |
public void setName(String value)
value
- The namepublic String getName()
public void setDescription(String value)
desc
- The descriptionpublic String getDescription()
public void write(PrintWriter out) throws IOException
out
- The output streampublic void write(com.sas.servlet.beans.HttpServletRequest req, com.sas.servlet.beans.HttpServletResponse resp) throws com.sas.servlet.beans.ServletException, IOException
req
- The request objectresp
- The response objectpublic void write(Writer out) throws IOException
out
- The output streampublic void write(OutputStream out) throws IOException
out
- The output streampublic void setParent(Object parent)
parent
- The parent objectpublic Object getParent()
public void setRequest(com.sas.servlet.beans.HttpServletRequest request)
request
- The request objectpublic com.sas.servlet.beans.HttpServletRequest getRequest()
public void setResponse(com.sas.servlet.beans.HttpServletResponse response)
response
- The response objectpublic com.sas.servlet.beans.HttpServletResponse getResponse()
public void setCustomAttributes(String value)
value
- The custom attributepublic String getCustomAttributes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |