Nutch 新手 - JSP 与 html 问题

发布于 2024-11-08 16:02:31 字数 1324 浏览 0 评论 0原文

系统:Mac OSX

我已经设置了 nutch,以便它对我的网站进行爬网和索引。它还返回搜索结果。我的问题是我想自定义 Nutch index.jsp 和 search.jsp 页面以适合我的网站。我已经阅读了 jsp 上的内容,它说只需放入 html 标签,然后使用 <% %>包含您想要的 Java scriptlet。由于某种原因,当我编辑文件(索引和搜索)时没有任何变化

这是原始文件显示的内容:

<%@ page
  session="false"
  import="java.io.*"
  import="java.util.*"
%><%
  String language =
    ResourceBundle.getBundle("org.nutch.jsp.search", request.getLocale())
    .getLocale().getLanguage();
  String requestURI = HttpUtils.getRequestURL(request).toString();
  String base = requestURI.substring(0, requestURI.lastIndexOf('/'));
  response.sendRedirect(language + "/");
%>

这是我编辑的版本,添加了总乱码测试来测试它:

<html>
<head>
</head>
<body>

gigigyigig


<%@ page
  session="false"
  import="java.io.*"
  import="java.util.*"
%><%
  String language =
    ResourceBundle.getBundle("org.nutch.jsp.search", request.getLocale())
    .getLocale().getLanguage();
  String requestURI = HttpUtils.getRequestURL(request).toString();
  String base = requestURI.substring(0, requestURI.lastIndexOf('/'));
  response.sendRedirect(language + "/");
%>

ghjgjkbkhb
hjgjvjhvj

</body>
</html>

什么都没有改变,nutch homepage/index.jsp仍然显示与原件相同。这是我第一次接触 JSP,所以这正是我到目前为止所学到的。谁能告诉我为什么页面不显示乱码的 html?

System: Mac OSX

I have set up nutch so that it crawls and indexes my site. It also returns search results. My problem is that I want to customise the Nutch index.jsp and search.jsp pages to fit with my site. Ive read up and on jsp and it says its just a matter of putting in the html tags and then using <% %> to enclose the Java scriplets you want. For some reason nothing changes when i edit the files (index and search)

Here is what the original file displays:

<%@ page
  session="false"
  import="java.io.*"
  import="java.util.*"
%><%
  String language =
    ResourceBundle.getBundle("org.nutch.jsp.search", request.getLocale())
    .getLocale().getLanguage();
  String requestURI = HttpUtils.getRequestURL(request).toString();
  String base = requestURI.substring(0, requestURI.lastIndexOf('/'));
  response.sendRedirect(language + "/");
%>

Here is my edited version with sum gibberish test added to test it:

<html>
<head>
</head>
<body>

gigigyigig


<%@ page
  session="false"
  import="java.io.*"
  import="java.util.*"
%><%
  String language =
    ResourceBundle.getBundle("org.nutch.jsp.search", request.getLocale())
    .getLocale().getLanguage();
  String requestURI = HttpUtils.getRequestURL(request).toString();
  String base = requestURI.substring(0, requestURI.lastIndexOf('/'));
  response.sendRedirect(language + "/");
%>

ghjgjkbkhb
hjgjvjhvj

</body>
</html>

Nothing has changed tho and the nutch homepage/index.jsp still displays the same as original. This is my first encounter with JSP so its just what ive picked up so far. Can anyone tell me why the page isnt displaying the html with gibberish typed??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亽野灬性zι浪 2024-11-15 16:02:31

我的搜索完全修改了。但是,我在第二个 scriptlet 之后有我的 ... 标记,即 <% %> 而不是 <%@ page .
至于您修改后的index.jsp,它有一个重定向response.sendRedirect,因此对我来说,您什么也看不到是正常的。
另外,我假设您负责将 jsp 页面加载到 tomcat/webapps 树下的正确位置,因为标准 ant make 文件没有这样做。所以我最终添加了一些 Ant 任务来修补我的测试网站。
请注意,如果您要更改 .jar 文件,您还需要重新启动 Tomcat。

I have my search totaly modified. However I have my <html>... tags after the second scriptlet ie <% %> not <%@ page.
As for your index.jsp modified it has a redirection response.sendRedirect and therefore it looks normal to me that you see nothing.
Also I presume you took care of loading the jsp pages at the right place under the tomcat/webapps tree, because the standard ant make file doesn't. So I ended up adding some Ant task to patch my test website.
Beware if you are going to change the .jar files you also need to restart Tomcat.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文