2011-02-10 80 views
1

我有引入了menu.jsp的內容如下JSF菜單沒有得到顯示

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %> 
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 
<html> 
<head> 
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" /> 
    <title>MyFaces - the free JSF Implementation</title> 
    <link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/pages/css/basic.css" /> 
</head> 
<body> 
<f:view> 

    <jsp:include page="menucontents.jsp" /> 
</f:view> 
</body> 
</html> 

爲menucontents.jsp的內容如下

<f:subview id="menucontents"> 
    <f:loadBundle basename="com.cpc.resources.menu" var="menu"/> 
    <t:div id="hNav_outer"> 
     <t:panelNavigation2 id="nav1" layout="list" itemClass="off" activeItemClass="on" openItemClass="on" 
          renderAll="true"> 
      <t:commandNavigation2 value="#{menu['menu_Home']}" style="padding-left: 0px;"> 
       <t:commandNavigation2> 
        <f:verbatim>&#8250; </f:verbatim> 
        <t:outputText value="#{menu['menu_Home']}"/> 
       </t:commandNavigation2> 
      </t:commandNavigation2> 
      <t:commandNavigation2 value="#{menu['menu_admin']}" style="padding-left: 150px;"> 
       <t:commandNavigation2> 
        <f:verbatim>&#8250; </f:verbatim> 
        <t:outputText value="#{menu['menu_admin_change_password']}"/> 
       </t:commandNavigation2> 
       <t:commandNavigation2> 
        <f:verbatim>&#8250; </f:verbatim> 
        <t:outputText value="#{menu['menu_admin_forgot_password']}"/> 
       </t:commandNavigation2> 
      </t:commandNavigation2> 

     </t:panelNavigation2> 
    </t:div> 
</f:subview> 

當我打電話引入了menu.jsp爲某些原因,我無法查看我配置的菜單,我只能在瀏覽器中看到「>>>」。

當我做我看到下面的HTML視圖源

<html> 
<head> 
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" /> 
    <title>MyFaces - the free JSF Implementation</title> 
    <link rel="stylesheet" type="text/css" href="/cpcnew/pages/css/basic.css" /> 
</head> 
<body> 



<f:subview id="menucontents"> 
    <f:loadBundle basename="com.cpc.resources.menu" var="menu"/> 
    <t:div id="hNav_outer"> 
     <t:panelNavigation2 id="nav1" layout="list" itemClass="off" activeItemClass="on" openItemClass="on" 
          renderAll="true"> 
      <t:commandNavigation2 value="#{menu['menu_Home']}" style="padding-left: 0px;"> 
       <t:commandNavigation2> 
        <f:verbatim>&#8250; </f:verbatim> 
        <t:outputText value="#{menu['menu_Home']}"/> 
       </t:commandNavigation2> 
      </t:commandNavigation2> 
      <t:commandNavigation2 value="#{menu['menu_admin']}" style="padding-left: 150px;"> 
       <t:commandNavigation2> 
        <f:verbatim>&#8250; </f:verbatim> 
        <t:outputText value="#{menu['menu_admin_change_password']}"/> 
       </t:commandNavigation2> 
       <t:commandNavigation2> 
        <f:verbatim>&#8250; </f:verbatim> 
        <t:outputText value="#{menu['menu_admin_forgot_password']}"/> 
       </t:commandNavigation2> 
      </t:commandNavigation2> 

     </t:panelNavigation2> 
    </t:div> 
</f:subview> 



<script type="text/javascript"><!-- 

    function getScrolling() 
    { 
     var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset) 
     { 
      x = self.pageXOffset; 
      y = self.pageYOffset; 
     } 
     else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop)) 
     { 
      x = document.documentElement.scrollLeft; 
      y = document.documentElement.scrollTop; 
     } 
     else if (document.body) 
     { 
      x = document.body.scrollLeft; 
      y = document.body.scrollTop; 
     } 
     return x + "," + y; 
    } 

//--></script> 
</body> 
</html> 

我很近又那麼遠會很感激,如果有人可以幫助我搞清楚這個問題

回答

1

難道這包含頁面完整?文件頭中缺少標籤庫。

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %> 
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 

這也是他們在HTML輸出中出現普通香草的原因。

+0

添加了taglib,但仍未獲取格式化菜單 – 2011-02-10 22:25:11