cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: Accessing BrowserSelector results from an Action
Date Thu, 31 Mar 2005 20:01:30 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 :-)

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>

HTH,
—ml—


Mime
View raw message