首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

eclipse中无法使用jsf标签,该如何处理

2013-09-11 
eclipse中无法使用jsf标签页面代码如下。是eclipse自动生成的,都没改。用jboss4做服务器。jsf包已经导入。%@p

eclipse中无法使用jsf标签
页面代码如下。是eclipse自动生成的,都没改。用jboss4做服务器。jsf包已经导入。
<%@   page   language= "java "   pageEncoding= "ISO-8859-1 "%>
<%@   taglib   uri= "http://java.sun.com/jsf/html "   prefix= "h "   %>
<%@   taglib   uri= "http://java.sun.com/jsf/core "   prefix= "f "   %>

<%
String   path   =   request.getContextPath();
String   basePath   =   request.getScheme()+ ":// "+request.getServerName()+ ": "+request.getServerPort()+path+ "/ ";
%>

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<html>
<head>
<base   href= " <%=basePath%> ">

<title> My   JSF   'addquestion.jsp '   starting   page </title>

<meta   http-equiv= "pragma "   content= "no-cache ">
<meta   http-equiv= "cache-control "   content= "no-cache ">
<meta   http-equiv= "expires "   content= "0 ">        
<meta   http-equiv= "keywords "   content= "keyword1,keyword2,keyword3 ">
<meta   http-equiv= "description "   content= "This   is   my   page ">
<!--
<link   rel= "stylesheet "   type= "text/css "   href= "styles.css ">
-->

</head>
   
<body>
<f:view>
This   is   my   JSF   JSP   page.   <br>
</f:view>
</body>
</html>

在浏览器中输入http://localhost:8080/demo/addquestion.faces
访问页面时显示

HTTP   Status   500   -

type   Exception   report

message

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception

org.apache.jasper.JasperException:   Exception   in   JSP:   /addquestion.jsp:29

26:   </head>
27:      
28:   <body>
29:   <f:view>
30:   This   is   my   JSF   JSP   page.   <br>
31:   </f:view>
32:   </body>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root   cause

java.lang.NullPointerException


javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615)
javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217)
org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71)
org.apache.jsp.addquestion_jsp._jspx_meth_f_view_0(addquestion_jsp.java:109)
org.apache.jsp.addquestion_jsp._jspService(addquestion_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.17   logs.
Apache   Tomcat/5.5.17

把 <f:view> </f:view> 去掉后就可以正常显示页面。

[解决办法]
jsf-impl.jar
* jsf-api.jar
* commons-digester.jar
* commons-collections.jar
* commons-beanutils.jar
* jstl.jar
* standard.jar拷贝到lib下
web.xml
<?xml version= "1.0 " encoding= "ISO-8859-1 "?>
<web-app 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 "
version= "2.4 ">
<description>
JSF Demo
</description>
<display-name> JSF Demo </display-name>
<servlet>
<servlet-name> Faces Servlet </servlet-name>
<servlet-class> 第 3 页 共 55 页
JSF 入门
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>
<welcome-file-list>
<welcome-file> index.html </welcome-file>
</welcome-file-list>
</web-app>
[解决办法]
关注
[解决办法]
tomcat挺好的 我一直用它~ 它好 我也好~ 一般人 我不告诉他~ ^_^
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行