简体   繁体   中英

Unknown jsf tag in xhtml page in jsf application

This is my first application with eclipse and jsf and i having some problems.

Here is my project structure:

eclipse project structure

I have downloaded and used JSF 2.1 (Mojarra 2.1.6-FCS) jar file and there is only a single jar file in that and i have used that jar file as a user library.

Now the problem i am facing is that when i use h:head in my index.xhtml file it shows that h:head is an unkown tag.Of course i am using anugular brackets. besides h:head , i am not able to type that in here.

here is my index.xhtml file:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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">
  <h:head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
   <title>Insert title here</title>
  </h:head>
  <body>

  </body>
  </html>

What is wrong here? IS there only one jar file file to be included?

also there are some white packages marks in the jar file i included...here they are: while package in jar what does it mean?

The problem is that you haven't defined the h prefix anywhere in your file. If you follow a JSF 2 tutorial, you will note this in the <html> tag definition (this one is taken from StackOverflow JSF wiki ):

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

Where

  • h for JSF HTML tags like <h:head> , <h:body> , <h:inputText> , etc.
  • f is the prefix for JSF core like <f:view> , <f:selectItems> , <f:ajax> , etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM