You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Keith Pemberton <kb...@cox.net> on 2003/10/03 01:26:59 UTC

Design Question...

Sorry if this is a little off-topic but it has to do with Struts because I
am using struts for my web app.  I have been reading about the View Helper
pattern off the sun website and have two ways of thinking about implementing
this pattern.  First is the way that I currently have setup:

    Use an action to call a method on the Delegate.  The Delegate create a
JavaBean (Value Bean) that has the data that I need for the particular page
that I am trying to view.  The Action then sets that view in the session
scope (tried request scope, but it didn't work) and then forwards to a jsp.
The jsp then uses the java bean from the session scope to fill in data for
the webpage.

Now for the other way that I was thinking of:

    In the jsp page that I am trying to view, first create a new instance of
the JavaBean by calling <jsp:useBean> tag.  Then, use the JSTL tags to set
parameters that could be passed in from the url.  The JavaBean then does the
calling of the Delegate to get the information that it requires (potentially
in several method calls).  In the jsp, using jsp tags I call the getProperty
to get the information needed to fill in the data for the website.  In other
words, the getProperty invoke the JavaBean to call the Delegate to get the
information that is needed.

The way I see it, there is a trade-off between the two ways of doing this.
The first way does not allow (easily) for the adding of request parameters
to the url to change the view.  The second way, though, could potentially
involve many expensive RMI calles to the EJB Container, which is where I am
getting the data for the web pages.  I would appreciate any of your thoughts
as to how best to proceed.  Thanks in advance for all your suggestions!

Keith Pemberton


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org