cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Hailstone" <matthew.hailst...@waterford.org>
Subject RE: Redirect in XSP
Date Wed, 12 Jun 2002 20:47:31 GMT
> > From: Matthew
> > 
Scenario:
	Homepage XSP generates an initial form.
	Parameters are set.
	I would like to then access my sub-sitemap URI space depending
on the parameter values.
	Ex.
	eval/first/first if parameter value is 1
	eval/second/second if parater value is 2

	Is this possible by doing the following?

From: Vadim
> 
> Matcher (RequestParameterMatcher.java):
>  
> <map:match type="request-parameter" pattern="myparametername">
>   <map:redirect-to session="false" uri="sub_root/{1}"/> </map:match>
> 
> 
> Selector (RequestParameterSelector.java):
> 
> <map:select type="request-parameter">
>   <map:parameter name="parameter-name" value="myparametername"/>
> 
>   <map:when test="parameter_value_1">
>     <map:redirect-to session="false" uri="sub_root/first/first"/>
>   </map:when>
>   <map:when test="parameter_value_2">
>     <map:redirect-to session="false" uri="sub_root/second/second"/>
>   </map:when>
> </map:select>
> 
> 
> PS see javadocs also
	http://xml.apache.org/cocoon/apidocs/

> > > -- You can and you should do this in the sitemap. Please use one
of 
> > > the matchers, ParameterMatcher is one which can help.

> Vadim
> 

Here is my latest try:

    <map:pipeline>
	...
      <map:select type="request-parameter">
        <map:parameter name="parameter-name" value="test-name"/>
        <map:when test="">
          <map:redirect-to session="true" uri="eval/home/form"/>
        </map:when>
        <map:when test="1">
          <map:redirect-to session="true" uri="eval/first/first"/>
        </map:when>
        <map:when test="2">
          <map:redirect-to session="true" uri="eval/second/second"/>
        </map:when>
	  <map:otherwise>
          <map:redirect-to session="true" uri="eval/home/form"/>
        </map:otherwise>
      </map:select>

      <map:match pattern="*/*">
        <map:generate type="serverpages" src="logic/{1}/{2}.xsp"/>
        <map:transform src="style/menupage.xsl">
          <map:parameter name="toc-file" value="../content/toc.xml"/>
          <map:parameter name="css-stylesheet" value="default.css"/>
          <map:parameter name="base-url" value="/cocoon/eval"/>
        </map:transform>
        <map:serialize/>
      </map:match>
	...
    </map:pipeline>

I get the following compile error:

org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling
sitemap_xmap:
Line 440, column 6:  Undefined variable: param
Line 441, column 6:  Undefined variable or class name: param
Line 444, column 46:  Undefined variable: param
Line 462, column 48:  Undefined variable: param
Line 0, column 0: 
Note: D:\apps\Apache Tomcat
4.0\work\localhost\cocoon\cocoon-files\org\apache\cocoon\www\eval\sitema
p_xmap.java uses or overrides a deprecated API.  Recompile with
"-deprecation" for details.
4 errors, 1 warning

	at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.cre
ateResource(ProgramGeneratorImpl.java:285)
	at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.loa
d(ProgramGeneratorImpl.java:196)
	at org.apache.cocoon.sitemap.Handler.run(Handler.java:228)
	at java.lang.Thread.run(Thread.java:484)

Any thoughts?

Thanks again.

Matthew

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