无法查看rich:panel

时间:2013-10-02 05:29:35

标签: eclipse jsf richfaces

我是JSF和richfaces的新手。我创建了一个AddEmployee.xhtml,其中包含rich:panels,rich:dropDownMenu和rich:toolbar。这个xhtml是我的应用程序的一部分。在运行时,当我从其他页面到达它时,我能够看到它的内容,但无法看到rich:面板(面板边框)。但是,当我直接将此AddEmployee.xhtml作为“在服务器中运行”运行时,我可以查看此面板。我的问题是,当我从其他页面到达页面时,我无法看到此面板布局?

我使用Eclipse IDE(juno)。 我正在使用的罐子是..

commons-beanutils-1.8.3.jar, commons-codec-1.3.jar, commons-collections-3.2.jar, commons-configuration-1.0.jar, commons-diagester-1.8.jar, commons-discovery-0.4.jar, 
commons-logging-1.1.1.jar, jsf-api-2.1.7.jar, jsf-impl-2.1.7.jar, jstl.jar, 

cssparser-0.9.5.jar,guava-11.0.rc1.jar,richfaces-components-api.4.3.2.Final.jar richfaces-components-ui-4.3.2.Final.jar,richfaces-core-api-4.3.2.Final.jar,richfaces-core-impl-4.3.2.Final.jar,sac-1.3.jar

在faces-config.xml

<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<managed-bean>
<managed-bean-name>MenuBean</managed-bean-name>
<managed-bean-class>org.com.bean.MenuBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
    <managed-bean-name>UserLogin</managed-bean-name>
<managed-bean-class>org.com.bean.UserLogin</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
        <managed-bean-name>EmployeeMaster</managed-bean-name>
        <managed-bean-class>org.com.bean.EmployeeMaster</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-case>
    <from-action>#{MenuBean.addEmployee}</from-action>
    <from-outcome>AddEmployee</from-outcome>
    <to-view-id>/employee/AddEmployee.xhtml</to-view-id>
</navigation-case>
</faces-config>

Header.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">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets">


<rich:toolbar height="46px">
        <rich:dropDownMenu mode="ajax" verticalOffset="1">
            <f:facet name="label">
                <h:outputText value="Home"/>
            </f:facet>
    <rich:menuItem label="Home" action="#{MenuBean.showHome}"></rich:menuItem>
        </rich:dropDownMenu>
        <rich:dropDownMenu mode="ajax">
            <f:facet name="label" >
                <h:outputText value="Employee"/>
            </f:facet>
      <rich:menuItem label="AddEmployee" action="#{MenuBean.addEmployee}">
      </rich:menuItem>
<rich:menuItem label="EmployeeDetails" action="#MenuBean.showEmployeeDetails}"/>
<rich:menuItem label="TerminateEmployee" action="#{MenuBean.terminateEmployee}"/>
<rich:menuItem label="UpdateEmployee" action="#{MenuBean.updateEmployee}"/>
        </rich:dropDownMenu>
    </rich:toolbar>
 </ui:composition>

Login.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">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
    <title> Login </title>
</h:head>

<body>
<h:form>
<center>
<rich:panel header="Login" style="text-align:left;font-style:normal;               text-decoration:none;width : 343px; height : 181px; color: Black;">
    <center>

        <h:outputText value="Username"/> &nbsp;  &nbsp;  &nbsp;
<h:inputText id="username" value="#{UserLogin.userName}" required="true"/>
            <h:outputText value="&lt;br/&gt;" escape="false" />
            <h:outputText value="&lt;br/&gt;" escape="false" />
        <h:outputText value="Password"/>  &nbsp;  &nbsp;  &nbsp;
<h:inputText id="password" value="#{UserLogin.userPwd}" required="true"/>
            <h:outputText value="&lt;br/&gt;" escape="false" />
            <h:outputText value="&lt;br/&gt;" escape="false" />

        <h:commandButton value="Login"
                    action="#{UserLogin.login}" />   &nbsp; &nbsp; &nbsp;
        <h:commandButton type="reset" value="reset"/> 

    </center>
</rich:panel>
</center>
</h:form>
</body>
</ui:composition>

AddEmployee.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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
    <title> Add new employee </title>
</h:head>

<body>
<h:form>

    <ui:insert name="CommonHeader">
        <ui:include src="/Header.xhtml"></ui:include>
    </ui:insert>    

<!-- Header definition over -->
        <br></br>
        <table align="left" cellspacing="0" border="0" cellpadding="5">
          <tr><td> 
          <rich:panel header="Employee Primary Details" style="text-align:left;font-style:normal;text-decoration:none;width : 350px; height : 200px;" rendered="true">

            <h:outputText value="Enter User name : "  style="FONT-WEIGHT: bold;"/> &nbsp;&nbsp;     
            <h:inputText id="empIde" value="#{EmployeeMaster.empId}" />

            <br/><br/>

            <h:outputText value="Enter firstname : " style="FONT-WEIGHT: bold;"/> &nbsp;&nbsp;&nbsp;&nbsp;
            <h:inputText id="firstNamee" value="#{EmployeeMaster.firstName}" />
            <br/><br/>

            <h:outputText value="Enter lastName : " style="FONT-WEIGHT: bold;"/> &nbsp;&nbsp;&nbsp;&nbsp;
            <h:inputText id="lastNamee" value="#{EmployeeMaster.lastName}"  />
            <br/><br/>

            <h:outputText value="Person Type :"  style="FONT-WEIGHT: bold;"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <h:selectOneMenu id ="personType" value="#{EmployeeDetailBean.personType}">
                <f:selectItem itemValue="ASE-T" itemLabel="ASE-T" />
                <f:selectItem itemValue="BA" itemLabel="BA" />
                <f:selectItem itemValue="Business Associate" itemLabel="Business Associate" />
                <f:selectItem itemValue="Employee" itemLabel="Employee" />
            </h:selectOneMenu>
            <br/><br/>

        </rich:panel>           
    </td></tr></table></h:form> </body> </html>

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>roaster1</display-name>
  <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
  <servlet-name>Faces Servlet</servlet-name>
  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
 <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
  <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
 <listener>
   <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
 </listener>
 <listener>
    <listener-class>org.com.init.Listener</listener-class>
  </listener>
</web-app>

当我编辑两个XHTML的源代码时,我发现其中缺少以下内容......

<link href="/roaster2/faces/rfRes/panel.ecss?db=eAHjW!XqPQAE!QKS&ln=org.richfaces" rel="stylesheet" type="text/css"></link>
 <script src="/roaster2/faces/javax.faces.resource/json-dom.js?ln=org.richfaces" type="text/javascript"></script>
 <script src="/roaster2/faces/javax.faces.resource/jquery.effects.core.js?ln=org.richfaces" type="text/javascript"></script>
 <script src="/roaster2/faces/javax.faces.resource/jquery.effects.highlight.js?ln=org.richfaces" type="text/javascript"></script>
 <script src="/roaster2/faces/javax.faces.resource/JQuerySpinBtn.js?ln=org.richfaces" type="text/javascript"></script>
 <script src="/roaster2/faces/javax.faces.resource/calendar-utils.js?ln=org.richfaces" type="text/javascript"></script>
 <script src="/roaster2/faces/javax.faces.resource/calendar.js?ln=org.richfaces" type="text/javascript"></script>
 <link href="/roaster2/faces/rfRes/calendar.ecss?db=eAHjW!XqPQAE!QKS&ln=org.richfaces" rel="stylesheet" type="text/css"></link>

1 个答案:

答案 0 :(得分:0)

在这些情况下,您最好的帮助是网络检查员等工具。在Firefox中,您可以使用Firebug(插件)或“右键单击元素 - &gt; Inspect元素”。 Chrome还包含这样的工具。这些工具允许您检查所有Web元素(DOM树,CSS,JavaScript等),因此您可以随时检查您在任何元素中具有的HTML或CSS属性。

您可能的解决方案是,当您将其包含在其他页面中时,面板边框会被组件所在容器的边框隐藏。

我希望这个答案可以帮到你,

此致