cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Pietschmann" <dev.sen...@gmail.com>
Subject AW: Accessing BrowserSelector results from an Action
Date Fri, 01 Apr 2005 11:52:06 GMT
> 
> Hi Stefan,
> 
> On Mar 31, 2005, at 11:19 AM, Stefan Pietschmann wrote:
> 
> > At the moment I'm using the selector in the sitemap, to tell my action
> > which
> > browser is currently requesting:
> >
> > <map:select type="browser">
> > 	<map:when test="desktop">
> > 		<map:act type="updateModel">
> > 			<map:parameter name="format" value="xHTML"/>
> > 		</map:act>
> > 	</map:when>
> > 	<map:when test="pocketcolor">
> > 		<map:act type="updateModel">
> > 			<map:parameter name="format" value="cHTML"/>
> > 		</map:act>
> > 	</map:when>
> > 	<map:when test="pocket">
> > 		<map:act type="updateModel">
> > 			<map:parameter name="format" value="cHTML"/>
> > 		</map:act>
> > 	</map:when>
> > 	[...]
> > </map:select>
> >
> > Well, instead of passing a different parameter value for each case it
> > would
> > be much easier for me if I could save this map:select, just specify my
> > action once and somehow access the BrowserSelector value from within my
> > Action.
> >
> > How can I access the values the BrowserSelector has chosen?
> 
> Well, the whole point of a Selector is to have multiple branches.  If
> that's not what you want, then you don't want a selector :-)


Hehe, I know, but this is not the only point we're using the selector, so
it's needed nonetheless ;)

> Try this... make sure you have the following in your cocoon.xconf:
> 
> 	<component-instance
> 
> class="org.apache.cocoon.components.modules.input.HeaderAttributeModule"
> 		 	name="header"
> 		/>
> 
> Then, in your sitemap:
> 
> 	<act type="updateModel">
> 		<parameter name="format" value="{header:User-Agent}" />
> 	</act>


Great, i'm gonna try this. 

Thanx a lot.

> HTH,
> -ml-


Mime
View raw message