-
1. Re: rich:tab remoting seam
michaelcourcy Aug 5, 2008 2:52 PM (in response to yacin00)Sorry, I'm new to seam, but would you mean
<rich:tab label="#{cus.name}" onlabelclick="setCurrentCustomer(‘#{cus.id}’)">
instead of
<rich:tab label="#{cus.name}" onlabelclick="setId(‘#{cus.id}’)">
?
-
2. Re: rich:tab remoting seam
yacin00 Aug 5, 2008 2:59 PM (in response to yacin00)
ig rek wrote on Aug 05, 2008 12:46:
Hi,
this is my problem
iI’m trying to recover an object Id via a JavaScript method, and use it in a bean, so I definded a JavaScript method which look like
customer.jsfunction setId (Id) { Seam.Component.getInstance("customer").setId(Id); }
customerBean@stateful @Name("customer") public class CustomerBean implements CustomerLocal { private Customer customer; private Long id; @Factory(customers") ... ... public void setId(Long id){ this.id=id } public void idUse{ Customer customer = (Customer) em.createQuery("select c from Customer c where c.customerId =:Id") .setParameter("Id", ^getId()^) .getSingleResult(); } }
@Local public interface CustomerLocal { @WebRemote public void setId(Long id); }
customer.xhtml<script type="text/javascript sr="customer.js" ..... <s:remote include="customer"> <div> <rich:tabPanel switchType="client" > <c:forEach items="#{customers}" var="cus" varStatus="c"> <rich:tab label="#{cus.name}" onlabelclick="setId(‘#{cus.id}’)"> #{cus.name} </rich:tab> </c:forEach> </rich:tabPanel> </div>
it seams like the get Id return a null value, why? and how can i use this value for my query??Click HELP for text formatting instructions. Then edit this text and check the preview.
-
3. Re: rich:tab remoting seam
yacin00 Aug 5, 2008 3:02 PM (in response to yacin00)i made a mistake (copy, past) ;-), you 're right !!, but it dosen't solve my problem, thanks anyway :-)
-
4. Re: rich:tab remoting seam
michaelcourcy Aug 5, 2008 5:22 PM (in response to yacin00)Hum...
And if you follow point to point the exemple in remoting
http://docs.jboss.com/seam/2.0.3.CR1/reference/en-US/html/remoting.html
Do you manage to have this one working properly ?
-
5. Re: rich:tab remoting seam
yacin00 Aug 5, 2008 5:43 PM (in response to yacin00)my problem, i think has no relation with the fact of remoting.
i Try to use a data defined in one methode in anotehrone, it seams obvious that it return a null value.
do you have any idea ?? -
6. Re: rich:tab remoting seam
pgmjsd Aug 5, 2008 7:30 PM (in response to yacin00)Two things come to mind here:
- Maybe I missed it, but the conversation doesn't look like it gets promoted to a long running conversation. Seam may be creating a new conversation for the Seam remoting call, giving you a fresh SFSB every time. I've made this mistake quite a few times. I usually put @Begin(join=true) on the web remote method implementation.
- I have noticed that using Ajax4JSF and Seam Remoting together on the same page causes lost conversations and all kinds of strangeness. Best to avoid it.
Hope that helps.
-
7. Re: rich:tab remoting seam
michaelcourcy Aug 5, 2008 11:14 PM (in response to yacin00)At least it helps me to understand the conversation process and the place of SFSB in there.
Thanks.
-
8. Re: rich:tab remoting seam
michaelcourcy Aug 5, 2008 11:42 PM (in response to yacin00)Thus one solution instead of promoting to a long conversation, would be to change the default scope of CustomerBean
@stateful @Scope(SESSION) @Name("customer") public class CustomerBean{ ... }
-
9. Re: rich:tab remoting seam
yacin00 Aug 6, 2008 9:41 AM (in response to yacin00)hi guys,
thank you very much, it was a great help for me.
it works after adding@stateful @Scope(ScopeType.SESSION) @Name("customer") public class CustomerBean{ ... @Begin(join=true) public void setId(Long id){ this.id=id }
you were right, it was a conversation problem.
thanks again :-)