You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2010/03/07 05:18:35 UTC

struts 2 - framework question

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


      

Re: struts 2 - framework question

Posted by Cimballi <ci...@gmail.com>.
Something like that :
Declare the interceptor unless you use default Struts stacks
<interceptor name="staticParams"
        class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"
/>

Declare the static param :
<action name="action" class="aClass">
<param name="foo">value</param>

And in the action you need a setFoo(String)

Cimballi


On Mon, Mar 8, 2010 at 10:40 PM, john lee <sh...@yahoo.com> wrote:
> Cimballi,
>
> tks for your help, but i do not  quite understand about '...set the parameter statically in the action definitions...',  would you demonstrate me couple line of psudo code to explain this?
>
> tks in advance
>
> john
>
>
>
> /7/10, Cimballi <ci...@cimballi.net> wrote:
>
>
> From: Cimballi <ci...@cimballi.net>
> Subject: Re: struts 2 - framework question
> To: "john lee" <sh...@yahoo.com>
> Cc: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Sunday, March 7, 2010, 8:33 PM
>
>
> 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...@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 <po...@gmail.com> wrote:
>>
>> From: Paweł Wielgus <po...@gmail.com>
>> Subject: Re: struts 2 - framework question
>> To: "Struts Users Mailing List" <us...@struts.apache.org>, cimballi@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 <ci...@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...@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-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>

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


Re: struts 2 - framework question

Posted by emil thushanga <th...@gmail.com>.
i am not sure , whether this will helpful to you anyway i have done
something as following,

<package namespace="/antigua" name="myPackage2" extends="struts-default">

        <interceptors>
            <interceptor name="antiguainter"
class="AntiguaRegionInterceptor"></interceptor>
            <interceptor-stack name="antiguaStack">
                <interceptor-ref name="createSession"/>
                <interceptor-ref name="antiguainter" />
                <interceptor-ref name="defaultStack" />
            </interceptor-stack>

        </interceptors>

        <default-interceptor-ref name="antiguaStack"></default-interceptor-ref>
.
.
.

</package>

<package namespace="/barbados" name="myPackage1" extends="struts-default">


        <interceptors>
            <interceptor name="barbadosinter"
class="BarbadosRegionInterceptor"></interceptor>
            <interceptor-stack name="barbadosStack">
                <interceptor-ref name="createSession"/>
                <interceptor-ref name="barbadosinter" />
                <interceptor-ref name="defaultStack" />
            </interceptor-stack>
        </interceptors>

        <default-interceptor-ref name="barbadosStack"></default-interceptor-ref>
.
.
.

</package>


Emil

On Tue, Mar 9, 2010 at 9:46 AM, john lee <sh...@yahoo.com> wrote:
> possible for you to show me the psudo code for how to do it?
>
> tks in advance
>
> john
>
> --- On Mon, 3/8/10, emil thushanga <th...@gmail.com> wrote:
>
>
> From: emil thushanga <th...@gmail.com>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Monday, March 8, 2010, 3:39 AM
>
>
> Hi ,
>
> You can define interceptors for each namespace.
>
> Emil
>
> On Mon, Mar 8, 2010 at 3:19 PM, Alex Rodriguez Lopez
> <al...@flordeutopia.pt> wrote:
>> 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...@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<po...@gmail.com>  wrote:
>>>>
>>>> From: Paweł Wielgus<po...@gmail.com>
>>>> Subject: Re: struts 2 - framework question
>>>> To: "Struts Users Mailing List"<us...@struts.apache.org>,
>>>> cimballi@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<ci...@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...@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-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> Emil Thushanga
> (Lets say i am Programmer/Developer)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>



-- 
Emil Thushanga
(Lets say i am Programmer/Developer)

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


Re: struts 2 - framework question

Posted by john lee <sh...@yahoo.com>.
possible for you to show me the psudo code for how to do it?
 
tks in advance
 
john

--- On Mon, 3/8/10, emil thushanga <th...@gmail.com> wrote:


From: emil thushanga <th...@gmail.com>
Subject: Re: struts 2 - framework question
To: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Monday, March 8, 2010, 3:39 AM


Hi ,

You can define interceptors for each namespace.

Emil

On Mon, Mar 8, 2010 at 3:19 PM, Alex Rodriguez Lopez
<al...@flordeutopia.pt> wrote:
> 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...@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<po...@gmail.com>  wrote:
>>>
>>> From: Paweł Wielgus<po...@gmail.com>
>>> Subject: Re: struts 2 - framework question
>>> To: "Struts Users Mailing List"<us...@struts.apache.org>,
>>> cimballi@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<ci...@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...@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Emil Thushanga
(Lets say i am Programmer/Developer)

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




      

Re: struts 2 - framework question

Posted by emil thushanga <th...@gmail.com>.
Hi ,

You can define interceptors for each namespace.

Emil

On Mon, Mar 8, 2010 at 3:19 PM, Alex Rodriguez Lopez
<al...@flordeutopia.pt> wrote:
> 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...@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<po...@gmail.com>  wrote:
>>>
>>> From: Paweł Wielgus<po...@gmail.com>
>>> Subject: Re: struts 2 - framework question
>>> To: "Struts Users Mailing List"<us...@struts.apache.org>,
>>> cimballi@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<ci...@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...@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Emil Thushanga
(Lets say i am Programmer/Developer)

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


Re: struts 2 - framework question

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
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...@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<po...@gmail.com>  wrote:
>>
>> From: Paweł Wielgus<po...@gmail.com>
>> Subject: Re: struts 2 - framework question
>> To: "Struts Users Mailing List"<us...@struts.apache.org>, cimballi@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<ci...@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...@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-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: struts 2 - framework question

Posted by john lee <sh...@yahoo.com>.
Cimballi,
 
tks for your help, but i do not  quite understand about '...set the parameter statically in the action definitions...',  would you demonstrate me couple line of psudo code to explain this?
 
tks in advance
 
john



/7/10, Cimballi <ci...@cimballi.net> wrote:


From: Cimballi <ci...@cimballi.net>
Subject: Re: struts 2 - framework question
To: "john lee" <sh...@yahoo.com>
Cc: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Sunday, March 7, 2010, 8:33 PM


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...@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 <po...@gmail.com> wrote:
>
> From: Paweł Wielgus <po...@gmail.com>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <us...@struts.apache.org>, cimballi@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 <ci...@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...@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-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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




      

Re: struts 2 - framework question

Posted by Cimballi <ci...@cimballi.net>.
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...@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 <po...@gmail.com> wrote:
>
> From: Paweł Wielgus <po...@gmail.com>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <us...@struts.apache.org>, cimballi@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 <ci...@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...@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-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: struts 2 - framework question

Posted by john lee <sh...@yahoo.com>.
 
 
possible for you to show some psedo code for how to do it?
 
tks in advance 

 
john

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


From: Paweł Wielgus <po...@gmail.com>
Subject: Re: struts 2 - framework question
To: "Struts Users Mailing List" <us...@struts.apache.org>, cimballi@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 <ci...@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...@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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




      

Re: struts 2 - framework question

Posted by Paweł Wielgus <po...@gmail.com>.
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 <ci...@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...@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: struts 2 - framework question

Posted by Cimballi <ci...@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...@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts 2 - framework question

Posted by john lee <sh...@yahoo.com>.
how apache/struts 2 handle multiple domain as your explain? could you explain in some detail? tks in advance
 
john 

--- On Mon, 3/8/10, stanlick@gmail.com <st...@gmail.com> wrote:


From: stanlick@gmail.com <st...@gmail.com>
Subject: Re: struts 2 - framework question
To: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Monday, March 8, 2010, 6:51 AM


If each company will have their own domain name this will solve itself.

On Sat, Mar 6, 2010 at 10:18 PM, john lee <sh...@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
>
>
>



      

Re: struts 2 - framework question

Posted by st...@gmail.com.
If each company will have their own domain name this will solve itself.

On Sat, Mar 6, 2010 at 10:18 PM, john lee <sh...@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
>
>
>