tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Aggarwal" <n...@JAMMConsulting.com>
Subject Best way to replace header and footer based on an affiliate ID?
Date Wed, 30 Apr 2008 20:47:24 GMT

I have a site developed using struts 2 with the tiles 2

I would like to use an affiliate-specific header and
footer on the pages if the user comes in from an
affiliate site.

I think I have found two ways so far to do this:

1. When users come into my site from an affiliate,
	make them to a new action path.

	For example, people come in to the site
	right now my a url such as 

	For an affiliate, they can come in using this

	In my struts.xml, I can have these actions:

      <action name="page/*">
        <result name="success" type="tiles">page.{1}</result>

      <action name="affName/*">
        <result name="success" type="tiles">affName.{1}</result>

	In my tiles.xml, I can have these defintions:

	<definition name="page.basic" template="/layout.jsp">
        <put-attribute name="header" value="/header.jsp" />
        <put-attribute name="footer" value="/footer.jsp" />
      <definition name="page.home" extends="page.basic">
        <put-attribute name="content" value="/home.jsp" />

	<definition name="page.affName" template="/layout.jsp">
        <put-attribute name="header" value="/affName/header.jsp" />
        <put-attribute name="footer" value="/affName/footer.jsp" />
      <definition name="affName.home" extends="page.affName">
        <put-attribute name="content" value="/home.jsp" />

2. Use a tiles controller to replace the header and footer
	attributes on the definition containing the layout.

	So, my tiles.xml would have:

	<definition name="page.basic" template="/layout.jsp"
        <put-attribute name="header" value="/header.jsp" />
        <put-attribute name="footer" value="/footer.jsp" />

	The LayoutController would check if the user came from
	and affiliate and if they did, set the header and footer
	attributes to the correct ones for the affiliate.

Does anyone have a suggestion for the best practices way to
do this?


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

View raw message