0

I am trying to submit a form, when I am keeping managed bean scope as view or request the action method is not getting invoked and it is showing me blank page. Where as when I am keeping the managed bean's scope as "session" action method is getting invoked and can see the desired result.

I am using jsf 2.1, primefaces 3.5, EL 2.2, tomcat 7

Below is my xhtml code:

<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:p="http://primefaces.org/ui" 
xmlns:c="http://java.sun.com/jsp/jstl/core"
template="globalTemplate.xhtml">
<h:messages />
<ui:define name="title">UserForm</ui:define>
<ui:define name="content">
    <h:form id="userForm">

  <ui:repeat value="#{loginBean.userMap.keySet().toArray()}" var="entry">
    <h:inputText id="usrId#{entry.key}" value="#{loginBean.userMap.get(entry)}" />
      <ui:repeat value="#{loginBean.userMap.get(entry)}" var="item" varStatus="loop">
        <h:outputText id="msgDesc" value="#{item.userDesc}" />
        <br/>
      </ui:repeat>

        <p:inputTextarea rows="6" cols="33" id="replyId#{entry.key}" value="#{loginBean.userInput}" 
        onkeypress="if (event.keyCode == 13) {submitUsr(); return false; }"/> 
    <p:commandButton id="submitInput#{entry.key}" value="Click" action="#{loginBean.submitUser}" />
  </ui:repeat>
    </h:form>
</ui:define>

I am not getting what is not allowing me to call the action method when I am submitting the page keeping managed bean's scope as view/request.

Thanks for your help in advance.

  • The problem I noticed, if I am keeping the p:commandButton outside of the ui:repeat tag, the action is fired and working fine while the managed bean is in request scope or view scope. Not sure why JSF is behaving like this. Any help is really appreciated. – Bubai Misra May 26 '13 at 21:18
  • Possibly related: http://stackoverflow.com/q/6039065/1530938 – kolossus May 27 '13 at 01:06
  • Checkout this [answer](http://stackoverflow.com/a/2120183/332248) from [BalusC](http://stackoverflow.com/users/157882/balusc). Especially No 4 (as you have also used `ui:repeat`). – Jens May 27 '13 at 10:18

0 Answers0