当前位置:编程学习 > JAVA >>

Myeclipse中应用jsf开发xhtml

test.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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" 
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"> 
<head>
<title>My Facelets Page</title>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="image易做图" content="no"/>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>

<!--<link rel="stylesheet" type="text/css" href="styles.css">-->
</head>
<body>
<h:outputText value="Hello World!" />
姓名:<h:inputText></h:inputText>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
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-app_2_5.xsd">

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

<!-- JSF的核心控制器 FacesServlet -->
    <servlet>
        <servlet-name>facesservlet</servlet-name>
        <servlet-class>javax.faces.webapp.facesservlet</servlet-class>
    </servlet>
<!--     faces servlet mapping -->
    <servlet-mapping>
        <servlet-name>facesservlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <context-param>  
    <param-name>javax.faces.CONFIG_FILES</param-name>  
    <param-value>/WEB-INF/faces-config.xml</param-value>  
 </context-param>   
 <context-param>  
     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>  
      <param-value>client</param-value>  
</context-param> 
<context-param>  
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>  
        <param-value>.xhtml</param-value>  
 </context-param> 
<!-- 配置RichFaces -->
<context-param>  
        <param-name>org.ajax4jsf.SKIN</param-name>  
        <param-value>blueSky</param-value>  
 </context-param> 
 <context-param>  
        <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>  
        <param-value>false</param-value>  
 </context-param> 
 <filter>  
        <display-name>Ajax4jsf Filter</display-name>  
        <filter-name>ajax4jsf</filter-name>  
        <filter-class>org.ajax4jsf.Filter</filter-class>  
        <init-param>  
            <param-name>forceparser</param-name>  
            <param-value>false</param-value>  
        </init-param>  
</filter>  
<filter-mapping>  
        <filter-name>ajax4jsf</filter-name>  
        <servlet-name>facesservlet</servlet-name>  
        <dispatcher>FORWARD</dispatcher>  
        <dispatcher>REQUEST</dispatcher>  
        <dispatcher>INCLUDE</dispatcher>  
</filter-mapping> 
<!--<listener>-->
<!-- <listener-class>-->
<!-- org.apache.myfaces.webapp.StartupServletContextListener</listener-class>-->
<!--</listener>-->
</web-app>
我写了test的一个页面,部署到tomcat没有错误,但是在浏览器访问test.xhtml什么也显示不出来,显示不出<h:>的所有标签,应该怎么解决!望高手指点。。。。。
补充:Java ,  Web 开发
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,