I don't have all the answers, but I am sure other
people will elaborate in more detail.

> I know that I need a form bean to handle getting the
> form values to the
> class to fetch the headlines, but my questions are:
> 
> 1.  How do I populate it the *first* time a user
> visits the page (before any
> form is filled out).  Do I just make the form bean's
> default value for
> URL="http://www.foo.com/headlines"; and the default
> value for numHeadlines=10
> ?
> 
I would do this in the perform() method for the
action.  So:

formbean.setURL("");
formbean.setNumHeadlines(10);

You would have to ensure that the user access the page
through a .do url and have the servlet mapping for
ActionServlet map to this .do url.

> 2.  I simplified the work behind the SOAP call to
> explain my point, but do I
> put the actual code (about 20 lines) for making the
> call into the
> ActionClass?  Or do I put it into the FormBean
> somehow?  Or somewhere else? 
> Should the code that catches and handles exceptions
> go there too?
> 

I would put the code in the action class' perform()
method.  I would handle the exceptions here as well. 
Thin client prevails and no business logic should go
in the formbean.

The only thing that I am thinking is: Is this "UI
Logic" or "Business Logic".  If it is UI Logic than
you could potentially use a custom tag to display the
results of what is stored in the formbean.  If it is
business logic, than you would store the results of
fetching the data in the formbean and then show the
results using an iterator on the ui.  I would attempt
the former.
> 3.  How do I make the Headlines object available to
> the JSP page?  As a bean
> put into session scope?
> 
Try not to put anything in the session scope unless it
is entirely necessary.  Place it in the request.
> 4.  Should the URL that I advertise to users be
> /index.jsp or should it
> match the action, like /showArticles.do ?  I know
> it's a best practice to
> use /do/ rather than *.do, but I want to keep it
> simple for the moment.
> 
It is relatively simple to map to *.do.  Some people
(check out Ted Husted's site) mention that mapping
should be a little different than that:

http://husted.com/about/scaffolding/catalog.htm


> 5.  What might the struts-config.xml look like for
> this type of action?
> 
> Thanks *very* much for any help you can give.  After
> I finish this example
> app, I plan to make it (and the source) available
> for others to look at for
> guidance.
> 
> Tom



__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to