配置JSF的jsp 页面报错


ype Exception report

message An exception occurred processing JSP page /index1.jsp at line 14

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

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /index1.jsp at line 14

11: <body>
12: 	hello
13: 	
14: 	<h:form id="form1">
15: 	 <h:inputText value="input"/> 
16: 	 <h:outputText value="h:output"/> hello锛�
17: 	 </h:form>>


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:574)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:461)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:568)
	com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:363)
	com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:153)
	com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 
再三排查web.xml 和 faces-config.xml的配置都没错,最后发现是jsp页面少了 <f:view> 标签。
jsp 代码如下:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> Autotest here</title>
</head>
<body>
	hello
	<f:view>
	<h:form id="form1">
	 <h:inputText value="input"/> 
	 <h:outputText value="h:output"/> hello!
	 </h:form>>
	</f:view>	


	<% out.println("name:--------------"); %>
</body>
</html>
 
浏览器输入:http://localhost:8080/autotest/index1.jsp  则报错,输入http://localhost:8080/autotest/index1.jsf 则页面能正常展示
 
web.xml 文件不能配有这段代码,否则输入http://localhost:8080/autotest/index1.jsf页面报错
	<servlet-mapping>
		<servlet-name>FacesServlet</servlet-name>
		<url-pattern>*.jsp</url-pattern>
	</servlet-mapping>
 
报错异常为:

type Exception report

message Servlet execution threw an exception

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

exception

javax.servlet.ServletException: Servlet execution threw an exception
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值