|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts.action.ActionForm
org.apache.struts.action.DynaActionForm
org.apache.struts.validator.DynaValidatorForm
oracle.jheadstart.view.struts.JhsDynaActionForm
oracle.jheadstart.view.struts.DynaBeanReadOnly
This class extends JhsDynaActionForm
and allows you to
easily obtain data from the model layer, and display them
in your JSP pages using, for example, the <bean:write> tag.
The main advantage of this class is that you do not have to specify the bean and its form properties in the form-beans section in the Struts configuration file. This form-bean configuration information is required when you want to use the Struts facility to populate the bean from the Http Request. Since it is a readOnly bean, we do not need this functionality.
Because of the absence of form-bean configuration information, this class
can be instantiated within a JSP page using the old Struts 1.0 way: by
calling the default constructor. However, you typically want to enable
a DynaBeanReadOnly instance to read data from the model layer, which
it can then serve to the JSP page. This can be done by using one of the
JHeadstart actions to read data from the model layer, and setting the
"readOnlyBean" action mapping property for such an action. The action
will then create the DynaBeanReadOnly instance and set the DataObject or
DataObjectSet retrieved as a member of the instance. See action classes
GetDataObject
,
GetDataObjectSet
, GetSelectedObject
and
FindDataObjectSet
in package
oracle.jheadstart.controller.struts.action
for more information.
For additional developer convenience, this class implements the Iterator interface, so you can use <logic:iterate> directly on the bean to loop over the contents of the DataObjectSet encapsulated by the bean. Each DataObject instance returned within the <logic:iterate> is in turn wrapped as a new DynaBeanReadOnly instance so you can use <bean:write> within the loop to display the attribute values of each DataObject in the set.
Example usage in JSP Page:
.. <logic:iterate id="departmentBean" name="DepartmentSetBean" indexId="index" type="oracle.jheadstart.view.struts.DynaBeanReadOnly"> <tr> <td> <bean:write name="departmentBean" property='Deptno'/> </td> <td> <bean:write name="departmentBean" property='Dname'/> </td> </tr> </logic:iterate> ..
Field Summary | |
protected java.lang.String |
mName
|
Fields inherited from class oracle.jheadstart.view.struts.JhsDynaActionForm |
actionAttributes, iteratorRowIndex, mDataObject, mDataObjectSet, mInitialized, mMaxIndex, mPropertyConfigs, mSessionData, mValidationMode, tempRowIndex |
Fields inherited from class org.apache.struts.validator.DynaValidatorForm |
page, validatorResults |
Fields inherited from class org.apache.struts.action.DynaActionForm |
dynaClass, dynaValues |
Fields inherited from class org.apache.struts.action.ActionForm |
multipartRequestHandler, servlet |
Constructor Summary | |
DynaBeanReadOnly()
Default constructor. |
Method Summary | |
boolean |
contains(java.lang.String p0,
java.lang.String p1)
throws UnsupportedOperationException |
java.lang.Object |
get(java.lang.String attribute)
If a DataObject has been set on the bean (using setDataObject()), this method returns the value of an attribute of this DataObject by the name passed into this method. |
java.lang.Object |
get(java.lang.String attribute,
int index)
If a DataObjectSet has been set on the bean (using setDataObjectSet()), this method returns the value of the specified attribute name for the DataObject at the specified index within the set. |
org.apache.commons.beanutils.DynaClass |
getDynaClass()
Method required by DynaBean interface. |
boolean |
hasNext()
returns true if we are not yet at the last DataObject in the DataObjectSet. |
java.lang.Object |
next()
Get the next DataObject from the DataObjectSet encapsulated by this bean and wrap it as a new instance of DynaBeanReadOnly |
void |
remove()
bean is readOnly, throws UnsupportedOperationException. |
void |
remove(java.lang.String p0,
java.lang.String p1)
bean is readOnly, throws UnsupportedOperationException. |
void |
reset(org.apache.struts.action.ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
|
void |
set(java.lang.String p0,
int p1,
java.lang.Object p2)
bean is readOnly, throws UnsupportedOperationException |
void |
set(java.lang.String p0,
java.lang.Object p1)
bean is readOnly, throws UnsupportedOperationException |
void |
set(java.lang.String p0,
java.lang.String p1,
java.lang.Object p2)
bean is readOnly, throws UnsupportedOperationException |
void |
setName(java.lang.String name)
Set the name of the bean |
Methods inherited from class oracle.jheadstart.view.struts.JhsDynaActionForm |
createEmptyArrayList, createStringArray, createStringArray, get, get, getArray, getAttributeForDisplay, getAttributeForDisplay, getConvertedBeanValue, getMap, getMaxIndex, getMetaProperty, getSessionData, initProperties, initPropertyArrays, initPropertyConfigs, resetMaxIndex, setDataObject, setDataObjectSet, setIteratorRowIndex, setSessionData, setValidationMode, toString, validate |
Methods inherited from class org.apache.struts.validator.DynaValidatorForm |
getPage, getResultValueMap, getValidatorResults, log, log, setPage, setValidatorResults |
Methods inherited from class org.apache.struts.action.DynaActionForm |
get, getDynaProperty, initialize, isDynaAssignable, reset |
Methods inherited from class org.apache.struts.action.ActionForm |
getMultipartRequestHandler, getServlet, getServletWrapper, setMultipartRequestHandler, setServlet, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.beanutils.DynaBean |
get |
Field Detail |
protected java.lang.String mName
Constructor Detail |
public DynaBeanReadOnly()
Method Detail |
public boolean contains(java.lang.String p0, java.lang.String p1)
contains
in interface org.apache.commons.beanutils.DynaBean
public java.lang.Object get(java.lang.String attribute)
If a DataObjectSet has been set on the bean (using setDataObjectSet()), this method returns a string array of attribute values, one array entry for each DataObject in the set.
get
in interface org.apache.commons.beanutils.DynaBean
get
in class JhsDynaActionForm
public java.lang.Object get(java.lang.String attribute, int index)
get
in interface org.apache.commons.beanutils.DynaBean
get
in class JhsDynaActionForm
public org.apache.commons.beanutils.DynaClass getDynaClass()
getDynaClass
in interface org.apache.commons.beanutils.DynaBean
public void remove(java.lang.String p0, java.lang.String p1)
remove
in interface org.apache.commons.beanutils.DynaBean
public void set(java.lang.String p0, java.lang.Object p1)
set
in interface org.apache.commons.beanutils.DynaBean
set
in class JhsDynaActionForm
public void set(java.lang.String p0, int p1, java.lang.Object p2)
set
in interface org.apache.commons.beanutils.DynaBean
set
in class JhsDynaActionForm
public void set(java.lang.String p0, java.lang.String p1, java.lang.Object p2)
set
in interface org.apache.commons.beanutils.DynaBean
public void setName(java.lang.String name)
public boolean hasNext()
hasNext
in interface java.util.Iterator
hasNext
in class JhsDynaActionForm
public java.lang.Object next()
next
in interface java.util.Iterator
next
in class JhsDynaActionForm
public void remove()
remove
in interface java.util.Iterator
remove
in class JhsDynaActionForm
public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
reset
in class JhsDynaActionForm
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |