You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Karr, David" <da...@attws.com> on 2002/08/29 17:01:59 UTC

RE: [Newbie] Where to put Model Access whenever Action class is not an option?

> -----Original Message-----
> From: Rademacher Tobias [mailto:Tobias.Rademacher@grob.de]
> Sent: Wednesday, August 28, 2002 10:15 PM
> To: 'struts-user@jakarta.apache.org'
> Subject: [Newbie] Where to put Model Access whenever Action 
> class is not
> an option?
> 
> Hi Folks,
> 
> first of all I'm a newbie to Struts. As far as I can see it's a great
> framework. Thx for that a lot.
> 
> My Problem is that my JSP-Views needs some inital data from 
> the models.
> Consider some <select>-boxes given the
> user a chance make their choices....
> 
> Where can I init the FromBeans that are use to share data 
> between Action
> class/View? The constructor of
> the class? As far as I understand the Struts delegates form 
> View to Action
> using the FormBean and ActionMappings.
> So Action is always the end of the request chain  (view

The answer is pretty simple.  You make sure an Action is set up to populate
a view.  The one page you can't directly do this for is the initial page of
the application.  To alleviate this, your initial page always looks
something like this:

----index.jsp---------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<logic:forward name="main"/>
----index.jsp---------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>