Well, it appears that simple reuse like this isn't possible under JSF.

What would have been a five-minute task under WebObjects, and maybe a
five-hour task with Struts/Velocity became a 30-hour ordeal of
creating a custom composite component
(HtmlDataTable/UIColumn/UIColumns/UICommand) in JSF, and all of the
horrors of serialization/saveState/restoreState that it entailed.

And I still have to create a new jsp[x] page for every situation where
this page will be used in order to initialize it with my data.

It's starting to make me long for the days of chaining struts actions together.

On the other hand, now that my knowledge has increased, I could
probably reproduce it from scratch in only a few hours :)

I'd be willing to provide this as an example component for the
sourceforge "JSF components" project if there's interest.

It's an NxM DataTable that uses the following
RowAndColumnRelationshipDataModel interface as a datasource.  I use it
to providing a UI to many-to-many database join tables.   The only
non-standard dependency is for org.apache.myfaces.component.UIColumns.

It shows off some fun things like how to deal with saving and
restoring state, how to create indirect Value- and MethodBindings, and
how to initialize your component with dynamically-created data on
startup.

public interface RowAndColumnRelationshipDataModel
{
    String getRowCategoryName();
    String getColumnCategoryName();
    List getRowList();
    List getColumnList();
    String getColumnLabelFor(Object columnObject);
    String getRowLabelFor(Object rowObject);
    boolean getValueFor(Object rowObject, Object columnObject);
    void setValueFor(boolean newValue, Object rowObject, Object columnObject);
    void update();
}

-Mike


On 5/2/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
> I've got a "RowAndColumnRelationshipsPage.jspx" with an associated
> RowAndColumnRelationshipsPage backing bean.
> 
> I have a large number of row-and-column-based "data source" classes
> that implement a RowAndColumnRelationshipData interface which will
> provide the actual data displayed on the page.
> 
> However, I can't figure out a clean way to specify a particular source
> for data when navigating to my page.
> 
> For instance, I'd like to initialize the R&CRPage backing bean with an
> instance of class A when clicking on link A, an instance of class B
> when clicking on link B, an instance of class C when clicking on link
> C, etc.
> 
> I'm also using Spring if there's some sort of dependency-injection
> methodology that I've overlooked that I could use in this situation.
> 
> I'm hoping this is a case of overlooking the obvious.
> 
> Thanks for any suggestions,
> 
> -Mike
>

Reply via email to