• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF action doesn't call bean method

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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";
}
}
reply
    Bookmark Topic Watch Topic
  • New Topic