[JBoss Seam] - Re: Seam Remoting und JMS Topic subscription questions.
by sbryzak2
Seam.Remoting.subscribe() sends an asynchronous request to the server, which means you're not guaranteed to have a token in the subscription registry by the time your page gets to the script at the bottom of the page.
I suggested putting the code to set the token inside your callback method, because it is synchronous with the subscription request. However if your callback method isn't being called before the page is refreshed (because you haven't received any messages during that time) then you can override SeamRemote.subscriptionCallback() instead:
| <script type="text/javascript">
| var cb = SeamRemote.subscriptionCallback;
| SeamRemote.subscriptionCallback = function(doc) {
| cb(doc);
| document.getElementById('token').value = Seam.Remoting.subscriptionRegistry[0].token;
| }
| </script>
| }
|
Using setTimeout() is definitely not the way to do it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978487#3978487
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978487
19 years, 8 months
[JBoss Seam] - Problem with DataModelSelection
by olafgerwig
hi,
i try to implement a jsf datatable with seam @datamodel and @datamodelselection.
to generate the datamodel is no problem. but when a row is selected on the website, i cannot access to the values in @datamodelselection.
thanks for help
olaf
the javacode:
@Stateful
@Name("articleSelection")
public class ArticleSelectionBean implements ArticleSelection {
@PersistenceContext
private EntityManager em;
@DataModel(value="searchArticle")
private List searchArticle;
@DataModel(value="detailArticle")
private Article detailArticle;
private Article detailArticleInternal;
private String searchString;
@DataModel
private List selectetArticleParameter;
@DataModelSelection(value="searchArticle")
private Article selectedSearchArticle;
@Factory("searchArticle")
public String findOverview(){
System.out.println("!!! - Suchstring:" + searchString);
String searchPattern = searchString==null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
searchArticle = em.createQuery("FROM Article art WHERE lower(art.artName) like :search").setParameter("search", searchPattern).getResultList();
return "article_search_result";
}
public String findDetail(){
System.out.println("Artikelnummer:" + getSelectedSearchArticle().getArtName());
//detailArticle = em.merge(getSelectedSearchArticle());
return "article_detail";
}
public String getSearchString() {
return searchString;
}
public void setSearchString(String searchString) {
this.searchString = searchString;
}
@Remove @Destroy
public void destroy(){}
}
the Website:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
template="template.xhtml">
<!-- content -->
<ui:define name="content">
<h1>Suchresultat</h1>
<h:dataTable columnClasses="firstColumn,secondColumn,thirdColumn"
headerClass="headerAlignment"
value="#{searchArticle}"
var="art"
rendered="#{searchArticle.rowCount>0}">
<h:column>
<f:facet name="header">Artikelbild</f:facet><h:graphicImage value="/img/article/thumbnails/#{art.artPicture}"/>
</h:column>
<h:column>
<f:facet name="header">Artikeltitel</f:facet>#{art.artName}
</h:column>
<h:column>
<f:facet name="header">ArtikelPreis</f:facet>#{art.artSalesPrice}
</h:column>
<h:column>
<f:facet name="header">Artikeldetail</f:facet><s:link value="Artikel Bestellen" action="#{articleSelection.findDetail}"/>
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
the exception:
exception
javax.servlet.ServletException: Exception while invoking expression #{articleSelection.findDetail}
javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.faces.el.EvaluationException: Exception while invoking expression #{articleSelection.findDetail}
org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
org.jboss.seam.core.Pages.callAction(Pages.java:212)
org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:127)
org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:98)
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:50)
org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersBefore(LifecycleImpl.java:520)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:342)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978484#3978484
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978484
19 years, 8 months