问题页面:

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ page import="java.util.Calendar"%>
<%@ page import="java.text.SimpleDateFormat"%>
<link href="css/table-style.css" rel="stylesheet" type="text/css" />
<html>
<f:view>
    <head>
<title>JSF 2.0 + Spring + Hibernate Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <h1>JSF + Spring + Hibernate</h1>
        <h:form>
            <h:dataTable value="#{customer.customerList}" var="c"
                styleClass="order-table" headerClass="order-table-header"
                rowClasses="order-table-odd-row,order-table-even-row">

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Customer ID" />
                    </f:facet>
                    <h:outputText value="#{c.customerId}"></h:outputText>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Name" />
                    </f:facet>
                    <h:outputText value="#{c.name}"></h:outputText>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Address" />
                    </f:facet>

                    <h:outputText value="#{c.address}"></h:outputText>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Created Date" />
                    </f:facet>

                    <h:outputText value="#{c.createdDate}"></h:outputText>
                </h:column>

            </h:dataTable>
        </h:form>
        <h2>Add New Customer</h2>
        <h:form>

            <h:panelGrid columns="3">
            
                Name : 
                <h:inputText id="name" value="#{customer.name}" size="20"
                    required="true" label="Name">
                </h:inputText>

                <h:message for="name" style="color:red" />
            
                Address : 
                <h:inputTextarea id="address" value="#{customer.address}" cols="30"
                    rows="10" required="true" label="Address">
                </h:inputTextarea>

                <h:message for="address" style="color:red" />

            </h:panelGrid>

            <h:commandButton value="Submit" action="#{customer.addCustomer()}" />

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

 

solutions:

1.project-->right click->properties->project Facets->add JavaServer Faces.

then refresh and rebuild project again and again until the errors disappear.

 

or

2.changed your jsp page to xhtml,then modified the page taglib using the below snap:

<!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"> 

 

done;

posted on 2013-08-28 13:05  七月逆流  阅读(3767)  评论(0编辑  收藏  举报