You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Neil Aggarwal <ne...@JAMMConsulting.com> on 2008/01/13 20:05:00 UTC

[S2] Best approach to separate look & feel with same backend code

Hello:

I am trying to figure out the best way to do this:

I have two domains.

I am going to develop two different web sites
which will use the same backend database and have 
the same functionality, just a different look and
feel.

Should I:

1. Create two separate webapps?  That seems poor
	since there will be a lot of duplicated code.

2. Create one webapp and pass around a site identifier?
	Then, I can load the correct set of JSPs based
	on the identifier?

Any suggestions for the best way to do this?

Thanks,
	Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


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


Re: [S2] Best approach to separate look & feel with same backend code

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Hi Neil,

The approach I use is to implement 
org.apache.tiles.definition.DefinitionsFactory and instruct Tiles to use 
your DefinitionsFactory

web.xml:
<context-param>
   <param-name>org.apache.tiles.definition.DefinitionsFactory</param-name>
  <param-value>myDefinitionsFactoryImpl</param-value>
</context-param>

The custom DefinitionsFactory implementation receives requests for a 
tile by name and can load an alternative tile or reads from an 
alternative set of tiles definitions whenever you wish.

I use it to load tiles-<theme>.xml files.  If a theme is enabled, it 
returns the themed tiles if found, otherwise it delegates to the default 
UrlDefinitionsFactory.  You could do the same thing using the hostname.

Incidentally, Sitemesh's DecoratorMapper's provide equivalent 
functionality (http://www.opensymphony.com/sitemesh/dm.html).  If you're 
just changing page decoration it may be less effort to use.

Hope that helps,
Jeromy Evans

Neil Aggarwal wrote:
> Scott:
>
> Great!  I will use tiles.
>
> I am confused about know to know which set of tiles
> to load.  The sites will have different domain names.
> Can I tell tiles to use a set based on that?
>
> Thanks,
> 	Neil
>
> --
> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details. 
>
>   
>> -----Original Message-----
>> From: stanlick@gmail.com [mailto:stanlick@gmail.com] 
>> Sent: Monday, January 14, 2008 6:21 AM
>> To: Struts Users Mailing List
>> Subject: Re: [S2] Best approach to separate look & feel with 
>> same backend code
>>
>> Then I would suggest Tiles.  This would be as easy as getting 
>> wet in a pond.
>>
>> Scott
>>
>> On Jan 13, 2008 9:01 PM, Neil Aggarwal 
>> <ne...@jammconsulting.com> wrote:
>>
>>     
>>> Rod:
>>>
>>> The functionality will be exactly the same for
>>> each site.
>>>
>>> How do I tell struts to load a given set of
>>> tiles based on the domain name?
>>>
>>> Thanks,
>>>        Neil
>>>
>>> --
>>> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
>>> Eliminate junk email and reclaim your inbox.
>>> Visit http://www.spammilter.com for details.
>>>
>>>       
>>>> -----Original Message-----
>>>> From: Rod Bollinger [mailto:techinfo@portablegenius.com]
>>>> Sent: Sunday, January 13, 2008 3:38 PM
>>>> To: 'Struts Users Mailing List'
>>>> Subject: RE: [S2] Best approach to separate look & feel with
>>>> same backend code
>>>>
>>>> Hi Neil,
>>>>
>>>> When you say Look and Feel are you referring to just the
>>>> visual aspects of
>>>> the site or are you referring to a marked difference in front-end
>>>> functionality?
>>>>
>>>> If you are not providing differing functionality or the
>>>> functionality being
>>>> provided is mostly similar to the current site, your best
>>>> approach will be
>>>> to use CSS to make one site look and feel different than the
>>>> other site.
>>>>
>>>> Additionally, if your current site is not already using
>>>> Tiles, you should
>>>> consider refactoring to add this flexibility. With a Tiles
>>>> and CSS-based
>>>> approach you can completely re-use your current middle and
>>>> back-end tiers
>>>> with little or no modification.
>>>>
>>>> You do not need a whole new set of JSPs, simply a flexible
>>>> view structure
>>>> and a well-defined view decoration strategy (Tiles and/or CSS
>>>> to modify
>>>> structure and CSS to modify the presentation).
>>>>
>>>> Lastly, if you are relying on certain behaviors (Javascript),
>>>> these should
>>>> be designed such that they are generic. As such they may be
>>>> applied to one
>>>> or more of your sites independent of the structure and
>>>> presentation of a
>>>> given site.
>>>>
>>>> The only reason you would need an entirely different set of
>>>> JSPs would be if
>>>> they were providing a completely different application of the
>>>> underlying
>>>> information (back-end). As there should be no business or
>>>> control logic in
>>>> your JSPs, I still would think about the above approach
>>>> before taking such
>>>> drastic measures as re-creating everything.
>>>>
>>>> HTH,
>>>> -Rod
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Neil Aggarwal [mailto:neil@JAMMConsulting.com]
>>>> Sent: Sunday, January 13, 2008 14:05
>>>> To: user@struts.apache.org
>>>> Subject: [S2] Best approach to separate look & feel with same
>>>> backend code
>>>>
>>>> Hello:
>>>>
>>>> I am trying to figure out the best way to do this:
>>>>
>>>> I have two domains.
>>>>
>>>> I am going to develop two different web sites
>>>> which will use the same backend database and have
>>>> the same functionality, just a different look and
>>>> feel.
>>>>
>>>> Should I:
>>>>
>>>> 1. Create two separate webapps?  That seems poor
>>>>       since there will be a lot of duplicated code.
>>>>
>>>> 2. Create one webapp and pass around a site identifier?
>>>>       Then, I can load the correct set of JSPs based
>>>>       on the identifier?
>>>>
>>>> Any suggestions for the best way to do this?
>>>>
>>>> Thanks,
>>>>       Neil
>>>>
>>>> --
>>>> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
>>>> Eliminate junk email and reclaim your inbox.
>>>> Visit http://www.spammilter.com for details.
>>>>
>>>>
>>>>
>>>>         
>> ---------------------------------------------------------------------
>>     
>>>> 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
>>>
>>>
>>>       
>> -- 
>> Scott
>> stanlick@gmail.com
>>
>>     
>
>
> ---------------------------------------------------------------------
> 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: [S2] Best approach to separate look & feel with same backend code

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Scott:

Great!  I will use tiles.

I am confused about know to know which set of tiles
to load.  The sites will have different domain names.
Can I tell tiles to use a set based on that?

Thanks,
	Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details. 

> -----Original Message-----
> From: stanlick@gmail.com [mailto:stanlick@gmail.com] 
> Sent: Monday, January 14, 2008 6:21 AM
> To: Struts Users Mailing List
> Subject: Re: [S2] Best approach to separate look & feel with 
> same backend code
> 
> Then I would suggest Tiles.  This would be as easy as getting 
> wet in a pond.
> 
> Scott
> 
> On Jan 13, 2008 9:01 PM, Neil Aggarwal 
> <ne...@jammconsulting.com> wrote:
> 
> > Rod:
> >
> > The functionality will be exactly the same for
> > each site.
> >
> > How do I tell struts to load a given set of
> > tiles based on the domain name?
> >
> > Thanks,
> >        Neil
> >
> > --
> > Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> > Eliminate junk email and reclaim your inbox.
> > Visit http://www.spammilter.com for details.
> >
> > > -----Original Message-----
> > > From: Rod Bollinger [mailto:techinfo@portablegenius.com]
> > > Sent: Sunday, January 13, 2008 3:38 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: [S2] Best approach to separate look & feel with
> > > same backend code
> > >
> > > Hi Neil,
> > >
> > > When you say Look and Feel are you referring to just the
> > > visual aspects of
> > > the site or are you referring to a marked difference in front-end
> > > functionality?
> > >
> > > If you are not providing differing functionality or the
> > > functionality being
> > > provided is mostly similar to the current site, your best
> > > approach will be
> > > to use CSS to make one site look and feel different than the
> > > other site.
> > >
> > > Additionally, if your current site is not already using
> > > Tiles, you should
> > > consider refactoring to add this flexibility. With a Tiles
> > > and CSS-based
> > > approach you can completely re-use your current middle and
> > > back-end tiers
> > > with little or no modification.
> > >
> > > You do not need a whole new set of JSPs, simply a flexible
> > > view structure
> > > and a well-defined view decoration strategy (Tiles and/or CSS
> > > to modify
> > > structure and CSS to modify the presentation).
> > >
> > > Lastly, if you are relying on certain behaviors (Javascript),
> > > these should
> > > be designed such that they are generic. As such they may be
> > > applied to one
> > > or more of your sites independent of the structure and
> > > presentation of a
> > > given site.
> > >
> > > The only reason you would need an entirely different set of
> > > JSPs would be if
> > > they were providing a completely different application of the
> > > underlying
> > > information (back-end). As there should be no business or
> > > control logic in
> > > your JSPs, I still would think about the above approach
> > > before taking such
> > > drastic measures as re-creating everything.
> > >
> > > HTH,
> > > -Rod
> > >
> > >
> > > -----Original Message-----
> > > From: Neil Aggarwal [mailto:neil@JAMMConsulting.com]
> > > Sent: Sunday, January 13, 2008 14:05
> > > To: user@struts.apache.org
> > > Subject: [S2] Best approach to separate look & feel with same
> > > backend code
> > >
> > > Hello:
> > >
> > > I am trying to figure out the best way to do this:
> > >
> > > I have two domains.
> > >
> > > I am going to develop two different web sites
> > > which will use the same backend database and have
> > > the same functionality, just a different look and
> > > feel.
> > >
> > > Should I:
> > >
> > > 1. Create two separate webapps?  That seems poor
> > >       since there will be a lot of duplicated code.
> > >
> > > 2. Create one webapp and pass around a site identifier?
> > >       Then, I can load the correct set of JSPs based
> > >       on the identifier?
> > >
> > > Any suggestions for the best way to do this?
> > >
> > > Thanks,
> > >       Neil
> > >
> > > --
> > > Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> > > Eliminate junk email and reclaim your inbox.
> > > Visit http://www.spammilter.com for details.
> > >
> > >
> > > 
> ---------------------------------------------------------------------
> > > 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
> >
> >
> 
> 
> -- 
> Scott
> stanlick@gmail.com
> 


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


Re: [S2] Best approach to separate look & feel with same backend code

Posted by st...@gmail.com.
Then I would suggest Tiles.  This would be as easy as getting wet in a pond.

Scott

On Jan 13, 2008 9:01 PM, Neil Aggarwal <ne...@jammconsulting.com> wrote:

> Rod:
>
> The functionality will be exactly the same for
> each site.
>
> How do I tell struts to load a given set of
> tiles based on the domain name?
>
> Thanks,
>        Neil
>
> --
> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details.
>
> > -----Original Message-----
> > From: Rod Bollinger [mailto:techinfo@portablegenius.com]
> > Sent: Sunday, January 13, 2008 3:38 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: [S2] Best approach to separate look & feel with
> > same backend code
> >
> > Hi Neil,
> >
> > When you say Look and Feel are you referring to just the
> > visual aspects of
> > the site or are you referring to a marked difference in front-end
> > functionality?
> >
> > If you are not providing differing functionality or the
> > functionality being
> > provided is mostly similar to the current site, your best
> > approach will be
> > to use CSS to make one site look and feel different than the
> > other site.
> >
> > Additionally, if your current site is not already using
> > Tiles, you should
> > consider refactoring to add this flexibility. With a Tiles
> > and CSS-based
> > approach you can completely re-use your current middle and
> > back-end tiers
> > with little or no modification.
> >
> > You do not need a whole new set of JSPs, simply a flexible
> > view structure
> > and a well-defined view decoration strategy (Tiles and/or CSS
> > to modify
> > structure and CSS to modify the presentation).
> >
> > Lastly, if you are relying on certain behaviors (Javascript),
> > these should
> > be designed such that they are generic. As such they may be
> > applied to one
> > or more of your sites independent of the structure and
> > presentation of a
> > given site.
> >
> > The only reason you would need an entirely different set of
> > JSPs would be if
> > they were providing a completely different application of the
> > underlying
> > information (back-end). As there should be no business or
> > control logic in
> > your JSPs, I still would think about the above approach
> > before taking such
> > drastic measures as re-creating everything.
> >
> > HTH,
> > -Rod
> >
> >
> > -----Original Message-----
> > From: Neil Aggarwal [mailto:neil@JAMMConsulting.com]
> > Sent: Sunday, January 13, 2008 14:05
> > To: user@struts.apache.org
> > Subject: [S2] Best approach to separate look & feel with same
> > backend code
> >
> > Hello:
> >
> > I am trying to figure out the best way to do this:
> >
> > I have two domains.
> >
> > I am going to develop two different web sites
> > which will use the same backend database and have
> > the same functionality, just a different look and
> > feel.
> >
> > Should I:
> >
> > 1. Create two separate webapps?  That seems poor
> >       since there will be a lot of duplicated code.
> >
> > 2. Create one webapp and pass around a site identifier?
> >       Then, I can load the correct set of JSPs based
> >       on the identifier?
> >
> > Any suggestions for the best way to do this?
> >
> > Thanks,
> >       Neil
> >
> > --
> > Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> > Eliminate junk email and reclaim your inbox.
> > Visit http://www.spammilter.com for details.
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>


-- 
Scott
stanlick@gmail.com

RE: [S2] Best approach to separate look & feel with same backend code

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Rod:

The functionality will be exactly the same for
each site.

How do I tell struts to load a given set of
tiles based on the domain name?

Thanks,
	Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details. 

> -----Original Message-----
> From: Rod Bollinger [mailto:techinfo@portablegenius.com] 
> Sent: Sunday, January 13, 2008 3:38 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [S2] Best approach to separate look & feel with 
> same backend code
> 
> Hi Neil,
> 
> When you say Look and Feel are you referring to just the 
> visual aspects of
> the site or are you referring to a marked difference in front-end
> functionality?
> 
> If you are not providing differing functionality or the 
> functionality being
> provided is mostly similar to the current site, your best 
> approach will be
> to use CSS to make one site look and feel different than the 
> other site. 
> 
> Additionally, if your current site is not already using 
> Tiles, you should
> consider refactoring to add this flexibility. With a Tiles 
> and CSS-based
> approach you can completely re-use your current middle and 
> back-end tiers
> with little or no modification.
> 
> You do not need a whole new set of JSPs, simply a flexible 
> view structure
> and a well-defined view decoration strategy (Tiles and/or CSS 
> to modify
> structure and CSS to modify the presentation). 
> 
> Lastly, if you are relying on certain behaviors (Javascript), 
> these should
> be designed such that they are generic. As such they may be 
> applied to one
> or more of your sites independent of the structure and 
> presentation of a
> given site.
> 
> The only reason you would need an entirely different set of 
> JSPs would be if
> they were providing a completely different application of the 
> underlying
> information (back-end). As there should be no business or 
> control logic in
> your JSPs, I still would think about the above approach 
> before taking such
> drastic measures as re-creating everything.
> 
> HTH,
> -Rod
> 
> 
> -----Original Message-----
> From: Neil Aggarwal [mailto:neil@JAMMConsulting.com] 
> Sent: Sunday, January 13, 2008 14:05
> To: user@struts.apache.org
> Subject: [S2] Best approach to separate look & feel with same 
> backend code
> 
> Hello:
> 
> I am trying to figure out the best way to do this:
> 
> I have two domains.
> 
> I am going to develop two different web sites
> which will use the same backend database and have 
> the same functionality, just a different look and
> feel.
> 
> Should I:
> 
> 1. Create two separate webapps?  That seems poor
> 	since there will be a lot of duplicated code.
> 
> 2. Create one webapp and pass around a site identifier?
> 	Then, I can load the correct set of JSPs based
> 	on the identifier?
> 
> Any suggestions for the best way to do this?
> 
> Thanks,
> 	Neil
> 
> --
> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details.
> 
> 
> ---------------------------------------------------------------------
> 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: [S2] Best approach to separate look & feel with same backend code

Posted by Antonio Petrelli <an...@gmail.com>.
2008/1/13, Rod Bollinger <te...@portablegenius.com>:
> Additionally, if your current site is not already using Tiles, you should
> consider refactoring to add this flexibility. With a Tiles and CSS-based
> approach you can completely re-use your current middle and back-end tiers
> with little or no modification.

And you can consider using Dimensions (there is an ongoing
implementation for Tiles 2):
http://mutidimensions.sourceforge.net/
Since it can help you creating a webapp that recognizes users/devices
to show different pages.

Antonio

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


RE: [S2] Best approach to separate look & feel with same backend code

Posted by Rod Bollinger <te...@portablegenius.com>.
Hi Neil,

When you say Look and Feel are you referring to just the visual aspects of
the site or are you referring to a marked difference in front-end
functionality?

If you are not providing differing functionality or the functionality being
provided is mostly similar to the current site, your best approach will be
to use CSS to make one site look and feel different than the other site. 

Additionally, if your current site is not already using Tiles, you should
consider refactoring to add this flexibility. With a Tiles and CSS-based
approach you can completely re-use your current middle and back-end tiers
with little or no modification.

You do not need a whole new set of JSPs, simply a flexible view structure
and a well-defined view decoration strategy (Tiles and/or CSS to modify
structure and CSS to modify the presentation). 

Lastly, if you are relying on certain behaviors (Javascript), these should
be designed such that they are generic. As such they may be applied to one
or more of your sites independent of the structure and presentation of a
given site.

The only reason you would need an entirely different set of JSPs would be if
they were providing a completely different application of the underlying
information (back-end). As there should be no business or control logic in
your JSPs, I still would think about the above approach before taking such
drastic measures as re-creating everything.

HTH,
-Rod


-----Original Message-----
From: Neil Aggarwal [mailto:neil@JAMMConsulting.com] 
Sent: Sunday, January 13, 2008 14:05
To: user@struts.apache.org
Subject: [S2] Best approach to separate look & feel with same backend code

Hello:

I am trying to figure out the best way to do this:

I have two domains.

I am going to develop two different web sites
which will use the same backend database and have 
the same functionality, just a different look and
feel.

Should I:

1. Create two separate webapps?  That seems poor
	since there will be a lot of duplicated code.

2. Create one webapp and pass around a site identifier?
	Then, I can load the correct set of JSPs based
	on the identifier?

Any suggestions for the best way to do this?

Thanks,
	Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


---------------------------------------------------------------------
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