我有以下Primefaces頁面和控制器。與元素類型「p:dataList」關聯的屬性「pt:data-inset」的前綴「pt」未綁定
頁
<!DOCTYPE html>
<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:pm="http://primefaces.org/mobile">
<f:view renderKitId="PRIMEFACES_MOBILE"/>
<h:head>
</h:head>
<h:body id="body">
<pm:page id="page">
<pm:header title="MyProduct">
</pm:header>
<pm:content id="content">
<p:dataList value="#{likeditems.likedItems}" var="item" pt:data-inset="true" paginator="true" rows="5">
<f:facet name="header">
List of Cars
</f:facet>
<h:outputLink value="#{item.url}">
<h2>#{item.title}</h2>
<p>#{item.price}</p>
<p class="ui-li-aside"><strong>XXXX</strong></p>
</h:outputLink>
<f:facet name="footer">
List of Cars
</f:facet>
</p:dataList>
<p:outputLabel
id="priceHint"
value="..."
cache="false"/>
</pm:content>
<pm:footer title="m.MyProduct.info"></pm:footer>
</pm:page>
</h:body>
</html>
控制器
@ManagedBean(name = LikedItemsView.NAME)
@SessionScoped
public class LikedItemsView {
public static final String NAME = "likeditems";
public List<LikedItem> getLikedItems()
{
final LikedItem item1 = new LikedItem();
item1.setTitle("Product 1");
item1.setPrice(Money.of(CurrencyUnit.USD, 20));
item1.setUrl("http://google.com");
final LikedItem item2 = new LikedItem();
item2.setTitle("Product 2");
item2.setPrice(Money.of(CurrencyUnit.USD, 30));
item2.setUrl("http://yandex.ru");
final List<LikedItem> items = new LinkedList<LikedItem>();
items.add(item1);
items.add(item2);
return items;
}
}
當我訪問該頁面時,我得到以下錯誤:
servlet.ServletException: Error Parsing /likeditems.xhtml: Error Traced[line: 31] The prefix "pt" for attribute "pt:data-inset" associated with an element type "p:dataList" is not bound.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
第31行是這樣的:
<p:dataList value="#{likeditems.likedItems}" var="item" pt:data-inset="true" paginator="true" rows="5">
我該如何解決這個錯誤?
它應該只是數據插圖而不是pt:data-inset –
@PradyumnaSwain很好,它有幫助。請提交您的評論作爲答案,我會接受它。謝謝! –
歡迎好友。請接受我的回答。 –