You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by jantje <ja...@skynet.be> on 2006/09/12 14:52:16 UTC

Passing parameter from sitemap to .xsp - everything failes - help needed

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


InputSource convert to File

Posted by rachid harradi <ra...@gmx.net>.
have you idee how can i convert Inputsource Object to File?
-- 


NEU: GMX DSL Sofort-Start-Set – blitzschnell ins Internet!
Echte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl

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


Re: Passing parameter from sitemap to .xsp - everything failes - help ne

Posted by jantje <ja...@skynet.be>.

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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Passing parameter from sitemap to .xsp - everything failes - help ne

Posted by jantje <ja...@skynet.be>.

parameters.getParameter("habibi", null);

gives the same problem as:

this.parameters.getParameter("habibi", null);

Still having this problem:

java.lang.NullPointerException:

Cocoon stacktrace[hide]
Language Exception
context://SBxsp/sitemap.xmap - 22:25	<map:serialize>
context://SBxsp/sitemap.xmap - 15:82	<map:transform>
context://SBxsp/sitemap.xmap - 12:61	<map:generate type="serverpages">
context://sitemap.xmap - 890:66	<map:mount>







Ard Schrijvers 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);
> 
> What is this? Try parameters.getParameter("habibi", null);
> 
> Regards Ard
> 
>>   </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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Passing-parameter-from-sitemap-to-.xsp---everything-failes---help-needed-tf2258700.html#a6266552
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