One possible way to do this would be to specify two instances of the
actionservlet in the web.xml each pointing at it's own version of
struts-config.xml.

The content of the xml will essentially be the same and will call the same
actions except that the formbean definitions would be different (you would
specify the concrete imps of the abstract class you talk about).  You would
then apply different extension mappings in the web.xml to differentiate the
two instances of action servlet (or your own subclass that specifies extra
initialisations etc) i.e:

instead of "action.do" in the url

"action.as" or action.ora" where each mapping runs the request through the
correct ActionServlet instance which will have access to it's own
struts-config specifying it's own version of the form which extends from the
your abstract form.

essentially you end up running two applications/websites with their own
configs but pointing at the same java code.

We've done a very similar thing for a webapp that has different
implementations for clients and decides at runtime which concrete business
logic implementations (specified in a custom xml descriptor) to use. the
actions simply call interface methods, soi they never actually know which
implementation they're dealing with, they just retreive it from a factory
which reads the descriptor .  I.e. the same actions for everyone but
potentially completely different business logic processing determined at
runtime.

Hope this gives a few ideas if it doesn't provide a solution.

Jin
----- Original Message -----
From: "Alex Colic" <[EMAIL PROTECTED]>
To: "Struts" <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 2:20 PM
Subject: Struts design advice requested please.


> Hi,
>
> I have been using Struts now for about a year and I really like it. It has
> saved me a lot of time and made my apps quite stable. I have just been
> placed on another large struts project. It will be pushing struts to the
> limit. A quick question on design. What I am going to do is a bit
difficult
> to explain. This app is going to be used by users to input inventory data
> into two different databases, an AS400 and an Oracle/SQL database. The
user
> will enter essentially the same type of inventory data into each system,
> but, there are differences between the two. Part of the project plan is
that
> through a config switch, parameter etc, I will be telling struts if we are
> working with an AS400 system or an Oracle/SQL system and then the guy will
> slightly change, just the addition or deletion of a gui element.
>
> Example of required elements entered by the users in a form.
>
> AS400 ORACLE/SQL
> employeeID employeeID
> storeroom storeroom
> location location
> location type
> bin Number
>
> My question revolves around the form bean.
>
> I though about making a form bean that includes all the properties that
are
> required by the Inventory object for the AS400 and the ORACLE/SQL system.
> This would make one large generic form bean.
>
> Then I thought about making an abstract class that includes all the common
> elements amongst the object and from there I would extend and create an
> AS400 inventory form or an Oracle/SQL inventory form. If I go this way
then
> how do I set up the Struts.xml file to use the specific inventory form, if
> it could be one of two?
>
> I hope what I am trying to convey is making sense. Depending on a config
> setting I think I should be using  one of two form beans, not known until
> run time.
>
> Any help in setting up the above is appreciated.
>
> Alex
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>

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

Reply via email to