This content has been marked as final.
Show 2 replies
-
1. Re: EntityHome and Remoting
nigiyan Feb 23, 2011 4:45 AM (in response to eukreign)Good question. I face same issue.
I have simple SEAM plus JSF project, now I want to add ajax support with Seam.Remoting so that entity bean's values to be populated on each jsf component's
onblur
.
To do this I need MyEntityBeansHome's instance accessible somehow from @Local seam component (like ManagerAction class inSeam Framework
book, chapter 21.1.1) but couldn't find a way to do it. -
2. Re: EntityHome and Remoting
nigiyan Feb 24, 2011 6:29 AM (in response to eukreign)The solution is simple, just need to follow the right steps.
In my case I have long-running conversation and want to avoid Richfaces' ajax full form submission in order to have one input element's content set to data model / instanceMyEntityHomeEdit.xhtml
... <script type="text/javascript" src="seam/resource/remoting/resource/remote.js"/> <script type="text/javascript" src="seam/resource/remoting/interface.js?SEAM_COMPONENT_NAME_HERE_WHICH_HANDLES_REQUEST"/> <script type="text/javascript" language="javascript"> function req(source) { Seam.Remoting.getContext().setConversationId(#{conversation.id}); var seamComp = Seam.Component.getInstance("SEAM_COMPONENT_NAME_HERE_WHICH_HANDLES_REQUEST"); seamComp.doSomething(source.anything, responseHandlingJSMethod); } </script> <h:form id="formId"> <h:inputText value="#{myEntityHome.instance.someField}" onblur="req(this)"/> ...
My EntityHome, or can be any other seam component where my entity home is injected.
@Name("SEAM_COMPONENT_NAME_HERE_WHICH_HANDLES_REQUEST") @Scope(ScopeType.CONVERSATION) public class MyEntityHome extends EntityHome<MyEntity> { public boolean doSomething(String param){ getInstance().setFieldContent(param); return true; // can be handled in js } }