aspose file tools*
The moose likes JSF and the fly likes JSF action doesn't call bean method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF action doesn Watch "JSF action doesn New topic
Author

JSF action doesn't call bean method

ket bhav
Greenhorn

Joined: Aug 28, 2011
Posts: 22
This is helloworld learning of JSF. Please help to resolve this issue. I tried with various sites, and did as per they suggest but could not resolve.

This is first page addPatient.jsp from where need to call method of backing bean to save that data and then redirect to view page.



faces-config.xml is as follows




PatientBackingBean.java is as follows...




And at last viewPage.jsp - no need to put it here but...



Guys please advice, I am checking it from last 3 hours but could not get any answer.
Jagadeeswara Yaramala
Ranch Hand

Joined: Jul 28, 2010
Posts: 46
Some mistakes that I can think of:

1) In the faces-config.xml, you have put the following:


The file names are not correct as per your posting. That should be:



2) You have posted that the file name is viewPage.jsp, but that is not the same as viewPatient.jsp

3) Your backing bean has got a "dOB" as Date type. The addPatient.jsp has String being passed. That is not correct and you will get Expression Language error.

HTH

jimmy Auction
Greenhorn

Joined: Jan 26, 2012
Posts: 5
package com.util.ui;

import java.io.Serializable;
import java.util.Date;

public class PatientBackingBean implements Serializable{

private long ID;
private String firstName;
private String lastName;
private Date dOB;

public PatientBackingBean() {
System.out.println("PatientBackingBean called and instuntiated");
}

public long getID() {
return ID;
}
public void setID(long iD) {
ID = iD;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Date getdOB() {
return dOB;
}
public void setdOB(Date dOB) {
this.dOB = dOB;
}

public String save(){
System.out.println("Entered the save method");
System.out.println("Exited the save method");
return "success";
}
}
 
 
subject: JSF action doesn't call bean method