执行查询时候出现这个错误
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: /search.jsp(151,22) Attribute value language + "/include/header.html" is quoted with " which must be escaped when used within the value
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:198)
org.apache.jasper.compiler.Parser.parseQuoted(Parser.java:301)
org.apache.jasper.compiler.Parser.parseAttributeValue(Parser.java:250)
org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:212)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:155)
org.apache.jasper.compiler.Parser.parseInclude(Parser.java:869)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1136)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1466)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
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.18 logs.
分析:查看nutch Web应用根目录下的search.jsp可知,是引号匹配的问题。
<jsp:include page="<%= language + "/include/header.html"%>"/> //line 152 search.jsp
第一个引号和后面第一个出现的引号进行匹配,而不是和这一行最后一个引号进行匹配,所以问题就出现了。
解决方法:
将该行代码修改为:<jsp:include page="<%= language+urlsuffix %>"/>
这里我们定一个字符串urlsuffix,我们把它定义在language字符串定义之后,
String language = // line 116 search.jsp
ResourceBundle.getBundle("org.nutch.jsp.search", request.getLocale())
.getLocale().getLanguage();
String urlsuffix="/include/header.html";
修改完成后,为确保修改成功,重启一下Tomcat服务器,进行搜索,不再报错。
http://blog.sina.com.cn/s/blog_4cc16fc50100bqxe.html
http://blog.sina.com.cn/s/blog_4cc16fc50100bqtb.html~type=v5_one&label=rela_prevarticle 源码导入Eclipse。