cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jantje <janvanop...@skynet.be>
Subject Passing parameter from sitemap to .xsp - everything failes - help needed
Date Tue, 12 Sep 2006 12:52:16 GMT

Hi there, after searching a lot of information.. (finding a lot of solutions
- but none of them worked).. I will post my question here:

The file hello.xsp:
<?xml version="1.0"?>

<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp">

  <xsp:structure>
    <xsp:include>java.util.*</xsp:include>
    <xsp:include>be.incGEO.*</xsp:include>
    <xsp:include>com.db4o.*</xsp:include>
  </xsp:structure>

  <xsp:logic>
    Employee emp = new Employee();
    Date bdate = new Date();
    ObjectContainer db = null;
    String jan = this.parameters.getParameter("habibi", null);
  </xsp:logic>
  <page>
    <title>Hello <xsp:expr>this.parameters.getParameter("habibi",
null)</xsp:expr></title>
  </page>

</xsp:page>

The file sitemap.xmap:
<?xml version="1.0"?>

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  <map:pipelines>
    <map:pipeline>
      <map:match pattern="java/*">
        <map:generate src="java/{1}.xsp" type="serverpages">
          <map:parameter name="habibi" value="mylove"/>
	</map:generate>
        <map:transform
src="context://samples/stylesheets/dynamic-page2html.xsl">
          <map:parameter name="servletPath" value="{request:servletPath}"/>
          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
          <map:parameter name="contextPath" value="{request:contextPath}"/>
          <map:parameter name="file" value="xsp/{1}.xsp"/>
          <map:parameter name="remove" value="{0}"/>
        </map:transform>
        <map:serialize/>
      </map:match>
    </map:pipeline>
  </map:pipelines>
</map:sitemap>

I have made the code very simple, but is works!

In the <title></title> (file: hello.xsp) tags, I can get the sitemap
parameter "habibi".. OK, nice!

But, and this is the problem, in <xsp:logic></xsp:logic> I can not reach the
sitemap parameter "habibi"

At this point, (with the code above) I get this error:
  java.lang.NullPointerException:
This is when I uncomment:
  //String word = this.parameters.getParameter("habibi", null);
So I do not know what to do?

Yhings I have tryed:
  <xsp:logic>
    //passing it as ?name="john" -> request.getParameter failed also!
    //String word=request.getParameter("name");

    //This fails:
    //String lang= parameters.getParameter("identification", ((String)
parameters.getParameter("identification",""));

    //fails:
    //String lang= parameters.getParameter("identification", null);

    /*fails:
    try {
      String identification = parameters.getParameter("identification",
null);
    } catch (ParameterException e) {
        // parameter not found - no error
      }
    */
  </xsp:logic>

  Does someone see the problew, can someone help me?
  Thanks for you advise and time!!!
  
  Jan, from Belgium
-- 
View this message in context: http://www.nabble.com/Passing-parameter-from-sitemap-to-.xsp---everything-failes---help-needed-tf2258700.html#a6265431
Sent from the Cocoon - Users forum at Nabble.com.


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


Mime
View raw message