-
1. Re: Problems with EL in JavaScript by Seam Remoting
antibrumm.mfrey0.bluewin.ch Feb 15, 2011 2:47 AM (in response to joergi)Hi,
I've never used remoting yet but are you talking about a .js file? I would be quite surprised if seam/jsf does handle expressions in these kind of files.
I would try to put this code in your page and see whats happening. Most probably your .js file contains the #{conversation.id} as code on the client side, which means nothing in Javascript.
Martin
-
2. Re: Problems with EL in JavaScript by Seam Remoting
joergi Feb 15, 2011 3:13 AM (in response to joergi)Hi Martin,
thanks for your response.I did exactly what was in the documentation:
Put this into your JavaScript.Thats where I'm calling the Seam Remoting.
I was also wondering that EL should work at this position, but that's how i understood the documentation.
Thanks.
Joergi -
3. Re: Problems with EL in JavaScript by Seam Remoting
joergi Feb 15, 2011 4:59 AM (in response to joergi)Link to the Forum:
http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/html/remoting.html#d0e22747
This small snippet of JavaScript will set the conversation ID that is used for remoting calls to the current view's conversation ID:
Seam.Remoting.getContext().setConversationId( #{conversation.id} ); -
4. Re: Problems with EL in JavaScript by Seam Remoting
shane.bryzak Feb 15, 2011 6:03 AM (in response to joergi)Just to clarify, you are including this JavaScript inside a JSF page, right?
-
5. Re: Problems with EL in JavaScript by Seam Remoting
joergi Feb 15, 2011 6:17 AM (in response to joergi)Hi Shane,
No, i have a (400 line big) JavaScript file, where i call this:
function getAllNonBusinessDays() {
// alert(Seam.Remoting.getContext().getConversationId());
Seam.Remoting.getContext().setConversationId( #{conversation.id} );
Seam.Component.getInstance("schedulerSeamRemoteManager").getAllNonBusinessDays(reloadNonBusinessDaysView);
}
(this is only one example, i have more of seam remote requests in this JavaScript file)
without "Seam.Remoting.getContext().setConversationId( #{conversation.id} ); " this it's totally working...
(but i need this now...)
The JavaScript file is loaded into a JSF-page... -
6. Re: Problems with EL in JavaScript by Seam Remoting
shane.bryzak Feb 15, 2011 6:53 AM (in response to joergi)Well of course that's not going to work, as you have no EL interpolator to replace the expression with the actual conversation ID (the documentation assumes you know this). Try setting the conversation ID in your JSF code - you can store it in a variable if that makes it more preferable (do this before the line where you import your JS file):
var conversationId = #{conversation.id};
Then in your JavaScript, use:
Seam.Remoting.getContext().setConversationId(conversationId);
-
7. Re: Problems with EL in JavaScript by Seam Remoting
joergi Feb 15, 2011 8:11 AM (in response to joergi)Thanks a lot ;)
works perfect now!