cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cyril vidal" <cyr.vi...@wanadoo.fr>
Subject Re: xsp + parameters:it's OK
Date Tue, 31 Dec 2002 16:18:56 GMT
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" <nils.lessmann@students.uni-mannheim.de>
To: <cocoon-users@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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message