You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 8 Members of 4089 |
| Forum: Seam Users |
29. Jul 2008, 05:04 CET | Link |
Hi,
I have a problem in a relatively simple Seam w/ RichFaces application using entity home objects and CRUD pages with s:validateAll and s:decorate tags (no AJAX partial submits). When I submit a form with invalid (e.g. missing) data, validation error messages are correctly displayed. But when I fix the mistakes and try to re-submit the form, the action method never gets called!
I know that it otherwise works fine, because when I submit the form without any wrong data in the first place, the action (the persist method on the entity home object) gets called just fine and the data is stored into the database.
Seam 2.0.2GA, JBoss 4.2.3GA
Thanks for any help, I'm slowly going crazy about this. I hope the description is understandable as it is but I can provide more information if needed (I feel like it may be a beginner's error so maybe someone will know right away what I'm doing wrong).
Martin Jelen
Is it possible to post the xhtml for an offending page.
But I being poor have only my dreams. I have spread my dreams under your feet. Tread softly because you tread on my dreams...
It may help but you could put a controller bean into the mix.
It can be stateless and just called the xxxx.persist.
I must admit I have never called an entity from the ; no matter how trivial.
But I being poor have only my dreams. I have spread my dreams under your feet. Tread softly because you tread on my dreams...
Oh, sorry if that wasn't clear, I am using a controller class that inherits from Seam's EntityHome. It doesn't seem to be a problem there, however, because I got the same results when I created a simple session bean and used it as the target for the button's action.
I tried tracing the problem within RichFaces, it looks like no event is broadcast in the Invoke Application phase (but only when a postback happens due to validation errors prior to this submission).
Here's the code of a page where it happens:
<!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:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" template="layout/powderpuff.xhtml"> <ui:define name="body"> <h:messages globalOnly="false" styleClass="message" id="globalMessages"/> <h:form id="post" styleClass="edit"> <rich:panel rendered="#{postHome.instance.parent ne null}"> <f:facet name="header">#{messages.inReplyTo}</f:facet> <ui:include src="/discussion/singlePost.xhtml" > <ui:param name="post" value="#{postHome.instance.parent}" /> <ui:param name="repliable" value="false" /> </ui:include> </rich:panel> <rich:panel> <div class="dialog"> <s:validateAll> <s:decorate id="titleDecoration" template="/layout/edit.xhtml"> <ui:define name="label">#{messages.title}</ui:define> <h:inputText id="title" required="true" size="100" value="#{postHome.instance.title}"> <!-- a:support eventsQueue="validationQueue" event="onblur" reRender="titleDecoration"/--> </h:inputText> </s:decorate> <s:decorate id="bodyDecoration" template="/layout/edit.xhtml"> <ui:define name="label">#{messages.body}</ui:define> <h:inputTextarea id="body" cols="60" rows="10" value="#{postHome.instance.body}"> <!-- a:support eventsQueue="validationQueue" event="onblur" reRender="bodyDecoration"/--> </h:inputTextarea> </s:decorate> </s:validateAll><script type="text/javascript"> WYSIWYG.attach('post:bodyDecoration:body',full); </script> </div> <div style="clear: both;"> </div> <div><span class="required">*</span> <h:outputText escape="false" value="#{messages.requiredFields}"/></div> </rich:panel> <div class="actionButtons"> <h:commandButton id="save" value="#{messages.save}" action="#{discussionController.persistPost}" disabled="#{!postHome.wired}" rendered="#{!postHome.managed}"> <s:conversationPropagation type="end"/> </h:commandButton> <h:commandButton id="update" value="#{messages.save}b" action="#{postHome.update}" rendered="#{postHome.managed}"> <s:conversationPropagation type="end"/> </h:commandButton> <h:commandButton id="delete" value="#{messages.delete}" action="#{postHome.remove}" rendered="#{postHome.managed}"> <s:conversationPropagation type="end"/> </h:commandButton> <s:button id="done" value="#{messages.done}" propagation="end" view="/Post.xhtml" rendered="#{postHome.managed}"/> <s:button id="cancel" value="#{messages.cancel}" propagation="end" view="/#{empty postFrom ? 'TopicList' : postFrom}.xhtml" rendered="#{!postHome.managed}"/> </div> </h:form> </ui:define> </ui:composition>Never mind.... the solution in my case was to change the conversation propagation settings (to , which is what I use in other places in the application). Now I'm sufficiently new to Seam to say that I don't know why the difference, but the important thing is that it works :).