超链接未在xhtml页面上显示

时间:2013-05-05 19:41:51

标签: java jsf glassfish-3

超链接没有显示在页面上,我部署在glassfish服务器上。下面是image.Under产品部分都是超链接

enter image description here

下面是代码

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core">
<head>

<title>eBusiness</title>
</head>
<body>
<table>
<tr>
<td>
<h1 style="background-color:#4863A0;color:white;">eBusiness: Product, Customer, and Order Management</h1>
</td>
</tr>
</table>
<f:view>
<h:form>
<table>
<tr><td><h2>PRODUCTS</h2>
</td>
</tr>
</table>
<table>
<tr>
<td>
<h:outputLink  value="createbook.xhtml">Create a new Book</h:outputLink>|</td><td><h:outputLink  value="viewbooklist.xhtml">The Stock of Books</h:outputLink>|</td><td><h:outputLink  value="searchbooks.xhtml">Search for Books</h:outputLink></td>
</tr>
<tr>
<td>
<h:outputLink  value="createcds.xhtml">Create a new CDs</h:outputLink>|</td><td><h:outputLink  value="viewcdslist.xhtml">The Stock of CDs</h:outputLink>|</td><td><h:outputLink  value="searchcds.xhtml">Search for CDs</h:outputLink></td>
</tr>
</table>
<table>
<tr><td><h2>CUSTOMERS</h2>
</td>
</tr>
</table>
<table>
<tr>
<td>
<h:outputLink  value="createcustomer.xhtml">Create a new Customer</h:outputLink>|</td><td><h:outputLink  value="viewcustomerlist.xhtml">List of Customers</h:outputLink>|</td><td><h:outputLink  value="searchcustomer.xhtml">Search for a Customers</h:outputLink></td>
</tr>
</table>
<table>
<tr><td><h2>ORDERS</h2>
</td>
</tr>
</table>
<table>
<tr>
<td>
<h:outputLink  value="createorders.xhtml">Create a new Order</h:outputLink>|</td><td><h:outputLink  value="vieworderslist.xhtml">List of Orders</h:outputLink>|</td><td><h:outputLink  value="searchorders.xhtml">Search for an Orders</h:outputLink></td>
</tr>
</table>
</h:form>
</f:view>
</body>
</html>


请任何人都可以让我知道背后的原因是什么

更新:

不仅所有页面都没有渲染(只显示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>RetailProducts</display-name>
  <welcome-file-list>
    <welcome-file>createcustomer.xhtml</welcome-file><!-- eBusiness.xhtml</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>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <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>
    <description>
    This parameter tells MyFaces if javascript code should be allowed in
    the rendered HTML output.
    If javascript is allowed, command_link anchors will have javascript code
    that submits the corresponding form.
    If javascript is not allowed, the state saving info and nested parameters
    will be added as url parameters.
    Default is 'true'</description>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <description>
    If true, rendered HTML code will be formatted, so that it is 'human-readable'
    i.e. additional line separators and whitespace will be written, that do not
    influence the HTML code.
    Default is 'true'</description>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <description>
    If true, a javascript function will be rendered that is able to restore the
    former vertical scroll on every request. Convenient feature if you have pages
    with long lists and you do not want the browser page to always jump to the top
    if you trigger a link or button action that stays on the same page.
    Default is 'false'
</description>
    <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
    <param-value>true</param-value>
  </context-param>
<!--   <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener> -->
<!--     <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener> -->
</web-app>

1 个答案:

答案 0 :(得分:1)

将servlet映射添加为* .xhtml后,其工作正常

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>