1

New to JSF, I try to display a list of data. In a JSP file, I have the following

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html xmlns = "http://www.w3.org/1999/xhtml" xmlns:h = "http://java.sun.com/jsf/html">

  <head>      
    <title>A title</title>
    <link href="../css/menu.css" rel="stylesheet" type="text/css"/>
    <link href="../css/tabs.css" rel="stylesheet" type="text/css"/>
    <script language="JavaScript1.2" src="../javascript/coolmenus4.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>        
  </head>

<body>

    <f:view>
        <h:dataTable value="#{someBean.someItemClassList}" var="foo">

        <h:column>
          <f:facet name="header">Some Thing</f:facet>
          #{foo.boo}
        </h:column>

        </h:dataTable>
    </f:view>
  </body>
</html>

I can't see any syntax errors in the above.

The managed bean is something like

public class SomeClass {

  private List<SomeItemClass> someItemClassList;
  ....

  public List<SomeItemClass> getSomeItemClassList(){ ...}
}

On the page, the part is shown as

Some Thing #{foo.boo} 

but not the data itself.

What is missing?

Update:

I thought I missed a declaration xmlns:f="http://xmlns.jcp.org/jsf/core in the JSP file. Adding it doesn't change any output.

Update 2

The problem was caused by using the class name instead of what the class name defined in the faces-config.xml file.

vw_tsc
  • 7
  • 3
  • could you give as the entire xhtml file? – Ismail Mar 28 '19 at 16:14
  • 1
    @M.Ismail Thanks and I repost with the most part of the file. – vw_tsc Mar 28 '19 at 16:25
  • Always create a [mcve]. And what do you see when you do a 'view source' on the client? – Kukeltje Mar 28 '19 at 16:44
  • I didn't post the whole files or all related files because I didn't think the omission was related with the problem. – vw_tsc Mar 28 '19 at 17:30
  • You failed to mention which version of JSF you are using. However, considering you get `#{foo.boo}` - this sounds like its not even running the page through the Faces Servlet - are you sure you have your matching towards JSF set up correctly ? If you view the source code of the page in the browser and the JSF tags like `` have not been translated to regular HTML - it means its not passing the page through the Faces Servlet and you have a configuration error. – Adam Waldenberg Mar 28 '19 at 19:27
  • @Kukeltje Oh that's funny - we posted almost the same comment at the same time. ;) But yeah, I agree - this particular issue is almost always caused by this. – Adam Waldenberg Mar 28 '19 at 19:34
  • Ragarding your 'update': That is a JSF 2.2 namespace, not appplicable to your JSF 1.2 (or older) application. – Kukeltje Mar 28 '19 at 21:00
  • Regarding your second update: that **is** answer, although I'm pretty sure you changedomething else that made this work (or it is ancient prehistoric behaviour that since has improved to result in logical readble errors) – Kukeltje Mar 28 '19 at 22:50
  • 2
    Hi "new to JSF", JSP as JSF view technology has been deprecated in 2009. That's a decade ago. In information technology that's like a century. Please catch up your learning resources and make sure that they are authoritative and up to date and match the currently latest available versions. – BalusC Mar 29 '19 at 10:14
  • @Kukeltje I am not aware any other changes. – vw_tsc Mar 29 '19 at 14:15
  • @BalusC I am fully aware that the technology was decade old. I am bought in to work on an old system. Other than the web technology, they place all business logic in stored procedures. In my controlled world, I use Spring Boot. – vw_tsc Mar 29 '19 at 14:21

0 Answers0