我试图通过从展示中获取代码来使我的页面上出现primefaces元素,菜单在经过一些修改后运行良好但是selectonemenu拒绝出现。
它没有在布局单元中显示任何内容。
这是我的xhtml代码:
<?xml version='1.0' encoding='UTF-8' ?>
<!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:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Consultation Travaux Soumis (Etudiant)</title>
<style type="text/css">
.ui-widget,.ui-widget .ui-widget {
font-size: 90% !important;
}
</style>
</h:head>
<body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="158" header="Intranet" resizable="false" closable="false" collapsible="false">
<h:graphicImage value="/img/Logo.jpg" width="110" height="110"/>
<h:outputText value=" Consultation de la liste de travaux" />
</p:layoutUnit>
<p:layoutUnit position="west" size="200" header="Menu" resizable="true" closable="true" collapsible="true">
<h:form id="pmenu">
<p:menu style="width:90%">
<p:submenu label="Navigation">
<p:menuitem value="Acceuil" action="#" immediate="true" icon="ui-icon ui-icon-home"/>
<p:menuitem value="Deconnexion" action="#{PagesController.logout}" immediate="true" icon="ui-icon ui-icon-locked"/>
</p:submenu>
<p:submenu label="Services">
<p:menuitem value="Emploi du Temps" actionListener="#" immediate="true" ajax="false" icon="ui-icon ui-icon-suitcase" disabled="true"/>
<p:menuitem value="Relevé de Notes" actionListener="#" immediate="true" ajax="false" icon="ui-icon ui-icon-folder-collapsed" disabled="true"/>
<p:menuitem value="Remise de Doc." url="/secure/remisetrEt.xhtml" immediate="true" ajax="false" icon="ui-icon ui-icon-folder-open" />
</p:submenu>
<p:submenu label="Infos">
<p:menuitem value="Réclamation" actionListener="#" immediate="true" ajax="false" icon="ui-icon ui-icon-alert" />
<p:menuitem value="A Propos" actionListener="#" immediate="true" ajax="false" icon="ui-icon ui-icon-info" />
</p:submenu>
</p:menu>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form>
<h:panelGrid columns="1" style="margin-bottom:10px" cellpadding="5">
<p:selectOneMenu>
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItem itemLabel="Option 1" itemValue="1" />
<f:selectItem itemLabel="Option 2" itemValue="2" />
<f:selectItem itemLabel="Option 3" itemValue="3" />
</p:selectOneMenu>
</h:panelGrid>
</h:form>
</p:layoutUnit>
</p:layout>
</body>
</html>
答案 0 :(得分:0)
您的代码有效。您使用的是哪个版本的primefaces?您正在部署哪个应用服务器?您测试过哪种浏览器?除了selectonemenu之外,页面上还有其他内容吗?
尝试以下方法。使用Glassfish 3上的Primefaces 4。
<?xml version='1.0' encoding='UTF-8' ?>
<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"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
<title>Test</title>
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/css/default.css" />
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/css/custom.css" />
</f:facet>
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="1" style="margin-bottom:10px" cellpadding="5">
<p:selectOneMenu>
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItem itemLabel="Option 1" itemValue="1" />
<f:selectItem itemLabel="Option 2" itemValue="2" />
<f:selectItem itemLabel="Option 3" itemValue="3" />
</p:selectOneMenu>
</h:panelGrid>
</h:form>
</h:body>
</f:view>
</html>
答案 1 :(得分:0)
问题是我必须将selectonemenu
绑定到我拥有的托管bean的属性。