Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
01. Aug 2008, 05:39 CET | Link

Hi,

I've been trying to use the Seam.Remoting.eval to evaluate a list of objects. But for some reason it's not returning an array of objects. All i'm getting is a string. I'm not sure if i've missed understood the documentation or I'm missing something.

In my Session bean i've outjected an instance variable

@Out(required = false)
private List<BankTransaction> bankTransList;

On my jsf page i've the following javascript

 function setupBankTransactionsCallback(bankTransactions){

  for (var i = 0; i < bankTransactions.length; i++) {

      alert("Got banktransaction: " + bankTransactions[i].getDescription());

    }    
}

Seam.Remoting.eval("#{bankTransList}", setupBankTransactionsCallback);

I've also have a s:remote tag with the entity Bean name

When the page loads it runs Seam.remoting.eval statement on the outjected instance variable. In firebug i can see the ajax request going to the server, as follows

|<envelope><header><context><conversationId>10</conversationId></context></header><body><eval expr="[com.oneplace.cashbook.BankTransaction@172971, com.oneplace.cashbook.BankTransaction@a1bbd0, com.oneplace.cashbook.BankTransaction@315b2a, com.oneplace.cashbook.BankTransaction@584a81, com.oneplace.cashbook.BankTransaction@836075, com.oneplace.cashbook.BankTransaction@131b721, com.oneplace.cashbook.BankTransaction@ede36c, com.oneplace.cashbook.BankTransaction@1ede8c1, com.oneplace.cashbook.BankTransaction@4bf8b7, com.oneplace.cashbook.BankTransaction@1b5ece6, com.oneplace.cashbook.BankTransaction@d40154, com.oneplace.cashbook.BankTransaction@a349d0, com.oneplace.cashbook.BankTransaction@432841, com.oneplace.cashbook.BankTransaction@107c389, com.oneplace.cashbook.BankTransaction@75af7a, com.oneplace.cashbook.BankTransaction@53812e]" id="0"/></body></envelope>|

and the response is as follows

<envelope><header><context><conversationId>17</conversationId></context></header><body><result id="0"><value><str>%5Bcom.oneplace.cashbook.BankTransaction%40172971%2C%20com.oneplace.cashbook.BankTransaction
%40a1bbd0%2C%20com.oneplace.cashbook.BankTransaction%40315b2a%2C%20com.oneplace.cashbook.BankTransaction%40584a81%2C%20com.oneplace.cashbook.BankTransaction%40836075%2C%20com.oneplace.cashbook.BankTransaction
%40131b721%2C%20com.oneplace.cashbook.BankTransaction%40ede36c%2C%20com.oneplace.cashbook.BankTransaction%401ede8c1%2C%20com.oneplace.cashbook.BankTransaction%404bf8b7%2C%20com.oneplace.cashbook.BankTransaction
%401b5ece6%2C%20com.oneplace.cashbook.BankTransaction%40d40154%2C%20com.oneplace.cashbook.BankTransaction%40a349d0%2C%20com.oneplace.cashbook.BankTransaction%40432841%2C%20com.oneplace.cashbook.BankTransaction%40107c389%2C%20com.oneplace.cashbook.BankTransaction%4075af7a%2C%20com.oneplace.cashbook.BankTransaction
%4053812e%5D</str></value><refs></refs></result></body></envelope>

When the callback method is called i get a javascript error

bankTransactions[i].getDescription is not a function

as the function is passed a string instead of an array.

Does anyone know what i've done wrong?

Thanks

1 Reply:
01. Aug 2008, 11:07 CET | Link

I've disabled this feature temporarily because of a security issue. Once I work out how to detect the @WebRemote annotation on methods/properties referenced in an EL expression then I'll re-enable it again.