Hi: In many cases, there has a iterate or arraylist in the Form Bean which contents a bean list. In original functions, we have to define a bean and call get property from form bean to receive a iterate. Then call html:options tag to assign the collection = "var xxxxList" property = "xxxx" to display the options. The source code like : <bean:define id="mxxxList" property="agetterproperty" /> ... <html:options collection="mxxxList" property="xxxxproperty" />
I had amend a little the function getIterate method of html:options tag to
search iterate from form bean property by collection name if the collection
not found in pagecontext. By this, the source code will be more sample as:
<html:options collection="xxxxList" property = "xxxxproperty" />
The xxxxList is the getter property of form bean which will return a
iterate/array/map.
xxxxproperty is the getter property of bean which is in the iterate.
Attached is a the source code of new options java file. The only changes is
add a check whether the name param of getIterate is form bean. If it's not
form bean, will call getter property from form bean to lookup wheter there
has a getter method (getCollection) exist in form bean.
Object bean = pageContext.findAttribute(beanName);
if (bean == null)
{
if(beanName.equals(Constants.BEAN_KEY))
{
throw new JspException
(messages.getMessage("getter.bean", beanName));
} else
{
return getIterator(null, name);
}
}
Regards
Shihong, NCS(Suzhou)
hkeOptionsTag.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
