title: Unable to invoke action method of commandbutton
body: <p>i am trying JSF, and i am not able to invoke method mapped to action attribute
  my JSF page is as follows,</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
   &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
   &lt;%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%&gt;
   &lt;%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%&gt;
   &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
   &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
          &lt;title&gt;MAP STUDENT-COURSE&lt;/title&gt;
          &lt;link rel="stylesheet" href="&lt;%=request.getContextPath()%&gt;/demo.css" type="text/css" /&gt;
          &lt;script type="text/javascript"&gt;
              window.onload = function(){
                      var validateFN = function(){
                          var selectObj = document.getElementById("selectOptionForm:operationTypeID");
                          var selectFN = function(){                      
                              var selectedOp = selectObj.options[selectObj.selectedIndex].value;
                              if(selectedOp == "0" || selectedOp == 0){
                                  alert(" Select appropriate option.... ");                                   
                              }else{
                                  document.selectOptionForm.submit();
                              }   
                          }
  
                          if(selectObj != null){  
                              selectObj.onchange = selectFN;                          
                          }
                      }
                      validateFN();
  
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;f:view&gt;
              &lt;h:form id="selectOptionForm"&gt;
                  &lt;h:panelGrid columns="2" headerClass="headerRow" rowClasses="oddRow,evenRow"&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="SELECT OPERATION" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="SELECT OPTION" /&gt;
                      &lt;h:selectOneMenu id="operationTypeID" value="#{studentCourseBean.operationType}" valueChangeListener="#{studentCourseBean.fetchCombo}"&gt;
                          &lt;f:selectItem  itemLabel="SELECT"  itemValue="0"  /&gt;    
                      &lt;f:selectItem  itemLabel="MAP STUDENT"  itemValue="addStudent"  /&gt;
                          &lt;f:selectItem  itemLabel="MAP COURSE"  itemValue="addCourses"  /&gt;
                      &lt;/h:selectOneMenu&gt;
                  &lt;/h:panelGrid&gt;
              &lt;/h:form&gt;
              &lt;br /&gt;
              &lt;br /&gt;
              &lt;br /&gt;
              &lt;h:form id="addStudentForm" rendered="#{(studentCourseBean.addByStudents &amp;&amp; !studentCourseBean.addByCourses)}"&gt;
                  &lt;h:panelGrid columns="2" headerClass="headerRow" rowClasses="oddRow,evenRow" footerClass="headerRow"&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="MAP STUDENT" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="SELECT STUDENT" /&gt;
                      &lt;h:selectOneMenu  id="studentID" value="#{studentCourseBean.selectedStudentId}"&gt;
                          &lt;f:selectItems value="#{studentCourseBean.studentDropBox}" /&gt;
                      &lt;/h:selectOneMenu&gt;
                      &lt;h:outputText value="SELECT COURSE'S" /&gt;
                      &lt;h:selectManyListbox id="courseID" value="#{studentCourseBean.selectedCourseList}" size="5"&gt;
                          &lt;f:selectItems value="#{studentCourseBean.courseDropBox}" /&gt;
                      &lt;/h:selectManyListbox&gt;
                      &lt;f:facet name="footer"&gt;
                          &lt;h:panelGroup&gt;
                              &lt;h:commandButton id="enterButton" type="submit" value="ENTER" action="#{studentCourseBean.addStudentAction}" /&gt;
                              &lt;h:commandButton id="cancelButton" type="submit" value="CANCEL" action="#{studentCourseBean.cancelAction}" /&gt;
                          &lt;/h:panelGroup&gt;
                      &lt;/f:facet&gt;
                  &lt;/h:panelGrid&gt;
              &lt;/h:form&gt;
              &lt;h:form id="addCourseForm" rendered="#{(!studentCourseBean.addByStudents &amp;&amp; studentCourseBean.addByCourses)}"&gt;
                  &lt;h:panelGrid columns="2" headerClass="headerRow" rowClasses="oddRow,evenRow" footerClass="headerRow"&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="MAP COURSE" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="SELECT COURSE" /&gt;
                      &lt;h:selectOneMenu  id="courseID" value="#{studentCourseBean.selectedCourseList}"&gt;
                          &lt;f:selectItems value="#{studentCourseBean.courseDropBox}" /&gt;
                      &lt;/h:selectOneMenu&gt;
                      &lt;h:outputText value="SELECT STUDENTS" /&gt;
                      &lt;h:selectManyListbox id="studentID" value="#{studentCourseBean.selectedStudentList}" size="5"&gt;
                          &lt;f:selectItems value="#{studentCourseBean.studentDropBox}" /&gt;
                      &lt;/h:selectManyListbox&gt;
                      &lt;f:facet name="footer"&gt;
                          &lt;h:panelGroup&gt;
                              &lt;h:commandButton id="enterCrButton" type="submit" value="ENTER" action="#{studentCourseBean.addCourseAction}" /&gt;
                              &lt;h:commandButton id="cancelCrButton" type="submit" value="CANCEL" action="#{studentCourseBean.cancelAction}" /&gt;
                          &lt;/h:panelGroup&gt;
                      &lt;/f:facet&gt;
                  &lt;/h:panelGrid&gt;
              &lt;/h:form&gt;   
          &lt;/f:view&gt;   
      &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>Here i am talking about the second form whose id is "addCourseForm",</p>
  
  <p>please note, i have two form's in my page, first is "addStudentForm" form, which perfectly works fine, but in my second form i am not able to submit, can any body tell me why "addCourseForm" is not working as required,</p>
  
  <p>My backing bean in viewedScope, i am using JSF 2.0 annotations,
  waiting for the reply</p>