You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew <an...@gmail.com> on 2006/07/23 00:38:49 UTC
forEach confusion
Hi,
i'm trying to do this:
for int (i=0; i < paypalResponse.getErrors().length; i++) {
String message= paypalResponse.getErrors(i);
}
like so in jx
<jx:forEach var="item" items="${paypalResponse.getErrors()}">
<tr>
<td>${item}</td>
</tr>
</jx:forEach>
but this only returns an object and not the object value. What am I missing?
I tried ${item[0]} but that returns nothing.
regards
Andrew
Re: forEach confusion
Posted by Andrew <an...@gmail.com>.
Hi Jason,
that worked a treat, many thanks. If paypal themselves don't know what
they're doing, it may well be time to find another merchant service!!!
regards
Andrew
On 23/07/06, Jason Johnston <co...@lojjic.net> wrote:
>
> Andrew wrote:
> > Hi Jason,
> >
> > Does that really work?
> >
> > So the Paypal developers say!
> >
> http://www.pdncommunity.com/pdn/board/message?board.id=api&message.id=131#M131
> > <
> http://www.pdncommunity.com/pdn/board/message?board.id=api&message.id=131#M131
> >
>
> Well, not to knock down their developers, but that post doesn't look
> like an authoritative sample of working code. ;-) First of all it isn't
> even valid Java syntax. It's also different than what you pasted in
> since theirs doesn't try to assign the ErrorType object to a String
> variable. In short, it doesn't do what you want.
>
> > I assume by "the object value" you mean a String representation of
> it?
> > Try ${item.toString()} ?
> >
> > I mean the actual value held in the object. Even with item.toString() I
> > am still getting:
> >
> > com.paypal.soap.api.ErrorType@727c61b7
> >
> > type returns. What I want is to access the contents within object which
> > is a descriptive string describing why a credit card check was rejected.
>
> OK, so call a method of the ErrorType class that returns the descriptive
> string you want. Perhaps .getShortMessage() or .getLongMessage()? You
> just need to look at what the API provides.
>
> The fact that it's telling you it's got an ErrorType object indicates
> the forEach looping is working correctly.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
Re: forEach confusion
Posted by Jason Johnston <co...@lojjic.net>.
Andrew wrote:
> Hi Jason,
>
> Does that really work?
>
> So the Paypal developers say!
> http://www.pdncommunity.com/pdn/board/message?board.id=api&message.id=131#M131
> <http://www.pdncommunity.com/pdn/board/message?board.id=api&message.id=131#M131>
Well, not to knock down their developers, but that post doesn't look
like an authoritative sample of working code. ;-) First of all it isn't
even valid Java syntax. It's also different than what you pasted in
since theirs doesn't try to assign the ErrorType object to a String
variable. In short, it doesn't do what you want.
> I assume by "the object value" you mean a String representation of it?
> Try ${item.toString()} ?
>
> I mean the actual value held in the object. Even with item.toString() I
> am still getting:
>
> com.paypal.soap.api.ErrorType@727c61b7
>
> type returns. What I want is to access the contents within object which
> is a descriptive string describing why a credit card check was rejected.
OK, so call a method of the ErrorType class that returns the descriptive
string you want. Perhaps .getShortMessage() or .getLongMessage()? You
just need to look at what the API provides.
The fact that it's telling you it's got an ErrorType object indicates
the forEach looping is working correctly.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: forEach confusion
Posted by Andrew <an...@gmail.com>.
Hi Jason,
Does that really work?
So the Paypal developers say!
http://www.pdncommunity.com/pdn/board/message?board.id=api&message.id=131#M131
I assume by "the object value" you mean a String representation of it?
> Try ${item.toString()} ?
I mean the actual value held in the object. Even with item.toString() I am
still getting:
com.paypal.soap.api.ErrorType@727c61b7
type returns. What I want is to access the contents within object which is a
descriptive string describing why a credit card check was rejected.
HTH
regards
Andrew
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
Re: forEach confusion
Posted by Jason Johnston <co...@lojjic.net>.
Andrew wrote:
> Hi,
> i'm trying to do this:
>
> for int (i=0; i < paypalResponse.getErrors().length; i++) {
> String message= paypalResponse.getErrors(i);
> }
Does that really work? I'm guessing that paypalResponse is a
com.paypal.soap.api.AbstractResponseType ... if that's right then the
online javadocs say getErrors(int i) does not return a String, it
returns an ErrorType object.
>
> like so in jx
>
> <jx:forEach var="item" items="${ paypalResponse.getErrors()}">
> <tr>
> <td>${item}</td>
> </tr>
> </jx:forEach>
>
> but this only returns an object and not the object value. What am I
> missing? I tried ${item[0]} but that returns nothing.
I assume by "the object value" you mean a String representation of it?
Try ${item.toString()} ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org