JavaWeb项目org.apache.jasper.JasperException: 解决方法

2022-07-23 15:41:39 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

在做项目时候,遇到这个500错误。找了很久,jsp写法也没错误,在本地myeclipse可以运行,在别人的myeclipse不能运行,最后终于解决了,是tomcat的版本问题。

HTTP Status 500 –


type Exception report

message

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

exception

代码语言:javascript复制
org.apache.jasper.JasperException: /PCManage/controlsecletthenews.jsp(303,12) The function getNid must be used with a prefix when a default namespace is not specified
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
	org.apache.jasper.compiler.Validator$ValidateVisitor$1FVVisitor.visit(Validator.java:1506)
	org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:129)
	org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200)
	org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:242)
	org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:56)
	org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200)
	org.apache.jasper.compiler.Validator$ValidateVisitor.validateFunctions(Validator.java:1531)
	org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1176)
	org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:846)
	org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
	org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:865)
	org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
	org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1763)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	serlvet.SearchNewsServlet.doPost(SearchNewsServlet.java:79)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

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

原因;是tomcat6.0版本不够高,不支持以下代码这样下,因此不断报错。

解决方法:

(1)我是用tomcat6.0运行的,不断地提示错误代码,但是并没有错的。

报错代码贴出来,但是在我的myeclipse是可以运行:

<table class=”table table-hover” style=”margin-top:10px;padding:20px;”> <tr><td>新闻id</td><td>标题</td><td>类别</td><td>作者</td><td>浏览量</td><td>时间</td><td>照片路径</td><td>内容</td></tr> <c:forEach items=”${project_vector}” var=”vector” varStatus=”status”> <tr> <td><c:out value=”${vector.getNid()}”/></td> <td><c:out value=”${vector.getNbiaoti()}”/></td> <td><c:out value=”${vector.getNleixing()}”/></td> <td><c:out value=”${vector.getNzuozhe()}”/></td> <td><c:out value=”${vector.getNliulangliang()}”/></td> <td><c:out value=”${vector.getNdate()}”/></td> <td><img style=”height:30px;width:30px;background:blue” src=”<%=request.getContextPath() %>${vector.getNphotepath()}” alt=””/></td><!– <c:out value=”${vector.getNphotepath()}”/> –> <td><c:out value=”${vector.getNtext()}”/></td> </tr> </c:forEach>

(2)改用tomcat7.0,成功运行,完美解决了这个问题。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/126548.html原文链接:https://javaforall.cn

0 人点赞