0

I am trying to create a simple “hello world” example in JSF. I have one page (xhtml), a bean class which is contains list of POJO classes, and POJO class.
When I start the project It gives following error message .

javax.servlet.ServletException: /PageTemplates/commonHeader.xhtml @12,48 
value="#{current.Menutext}": The class 'com.abank.pojo.MenuItem' does not 
have the property 'Menutext'.

Here is my tempalte XHTML page.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
        <ui:composition>
<ul class="nav nav-pills">
<ui:repeat value="#{menuBean.menuItems}" var="current">
<li><h:outputText value="#{current.Menutext}"/></li>
</ui:repeat>
</ul>
        </ui:composition>
    </body>
</html>

And My Bean Class which contains List Of MenuItem Class (POJO class).

@Named
@ApplicationScoped
public class MenuBean implements Serializable {



    private List<MenuItem> menuItems;

 public List<MenuItem> getMenuItems(){

     return menuItems;
 }
 @PostConstruct
    public void init() {

     menuItems=new ArrayList<MenuItem>();
     MenuItem tempItem=null;


         tempItem=new MenuItem();
         tempItem.setMenuid(1) ;
         tempItem.setMenutext("Hesaplar");
         menuItems.add(tempItem);
         tempItem=new MenuItem();
         tempItem.setMenuid(2);
         tempItem.setMenutext("Para Transferleri");
         menuItems.add(tempItem);
         tempItem=new MenuItem();
         tempItem.setMenuid(3);
         tempItem.setMenutext("Kredi Kartları");
         menuItems.add(tempItem);
         tempItem=new MenuItem();
         tempItem.setMenuid(4);
         tempItem.setMenutext("Ödemeler");
         menuItems.add(tempItem);

 }

} 

And last one is the POJO class .

@ApplicationScoped
public class MenuItem {
     /**
     * 
     */
    private static final long serialVersionUID = -4642390001647219288L;

    private Integer menuid;
    private String menutext;

    public Integer getMenuid() {
        return menuid;
    }
    public void setMenuid(Integer menuid) {
        this.menuid = menuid;
    }
    public String getMenutext() {
        return menutext;
    }
    public void setMenutext(String menutext) {
        this.menutext = menutext;
    }




}

As you can see there is public getMenutext getter method in POJO class but compiler says there is not ?

Thanks.

Hi again , I have found out the problem .My mistake is in naming. Property name must be start with a lowercase .

javax.el.PropertyNotFoundException: Property 'Name' not found on type

Community
  • 1
  • 1
ilhan
  • 125
  • 2
  • 13
  • I've checked 2 answers but I think this is not solution . I already have getter and setter methods for menutext field as I've written in my quesiton. – ilhan May 21 '17 at 04:53
  • Don't forget to read the last paragraph of the first answer. – BalusC May 21 '17 at 08:43

0 Answers0