Hi, after really trying everything, i have found this:
<?xml version="1.0"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:util="http://apache.org/xsp/util/2.0">
<page>
<xsp:logic>
int newUserInt = (int)<util:get-sitemap-parameter
name="newUser"/>.length();
String newUserString = (String)<util:get-sitemap-parameter
name="newUser"/>;
</xsp:logic>
<xsp:expr><util:get-sitemap-parameter name="newUser"/></xsp:expr>
</page>
</xsp:page>
And it works!!!
Ok, fine for me, but is there someone who knows the solution for the problem
i had? it would be nice to know the solution :-)
Thanks for your time,
me.
jantje wrote:
>
> 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?
>
> Things 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 problem, 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#a6266897
Sent from the Cocoon - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]