JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Web Framework » JSF  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 要執行jsf網頁卻一直出現Cannot find FacesContext??
pogi

~看的越多懂得越少~



發文: 160
積分: 4
於 2004-10-28 14:05 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我的執行環境:
windows 2000 sp4
j2sdk1.4.2_5
Tomcat 5.0.27
eclipse 3.0.1 + myeclipse3.8.2

網站結構
index.jsp
/web-inf/web.xml
/web-inf/tld/c.tld( html_basic.tld 與 jsf_core.tld 附加在 jsf-impl.jar 內)
/web-inf/lib/jsf-api.jar, jsf-impl.jar

index.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<%@ page language="java" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <!--
  <link rel="stylesheet" type="text/css" href="styles.css">
  -->
<meta http-equiv="Content-Type" content="text/html; charset=big5"></head>
 
<body>
<f:view>
<h:form>
<table width="90%" border="0" align="center" bgcolor="#66CCFF">
  <tr>
    <td>您的姓名:</td>
    <td><h:inputText size="10" /></td>
  </tr>
  <tr>
    <td>您的暱稱:</td>
    <td><h:inputText size="20" /></td>
  </tr>
  <tr>
    <td colspan='2' align='left'>
      <h:commandButton value="新增" />
  </tr>
</table>
</h:form>
</f:view>
</body>
</html>


web.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
  <description>Welcome to HRMS Web System</description>
  <display-name>HRMS v1.0</display-name><!--session 存活時間為 10 分鐘-->
  <session-config>
    <session-timeout>10</session-timeout>
  </session-config>
  <jsp-config><!--JSTL 1.1 標籤庫 c-rt.tld -->
    <taglib>
      <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
      <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
    </taglib><!--JSF 1.0 標籤庫 jsf_core.tld-->
    <taglib>
      <taglib-uri>http://java.sun.com/jsf/core</taglib-uri>
      <taglib-location>/WEB-INF/tld/jsf_core.tld</taglib-location>
    </taglib><!--JSF 1.0 標籤庫 html_basic.tld-->
    <taglib>
      <taglib-uri>http://java.sun.com/jsf/html</taglib-uri>
      <taglib-location>/WEB-INF/tld/html_basic.tld</taglib-location>
    </taglib>
  </jsp-config>
<!--
  <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
-->
</web-app>


照理說這樣應該可以顯示出jsf元件才對,可是卻出現
1
2
3
4
5
description 
The server encountered an internal error () that prevented it from fulfilling this request.
 
exception 
javax.servlet.ServletException: Cannot find FacesContext


我也試過把jsf-api.jar,jsf-impl.jar放在c:\tomcat\common\lib下
或是在classpath也加上路徑
但是就是無法執行,可是執行JavaServer Faces互動式網站介面(o'reilly出版)的範例都很成功,不知道各位前輩高手可否指教一二呢??


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
7158 要執行jsf網頁卻一直出現Cannot find FacesContext?? pogi 2904 2004-10-28 14:05
6059 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? seeya168 60 2004-10-28 21:50
5584 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? koji 60 2004-10-29 01:53
5555 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? pogi 145 2004-10-29 07:51
5640 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? pogi 196 2004-10-29 08:29
2189 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? Prinston 345 2008-04-03 22:14
5347 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? edwardlin 579 2004-12-23 14:42
5887 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? javalien 663 2006-01-11 09:45
2397 Re:要執行jsf網頁卻一直出現Cannot find FacesContext?? psalm 771 2008-02-29 17:50
» JWorld@TW »  Web Framework » JSF

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8