[JBoss Seam] - Rerendering dataTable based on selectOneMenu selection
by jblackmore
I'm trying to reload and rerender a dataTable based on the value selected in a selectOneMenu, using Seam, JSF, Facelets, and Ajax4JSF. I also want to rejoin the conversation each time a new value is selected.
I started out by creating something like this:
| <h:form id="projectForm">
| <h:selectOneMenu id="projects" value="#{selectedProjectId}">
| <f:selectItems value="#{projectSelectItems}"/>
| <a4j:support event="onchange"
| action="#{repository.findItems}" ajaxSingle="true"
| reRender="itemsPanel" />
| </h:selectOneMenu>
| </h:form>
|
That worked, but the 'repository' SFSB is reinstantiated on every select, suggesting to me that I did not successfully rejoin the conversation, even though I annotated the findItems() function with @Begin(join=true). Should I use Seam Remoting? I found a thread that suggested how to do this:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=87016
But, I'm having problems there too:
| <script type="text/javascript" src="seam/remoting/resource/remote.js"></script>
| <script type="text/javascript" src="seam/remoting/interface.js?repository"></script>
|
| <script type="text/javascript">
| //<![CDATA[
| function refreshItemTable(conversationId)
| {
| Seam.Remoting.getContext().setConversationId(conversationId);
| var myComponent = Seam.Component.getInstance('repository');
| myComponent.findItems();
| }
|
| // ]]>
| </script>
| ....
| <h:form id="projectForm">
| <h:selectOneMenu id="projects" value="#{selectedProjectId}">
| <f:selectItems value="#{projectSelectItems}"/>
| <a4j:support event="onchange"
| action="javascript:refreshItemTable(#{conversation.id})"
| ajaxSingle="true" reRender="itemsPanel" />
| </h:selectOneMenu>
| </h:form>
|
This results in a EL exception:
| Caused by: javax.el.ELException: Not a Valid Method Expression: javascript:refreshItemTable(#{conversation.id})
| at com.sun.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:217)
| at com.sun.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:63)
| at org.jboss.seam.ui.facelet.SeamExpressionFactory.createMethodExpression(SeamExpressionFactory.java:91)
| at com.sun.facelets.tag.TagAttribute.getMethodExpression(TagAttribute.java:141)
| ... 65 more
|
The projectSelectItems component is being outjected as expected, and selectedProjectId seems to be injected as needed. The only outstanding issue seems to be rejoining the conversation.
In an older thread, Gavin suggests using PAGE scope for a similar issue:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=74987&postdays=0...
I tried that, then got this error:
| java.lang.IllegalArgumentException: Stateful session beans may not be bound to the PAGE context: repository
| at org.jboss.seam.Component.checkScopeForComponentType(Component.java:299)
| at org.jboss.seam.Component.<init>(Component.java:217)
| at org.jboss.seam.Component.<init>(Component.java:204)
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:742)
| at org.jboss.seam.init.Initialization.addComponents(Initialization.java:674)
| at org.jboss.seam.init.Initialization.init(Initialization.java:429)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
|
What am I doing wrong? Is there a better way to do this?
Thanks,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3998089#3998089
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3998089
19 years, 3 months
[JBoss Seam] - Application scoped component throws Serialization Exception
by bluetrade
Hi,
in my web application, I use some Application Scoped components that interact with other non-Seam components (i.e. Lucene) - since initializing components that are required takes a lot of time, I decided to use this approach. Now, I in the A-Scoped comp. I have a reference to some non-serializable components - which gives me problems if the application runs for some time (not initially after deployment but after some half hour or so). I get:
org.jboss.serial.exception.SerializationException: Could not create instance of org.apache.lucene.index.IndexWriter - org.apache.lucene.index.IndexWriter
I reckon it's related because I have:
| @Startup(depends={"speechConfig","luceneConfig"})
| @Stateful
| @Scope(ScopeType.APPLICATION)
| @Name("processing")
| public class Processing implements ProcessingIf, Serializable{
|
| private LuceneIndexer indexer;
|
| ...
| }
|
|
| public class LuceneIndexer {
| private String noEntries;
| private IndexWriter iw;
| public LuceneIndexer() { /* some initialization of iw */}
|
| public void indexEntry(String entry) { ... }
|
| }
|
Do you know what I could do in order to make sure that the IndexWriter doesn't get Serialized - since this seems to be the problem...
thanks,
Joey
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3998088#3998088
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3998088
19 years, 3 months
[JBoss Seam] - Re: Seam and Portal Future
by norman.richards@jboss.com
Portal does solve some big issues. jboss.org runs on portal, and I couldn't imagine trying to do something with that scope by building up all the components in Seam. There are too many moving pieces, developed by different teams that need to come together. Things like that really need advanced infrastructure, and I really don't think *I* would want to write that.
When writing the dvd store, I tried to simulate the effect of a portal. There are clearly defined regions with clearly defined content boxes on the side. It is all done using faces templates. It works really well, but it wasn't trivial to get all the pages to look (and work) consistently. I think there are maybe 4 or 5 distinct pages in the app, divided into two sections (user and admin). I don't know how far the techniques could scale, but I'm sure it isn't that far. It was MUCH easier than doing the equivalent work in other technologies, but it left me longing for something more.
Portal is clearly too heavy a tool, but I don't know of a lightweight portal solution for these types of things. I'm very curious to see how other people approach these types of issues and whether or not someone can come up with something to sit on top of seam to simply create a portal-lite environment.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3998083#3998083
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3998083
19 years, 3 months