Hi Fabio,
> why this line of code works:
> <s:options-enumeration enum="buzzlabs.view.EnumHelpers.SiteType" />
>
> Trying to populate the Select field with a ENUM. Only works when I write
> the
> full qualified name on the enum="" field.
>
> while this one don't:
>
> <s:useActionBean beanclass="buzzlabs.view.EnumHelpers" id="EnumHelper" />
>
> <s:select name="">
> <s:option value="">
> <fmt:message key="filter.siteType"/>...
> </s:option>
> <s:options-enumeration enum="${EnumHelper.SiteType}" />
>
> Trying also to populate the Select field, but using the useActionBean tag
> like I did with a collection instead of a ENUM.
Because options-enumeration expects the fully qualified name of the
enum,
as a String, and NOT an actual instance of an Enum. Also, useActionBean
is for action beans, not Enums. Either way, you need to pass the name of
the enum. If you need to alias the name, you could use:
<c:set var="EnumHelper" value="buzzlabs.view.EnumHelpers.SiteType"/>
...
<s:options-enumeration enum="${EnumHelper}"/>
> While still this one works too!
>
> <s:useActionBean beanclass="buzzlabs.view.FormViewHelper"
> id="formHelper"/>
>
> <fmt:message key="filter.state"/>
> <s:select name="state">
> <s:option value="">
> <fmt:message key="filter.state"/>...
> </s:option>
> <s:options-collection collection="${formHelper.geoLocation}"
> value="id" label="estado"/>
> </s:select>
>
> Populating the select with a Collection works ok.
>
> But why?! can't understand it!
Because options-collection, unlike options-enum, expects an instance
of a collection, not the fully qualified name. So, in this example,
the getGeoLocation() method is called on the instance of the
FormViewHelper class, and the collection returned is used.
Hope that clears things up!
Cheers,
Freddy
http://www.stripesbook.com
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users