I also don't use <jsp:useBean />, but in this case, I would use
<stripes:useActionBean /> within a JSP tag file:

[optionsComponent.tag]

<stripes:useActionBean
  var="componentListBean"
  beanclass="ComponentListActionBean" />
<stripes:options-collection
  collection="${componentListBean.allComponents}"
  label="name" value="id"/>

You will have to create the new ComponentListActionBean, but this
saves you from defining the 'allComponent' property and its getter
in every action bean that needs to display the drop-down list.
And in any JSP in the webapp, you can use the tag without modifying
the main action bean:

<stripes:select name="bug.component.id">
<tags:optionsComponent />
</stripes:select>

--
Actually, there is no advantage of using <stripes:useActionBean />
over <jsp:useBean /> in the above example, but
<stripes:useActionBean /> allows you to

1) access session attributes or context resources in its logic.

2) reuse the same action bean for returning the same list in various
formats (json, xml, etc.) quite easily.

--
Another option is to use <jsp:include /> in the tag file, but it
will cause performance loss in the bulk edit page.

Regards,
Iwao


on 09/09/24 19:41 Freddy Daoud said the following:
> Hi Rusty,
> 
>> Some of the jsps use jsp:useBean to pull in beans from the service layer.
>> [...]
>> The way I've done it in the past would be to have a property on the
>> action bean, allComponents for example, with its getter, and to call
>> componentManager.allComponents() in the action bean to set the
>> allComponents property.
> 
> I agree. That's how I prefer to do this as well.
> 
> Personally, I try to avoid<jsp:useBean>  and I think<s:useActionBean>
> should be deprecated. I can't think of a situation where there isn't
> another (better) way to get things done than with<s:useActionBean>.
> If anyone has a good use case, please share.
> 
> Cheers,
> Freddy
> http://www.stripesbook.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to