找不到JSF中方法的属性

时间:2015-11-25 17:04:41

标签: java jsf xhtml

我检查了它的所有方式而不是区分大小写的问题。但是我在bean和jsf页面中都有相同的命名约定但仍然没有找到错误属性。

我正在使用primefaces-5.2,我在WEB-INF/lib中拥有该jar。

以下是代码:

Bean类

public class User implements Serializable{
    public String getSomeMethod(){
        System.out.println("Hi from SomeMethod");
        return "";
     }
 }

my index.XHTMl page。

<!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:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets" >

    <h:head>
        <!-- Mimic Internet Explorer 8 -->
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"  />
        <title>User Details</title>
        <script type="text/javascript">
            window.location.hash="no-back-button";
            window.location.hash="Again-No-back-button";
            //again because google chrome don't insert first hash into history
            window.onhashchange=function(){
                window.location.hash="no-back-button";
            }
          </script> 
    </h:head>

    <h:body>
        <h:outputStylesheet library="css" name="application.css" />
        <img height="80" width="100%" src="#{facesContext.externalContext.requestContextPath}/images/LSHeader.jpg" alt="logo" />
        <form name="myform" action="#{user.getSomeMethod}" method="post"></form>
    </h:body>
</html>     

面孔-配置

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
              version="2.0">

    <managed-bean>
        <managed-bean-name>user</managed-bean-name>
        <managed-bean-class>com.tn.gov.User</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
 </faces-config>

错误我收到的内容。

  

javax.el.E​​LException:/index.xhtml:Property&#39; getSomeMethod&#39;找不到类型com.tn.gov.User

0 个答案:

没有答案