From: "Lim Hock-Chai" <[EMAIL PROTECTED]>

I get the following error when trying to use el to assign value to
collection attribute in struts's
html:options:
javax.servlet.ServletException: Cannot find bean under
name ...

However, it work when I do the following:
1) save the attrColorDTOList to a session:
session.setAttribute("attrColorDTOList"
jspHelper.getAttrList().getAttrColorDTOList())

2) In jsp:
<html:select property="color" >
  <html:options collection="attrColorDTOList"  property="ID"
labelProperty="shortDesc"/>
</html:select>

As you've discovered, the 'collection' attribute is the _name_ of the
collection, not the collection itself:

http://struts.apache.org/userGuide/struts-html.html#options

"The collection attribute is interpreted as the name of a JSP bean, in some
scope, that itself represents a collection of individual beans, one per
option value to be rendered."

If you can't get <html:options> to cooperate, scroll down the page and look
at <html:optionsCollection>. Sometimes it's easier to figure out what to use for each attribute with that one.

--
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to