# JSF problem



## silverlight4 (Aug 24, 2010)

Following facelet page is not rendering properly in the browser


```
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "*www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="*www.w3.org/1999/xhtml"
      xmlns:h="*java.sun.com/jsf/html">
    <h:head>
        <title>Create a New Book</title>
    </h:head>
    <h:body>
        <h4>Create a new Book</h4>
        <br/>
        <h:form>
            <table>
                <tr>
                    <td><h:outputLabel value="ISBN: " ></h:outputLabel></td>
                    <td><h:inputText value="#{bookController.book.isbn}"></h:inputText></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="Title " /></td>
                    <td><h:inputText value="#{bookController.book.title}"/></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="Price: " /></td>
                    <td><h:inputText value="#{bookController.book.price}"/></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="Descriptiom: " /></td>
                    <td><h:inputTextarea value="#{bookController.book.description}" cols="20" rows="5"/></td>
                </tr>

                <tr>
                    <td><h:outputLabel value="Number Of Pages: " /></td>
                    <td><h:inputText value="#{bookController.book.nbofpages}"/></td>
                </tr>

                <tr>
                    <td><h:outputLabel value="Illustrations: " /></td>
                    <td><h:selectBooleanCheckbox value="#{bookController.book.illustration}"/></td>
                </tr>
            </table>
            <h:commandButton action="#{bookController.doCreateBook}" value="Create a Book" />
        </h:form>
    </h:body>
</html>
```

It is only showing "Create new book" and nothing else.
What is the problem with the code?


----------



## furious_gamer (Aug 24, 2010)

You must use 
<%@ taglib uri="*java.sun.com/jsf/html" prefix="h" %>

this to import the taglib. Otherwise how did the page does know what

is h:form?


----------



## silverlight4 (Aug 24, 2010)

It is giving this error
XML Parsing Error: not well-formed

```
<%@ taglib uri="[URL]*java.sun.com/jsf/html[/URL]" prefix="h" %>
-^
```
It is an xhtml document


----------



## furious_gamer (Aug 24, 2010)

silverlight4 said:


> It is giving this error
> XML Parsing Error: not well-formed
> 
> ```
> ...



What kinda mapping you did for your JSP pages?


----------



## silverlight4 (Aug 24, 2010)

Thanks @rajkumar_pb
Its now solved. 
There was a problem with the mapping in web.xml


----------



## furious_gamer (Aug 25, 2010)

^^

If you tell us what was the problem, it will help someone else.


----------



## silverlight4 (Aug 25, 2010)

In web.xml mapping was for /faces/*
but i was directly hitting the facelet page using /newBook.xhtml instead of
/faces/newBook.xhtml


----------



## furious_gamer (Aug 26, 2010)

^^

thats really a careless mistake . Anyway thanks for sharing.


----------

