You have to make sure that your event getter (on SwitchEventActionBean)
returns the current project. You can do this in a before method (a method
that's marked with @Before) or in a pre-action, if you have any.
Regards,
Levi
On Sat, Feb 14, 2009 at 4:16 PM, Eric Palmitesta <[email protected]>wrote:
> Users have Projects, and can view one at a time.
>
> class User { Set<Project> projects; Project current; }
> class Project { String name; }
>
> My BaseActionBean has methods to retrieve the currently logged in
> User, and the Project they're currently viewing:
>
> User getCurrentUser() { ... }
> Project getCurrentProject() { ... }
>
> I want a select box which lists all the Projects the currently logged
> in User has, with a Swtich button which submits to a
> SwitchEventActionBean, which does the work of switching to the newly
> selected event.
>
> <s:form beanclass="blah.action.SwitchEventActionBean">
> <s:select name="event">
> <s:options-collection
> collection="${actionBean.currentUser.projects}" label="name" />
> </s:select>
> <s:submit name="switch" value="switch" />
> </s:form>
>
> This does everything properly, thanks to stripersist. That's the
> setup for my question.
>
> How do I pre-select the Project a User is currently viewing in that
> select box? No javascript.
>
> Putting a selected="true" attribute in the options-collection tag
> yields "Attribute selected invalid for tag options-collection
> according to TLD", even though the tag lib docs say "All other
> attributes on the tag (other than collection, value, label and group)
> are passed directly directly through to the stripes:option tag which
> is used to generate the individual HTML options tags", so that's
> unexpected.
>
> Suggestions?
>
> Cheers,
>
> Eric
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users