struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emil thushanga <thusha...@gmail.com>
Subject Re: struts 2 - framework question
Date Tue, 09 Mar 2010 05:53:50 GMT
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_thorn_bird@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 <thushanga@gmail.com> wrote:
>
>
> From: emil thushanga <thushanga@gmail.com>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <user@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
> <alopez@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_thorn_bird@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<poulwiel@gmail.com>  wrote:
>>>>
>>>> From: Paweł Wielgus<poulwiel@gmail.com>
>>>> Subject: Re: struts 2 - framework question
>>>> To: "Struts Users Mailing List"<user@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<cimballi.cimballi@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_bird@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


Mime
View raw message