I've just started looking at Struts and I would like to try and use it to 
build a simple web site.  I've managed to get the environment installed and 
working (I've installed the 12/15 build) and I've looked at the 
example.  However, I'm somewhat stumped as to how to proceed with my real 
world application.

For my simple application, I want to create a page which displays a table 
of information.  The contents of the table will vary depending on the value 
of an input parameter.  As an example of the sort of thing I'm doing, 
imagine an online brokerage firm which lets a user display his/her 
portfolio.  A user could have multiple portfolios and the user can display 
one at a time.  The user would select a particular portfolio name, and the 
next page would be a display of their portfolio, with items such as 
investment name, investment type, amount, purchase date, etc.

Looking at struts, it would seem that I would want to have some action page 
which gets invoked when the user selects a portfolio.  The URL might be 
something like this:

http://foo.bar.com/testapp/viewPortfolio.do?name="my portfolio"

I would define a subclass of action, whose "perform" method would get the 
portfolio name, do some processing and then forward things on to a display 
page with a line like this:

             ...
        return (mapping.findForward("success"));

The forward would be the "view" page for my results.  Is this the proper 
approach to take?  If so, I'm a little fuzzy on how to make the results of 
my perform method available to my view page.  Would I instantiate a new 
bean object and stuff it in the request object?  Would I then have a 
"useBean" line in my view page?  What I think I want to be able to do in my 
view, is to use the iterate tag to loop over the contents of my generated 
portfolio table.  I'm just a little unclear on all the mechanics involved 
in doing something like this.

Any help or examples that people could shed on this subject would be 
greatly appreciated.

Thanks.

Reply via email to