• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unable to call Action Methof

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a jsf page with several tables and input text boxes. I also have the command button to submit the values to the backing bean but, the action method "saveBean()" is not being called

Hear are the codes listed below listed

----------------------- JSF ---------------------
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t"%>
<h:form id="myBioDataForm">
<h:panelGrid columns="2" >
<h:panelGroup >
<h:outputLabel id="NameLabel" value="Name" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:inputText id="NameTextBox" value="#{bioData.objBioDataVo.name}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="DOBLabel" value="DOB" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<t:inputCalendar id="DOBCalendar" renderAsPopup="true" value="#{bioData.objBioDataVo.doB}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="AddressLabel" value="address" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:outputLabel value=""/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="Street" value="Street" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:inputText id="StreetTextBox" value="#{bioData.objBioDataVo.street}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="City" value="Town/City" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:inputText id="CityTextBox" value="#{bioData.objBioDataVo.city}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="Pincode" value="Pincode" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:inputText id="PincodeTextBox" value="#{bioData.objBioDataVo.pincode}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="Mobile" value="Mobile" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:inputText id="mobileTextBox" value="#{bioData.objBioDataVo.mobile}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="Email" value="Email" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:inputText id="emailTextBox" value="#{bioData.objBioDataVo.email}"/>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="Gender" value="Gender" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:selectOneRadio value="#{bioData.objBioDataVo.gender}">
<f:selectItem itemLabel="Male" itemValue="Male"/>
<f:selectItem itemLabel="Female" itemValue="Female"/>
</h:selectOneRadio>
</h:panelGroup>

<h:panelGroup >
<h:outputLabel id="Marital_Status" value="Marital Status" style="font-size: medium"/>
</h:panelGroup>
<h:panelGroup >
<h:selectOneRadio value="#{bioData.objBioDataVo.status}">
<f:selectItem itemLabel="Married" itemValue="Married"/>
<f:selectItem itemLabel="UnMarried" itemValue="UnMarried"/>
</h:selectOneRadio>
</h:panelGroup>
</h:panelGrid>
<f:verbatim><br><br><br></f:verbatim>

<h:dataTable var="item" value="#{bioData.al}">
<h:column>
<f:facet name="header" >
<h:outputText value="No Of Years"/>
</f:facet>
<h:selectOneMenu id="NoYears1" value="#{item.noYears}">
<f:selectItems value="#{item.noYearsVoTM}"/>
</h:selectOneMenu>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Organisation"/>
</f:facet>
<h:inputText id="OrgnisationTextBox" value="#{item.orgVo}"/>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Designation"/>
</f:facet>
<h:inputText id="designationTextBox" value="#{item.desigVo}"/>
</h:column>

</h:dataTable>

<h:commandButton id="addRow" type="submit" value="Add Row" immediate="true" action="#{bioData.addStr}"/>


<h:dataTable var="edual" value="#{bioData.eduList}">
<h:column>
<f:facet name="header" >
<h:outputText value="Year of Passing"/>
</f:facet>
<h:selectOneMenu id="NoYears11" value="#{edual.yearPassing}">
<f:selectItems value="#{edual.yearPassingTM}"/>
</h:selectOneMenu>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Qualification"/>
</f:facet>
<h:selectOneMenu id="NoYears11" value="#{edual.qualification}">
<f:selectItems value="#{edual.qualificationTM}"/>
</h:selectOneMenu>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Specialisation"/>
</f:facet>
<h:inputText id="SpecialisationTextBox1" value="#{edual.specialisation}"/>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Specialisation"/>
</f:facet>
<h:inputText id="SpecialisationTextBox1" value="#{edual.specialisation}"/>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="School"/>
</f:facet>
<h:inputText id="SchoolTextBox1" value="#{edual.school}"/>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Total Marks"/>
</f:facet>
<h:inputText id="MarksTextBox1" value="#{edual.cgpa}"/>
</h:column>


</h:dataTable>

<h:commandButton id="addRow1" type="submit" value="AddRow" immediate="true" action="#{bioData.addEdu}"/>


<h:dataTable var="str" value="#{bioData.strList}">
<h:column>
<f:facet name="header" >
<h:outputText value="sno"/>
</f:facet>
<h:inputText id="snoTextBox" value="#{str.sno}"/>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Stengths"/>
</f:facet>
<h:inputText id="StengthsTextBox" value="#{str.strengths}"/>
</h:column>

<h:column>
<f:facet name="header" >
<h:outputText value="Weaknesses"/>
</f:facet>
<h:inputText id="WeaknessesTextBox" value="#{str.weaknesses}"/>
</h:column>

</h:dataTable>

<h:commandButton id="addRow2" type="submit" value="Add Row" immediate="true" action="#{bioData.addWks}"/>
<h:outputLabel id = "saveLabel" value="Enter Name"/>
<h:inputText id="saveTextBox" value="#{bioData.bioName}"/>
<h:commandButton id="savebutton" type="submit" value="Save" action="#{bioData.saveBio}"/>
</h:form>

------------------------Backing Bean--------------------------------
package com.minerva.trainees;

import java.util.HashMap;

public class BioDataHomeBackingBean
{
String selectBio;
HashMap selectBioHM;
public BioDataHomeBackingBean() {
selectBioHM = new HashMap();
selectBioHM.put("Create BioData", "Create BioData");
}
public String processBioData()
{
String select_tmp = getSelectBio();
String action="";
if(select_tmp.equalsIgnoreCase("Create BioData"))
{
action= "displayCompetency@rgsRequest";
}
return action;
}
public String saveBio() throws Exception
{
System.out.println("########################Inside saveBio##################");
return "success";
}
public String getSelectBio() {
return selectBio;
}
public void setSelectBio(String selectBio) {
this.selectBio = selectBio;
}
public HashMap getSelectBioHM() {
return selectBioHM;
}
public void setSelectBioHM(HashMap selectBioHM) {
this.selectBioHM = selectBioHM;
}
}
-----------------------------faces config----------------------
<managed-bean>
<managed-bean-name>MyNameBB</managed-bean-name>
<managed-bean-class>com.minerva.trainees.MyNameBackingBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>bioData</managed-bean-name>
<managed-bean-class>com.minerva.trainees.BioDataBackingBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>bioDataHome</managed-bean-name>
<managed-bean-class>com.minerva.trainees.BioDataHomeBackingBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>bioTest</managed-bean-name>
<managed-bean-class>com.minerva.trainees.TestBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>objBioDataVo</managed-bean-name>
<managed-bean-class>com.minerva.trainees.BioDataVo</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi narendran,
You are calling the wrong managed bean from your action method.According to your mapping you should call bioDataHome.saveBio from your jsf page cause the saveBio method is present in the managedbean mapped with "bioDataHome".

Ketan.
 
    Bookmark Topic Watch Topic
  • New Topic