The Struts answer to both of these questions is "use an Action". The Action
classes are where the various pieces come together.

In the first case, your action will invoke methods on business-logic objects
and populate the form with the results. Then it will forward to the
appropriate JSP page to display those results.

In the second case, the search criteria will be presented to an action as a
form bean. The action will then pass this data to business-logic objects,
which will perform the search and return the results. After performing any
transformations necessary to make the results more easily digested by a JSP
page, the action once again forwards to an appropriate JSP to display them.

Take a good look at the example application that comes with Struts, and Ted
Husted's "Strut by Strut" article at:

http://www.husted.com/about/struts/strutByStrut.htm

for more details on how it all works.

--
Martin Cooper


----- Original Message -----
From: "Prior, Simon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 06, 2001 2:02 AM
Subject: Staging Pages/Action form question.


> Hi Guys,
>
> I have the following scenarios and to design for and wanted to know how
you
> approached the following problems:
>
> 1.  I have a page that will have dynamically generated menus populated
with
> entries from a database.  My first question is how do you stage the
pages? -
> can you use the action form to retrieve the information to populate the
> menus from the database ?  I was thinking of using the action forms
> constructor to call an ejb to ultimately retrieve the information but
didn't
> know whether this was the best way of approaching the problem.
>
> Do you guys have any suggestions?
>
> 2.  I also have a search page where the user enters the search criteria
and
> then submits the query, at this point I was going to put the search
criteria
> on the session and have the results page pick up the search criteria,
carry
> out the search and then display the results.  How do you guys do this?  If
I
> was to use an action form for this in a manner similar to the above
scenario
> the constructor would retrieve the search criteria from the session and
> execute the query thus 'staging' the page.  Can the action form access the
> session?  If not, how do you guys do it?
>
> Any help would be most appreciated.
>
> Thanks in advance,
>
> Simon.
> For optimum solutions that save you time, visit www.ds-s.com.
>


Reply via email to