An extension of the approach here is what we so with the Oracle ADF framework, namely that of associating a metadata XML file with the Action which drives the runtime framework to prepare the bindings for the page. So this is taking the whole declarative thing that much further by basically pushing all back end access into JSR 227 compliant data bindings.

Duncan

Frank W. Zammetti wrote:

More (application-level) code isn't needed... it's just a question of
making it declarative rather than programmatic, which is how so much of
Struts already is.

Here's an example from the example app posted to the Bugzilla ticket I
referenced (ticket # 33935 if you want to download it and try it)...

I wrote a class SetupClass1. It contains three methods, setupMethod1(),
setupMethod2() and setupMethod3() (I don't win any contests for creative
naming today!). Now... let's say that setupMethod1() reads from a
database and creates an ArrayList that is used to populate a dropdown. Let's further say that this dropdown is on a couple of pages in the app. Clearly it makes sense to have this "setup" code in a separate class.


Now, as you were saying, you could just use this class from the Actions
manually, that works fine, and plenty of people do that.  But, it's extra
code, and redundant code if used in more than one Action, even if the
redundant code amounts to:

SetupClass1.setupMethod1(request);

(assuming its a static method).

Instead, my proposal, and what I posted to Buzilla accomplishes this, is
to allow this:

<action path="/page1" type="com.omnytex.setupexample.action.TestAction">
 <forward name="defaultForward" path="/result.jsp">
   <setupItem setupClass="com.omnytex.setupexample.setups.SetupClass1"
setupMethod="setupMethod1" />
   </forward>
 </action>

So now, whenever that forward is returned the method will be executed.  It
is passed request, so it does whatever it does, presumably sticks the
ArrayList in request as per the example, and everything else goes on as
before.  It's just a declarative approach to the programmatic solution.

Now, the code I submitted allows you to put the <setupItem> element within
forwards as shown here (that's what I meant by at the forward-level).  You
can ALSO put it at the mapping level, and those items get executed BEFORE
execute() is called (as opposed to after, in the case of the forward-level
elements).  In addition, you can add <setupItem>s to global forwards just
the same.




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



Reply via email to