cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Comte" <laur...@oodrive.fr>
Subject Using a RequestAttributeSelector
Date Fri, 14 Feb 2003 18:48:19 GMT
I would like to :

1/ use a servlet (servDoSomething) as a generator to generate some XML data.

2/ depending of what happened in step 1 (everything was fine or some error
   happened), I would like to set a "nextpage" attribute to say where should
   we go next :

	request.setAttribute("nextpage", "ok")
	or
	request.setAttribute("nextpage", "error")

3/ in the pipeline, I want to select the good stylesheet depending of this
   attribute. So I tried to use the RequestAttributeSelector, because i've
put
   the attribute "nextpage" in the request.



BUT, it seems that the request read by the selector is the original one (or
something like this), and my attribute is never found ...
I used the logger of the RequestAttributeSelector and it says :

"RequestAttributeSelector: Request attribute 'nextpage' not set -- failing"


So, i'de like to find a good way to select my transformer at runtime,
depending
of the result of the generator-servlet.

We can say : using a kind of "Controller" to choose the right "View",
depending
of the result of an action in the "Model".

Any ideas ?

Laurent.


============================================================================

Cocoon 2.0.4 ; J2SE 1.4.1 ; Tomcat 4.1.18 ; Win2000 SP3


<map:selector logger="sitemap.selector.request-attribute"
 	name="request-attribute"
src="org.apache.cocoon.selection.RequestAttributeSelector">
 <attribute-name>nextpage</attribute-name>
</map:selector>


<map:pipeline match="someUrl">
    <map:generate src="http://localhost:8080/web/servDoSomething" />

    <map:select type="request-attribute">
	<map:when test="ok">
	     <map:transform src="a_first_stylesheet.xsl" />
	</map:when>
	<map:otherwise>
		<map:transform src="a_second_stylesheet.xsl" />
	</map:otherwise>
    </map:select>
      <map:serialize />
</map:pipeline>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message