It looks to me that you could use a combination of packages for each store with different namespaces, but to save code repetition it would be good idea to use wildcards (or go for the restful way as already suggested) in the config files and later on the action retrieve the full url to see which store the request comes from.

What helped me a lot to work with only some mappings (using wildcards) and only some actions is this book, listed in Struts2 docs, which is freely downloable: http://www.infoq.com/minibooks/starting-struts2

Alex

Em 08-03-2010 02:33, Cimballi escreveu:
John, I don't have immediate code that I can copy paste, but I can
explain a bit more the package solution.

You will have to declare 2 packages, one with namespace "store1" and
one with namespace "store2".
Then you can write a single action, which take a storeId paramter, and
you set the parameter statically in the action definitions.

You will need 2 action definitions, one in each package, calling the
same java action and setting the storeId parameter like said before.

Then, in each JSP for each store, you call the correct struts action.

Is it clear for you ?

Cimballi


On Sun, Mar 7, 2010 at 11:36 AM, john lee<sh_thorn_b...@yahoo.com>  wrote:



possible for you to show some psedo code for how to do it?

tks in advance

john
--- On Sun, 3/7/10, Paweł Wielgus<poulw...@gmail.com>  wrote:

From: Paweł Wielgus<poulw...@gmail.com>
Subject: Re: struts 2 - framework question
To: "Struts Users Mailing List"<user@struts.apache.org>, cimba...@cimballi.net
Date: Sunday, March 7, 2010, 1:59 AM

Hi All,
You can also have N applications representing stores under names store1..storeN,
where one application just knows about itself and all applications are
identical in code but different in data and css maybe.

Best greetings,
Paweł Wielgus.


2010/3/7 Cimballi<cimballi.cimba...@gmail.com>:
John, you can use namespaces at the package level to distinguish your stores.
You can also do that in a rest way, like http://www.xyz.com/store/1.

Cimballi


On Sat, Mar 6, 2010 at 11:18 PM, john lee<sh_thorn_b...@yahoo.com>  wrote:

my company is distributor, we plan to provide platform for our 
customer(different store) to sell their product to indivual customers.

http://www.xyz.om/store1
http://www.xyz.com/store2
http://www.xyz.com/store3
...
http://www.xyz.com/storeN

(store1...storeN) list our(distributor)'s product to their customer, when 
customer see the display price, the display price=our price(base 
price)+storeX's margin

my question is the following

a. in the struts.xml, different store should have different package defination ?

b. in the application, what is the struts2's method to detect which store? in 
other words, how can i detect which link(http://www.xyz.om/store1 or store2 or 
store3) is pass in ? without knowing which store is called, i can not call 
special routine(could be price cal, ...) associated with that store.

any good idea to approach this?

tks in advance

john




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



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



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



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

Reply via email to