You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by cyril vidal <cy...@wanadoo.fr> on 2002/12/31 17:18:56 UTC

Re: xsp + parameters:it's OK

Hi,

Thanks for your response. It runs well now.
I've just changed the type of the returned value in
public static String get_fac(String number) to public static long
get_fac(String number) because it returns a long value.

Regards,
Cyril.
_______________________________

Cyril Vidal
Email: cyril@planetexml.com
Web: http://www.planetexml.com
----- Original Message -----
From: "Nils Leßmann" <ni...@students.uni-mannheim.de>
To: <co...@xml.apache.org>
Sent: Tuesday, December 31, 2002 2:16 PM
Subject: AW: xsp + parameters


Hi,

have a look in the generated java file (search for factoriel_xsp.java),
that's usually the fastest way to see what's really going on.

Anyway, I'd suggest using a second method

public static String get_fac(String number) {
  try {
    long l = Long.parseLong(number);
    return fac(l);
  } catch (NumberFormatException e) {
    return number+" not a number";
  }
}

and calling this from the xsp.

Nils


-----Ursprüngliche Nachricht-----
Von: cyril vidal [mailto:cyr.vidal@wanadoo.fr]
Gesendet: Dienstag, 31. Dezember 2002 11:08
An: cocoon-users@xml.apache.org
Betreff: Re: xsp + parameters


So, I've tried the following code, in the aim to convert String to long:
 <factorial-calcul>result:
<xsp:expr>fac(java:lang.Long.parseLong(<xsp-request:get-parameter
 name="number" default="0"/>))</xsp:expr></factorial-calcul>

but it doesn't run:
Error compiling factoriel_xsp: Line 127, column 57: ')' expected. Line
0,
column 0: 1 error



---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>




---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>