1

Project is using Spring Webflow and JSF (PrimeFaces). I have a page called 'manageArticle.xhtml'. On the page if a user clicks 'Edit' button, a p:panel will be displayed with the current Article object content. The article object is passed to the view as follows

    <transition on="edit_article" to="manageArticles">
        <evaluate expression="articles.selectedRow" result="flowScope.selectedArticle" />
        <set name="flashScope.editMode" value="'edit'" />
      </transition>

On the panel there is a command button 'Save' defined as follows

    <p:commandButton id="editArticleSave" action="${articleManager.saveArticle(selectedArticle)}" ajax="false" value="Save" />

The object 'articleManager' is in the service layer injected by Spring:

    @Service("articleManager")
    public class ArticleManagerImpl implements ArticleManager{
        // inject dao ...
        @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
        public void saveArticle(Article article) {
            articleDao.save(article);   
        }
    }

However when I clicked the save button, the action is not called. I put a break point in function saveArticle and it's not breaking. The action is ignored. Anybody knows what happened? Thank you very much.

Raistlin
  • 407
  • 1
  • 8
  • 19
  • I changed to "#" and it's not working. If I put a wrong function name like 'articleManager.dummy()' in the action definition, there is no exception thrown and no error. It's just bypassed. – Raistlin Aug 09 '12 at 15:38
  • Just an update, the command button is defined in a panel. The panel is rendered when editMode is 'edit': rendered="#{editMode=='edit'}". If I remove the rendered property, the action is called. Anybody knows why that happened? – Raistlin Aug 09 '12 at 15:57
  • In normal JSF you'd have solved it by placing the bean in the view scope. However I have no utter idea how Spring plays a role here. See also point 5 of this answer: http://stackoverflow.com/questions/2118656/hcommandlink-hcommandbutton-is-not-being-invoked/2120183#2120183 – BalusC Aug 09 '12 at 16:23
  • A co-worker ran into an equal issue yesterday. It was caused by point 7 of BalusC answer: an ajax request beforehand. Just an idea as the problem description sounded so familiar. – Jens Aug 10 '12 at 08:11
  • Thanks guys for your time and help. It took me a while to understand what BalusC's link says. Yes that's the point. In my case, after the user clicks the 'Save' button and submit, JSF re-checked the rendered attribute which is 'false' then. So the action attribute is ignored as the panel and its child components are not rendered at all. BalusC if you could move your comment as the answer then I would mark it. – Raistlin Aug 10 '12 at 13:43

0 Answers0