【问题标题】:Eclipse/Tomcat forgetting about custom tags?Eclipse/Tomcat 忘记了自定义标签?
【发布时间】:2014-01-03 01:50:15
【问题描述】:

我在 Windows 7 64 位上使用 Eclipse Kepler 和 Tomcat 7。

如果我清理项目并重新启动服务器,一切正常。但是如果我工作几分钟......就像编辑一个jsp......Tomcat会抛出以下......

它抱怨缺少的标签是页面布局的标签。除了包含一些 jspf 并且内容页面还调用其他标签之外,没有什么令人兴奋的了。但同样,没有什么令人兴奋的......

我不明白我是如何造成这种情况的,因为它最初编译并运行良好。但随后 Tomcat 似乎忘记了标记类。

如果我清理项目,它会恢复工作一段时间...

有什么想法吗? 谢谢

HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 33 in the jsp file: /folder/page.jsp
org.apache.jsp.tag.weblayout_002dmain_tag cannot be resolved to a type
30: 
31: 
32: 
33: <tags:layout-main>
34:     <jsp:attribute name="title">page</jsp:attribute>
35:     <jsp:attribute name="section">user</jsp:attribute>
36:     <jsp:attribute name="handle">page</jsp:attribute>


An error occurred at line: 33 in the jsp file: /folder/page.jsp
org.apache.jsp.tag.weblayout_002dmain_tag cannot be resolved to a type
30: 
31: 
32: 
33: <tags:layout-main>
34:     <jsp:attribute name="title">page</jsp:attribute>
35:     <jsp:attribute name="section">user</jsp:attribute>
36:     <jsp:attribute name="handle">page</jsp:attribute>


An error occurred at line: 106 in the jsp file: /folder/page.jsp
org.apache.jsp.tag.webrating_tag cannot be resolved to a type
103:            <div class="page clearfix">
104:                <div class="title">
105:                    <h3>${page.name}</h3>
106:                    <br><tags:rating value="${3}"/>                         
107:                    <br>${page.type}
108:                </div>
109:                <div class="hours">

【问题讨论】:

  • 修改代码后是否重新发布到Tomcat?
  • 设置为自动构建。并且 Tomcat 在 Eclipse 中被配置为服务器。我一直认为这意味着 Eclipse 会为我照顾它。如果我将所有文件复制到单独的 Tomcat 服务器(托管),它总是可以正常工作。但是 Eclipse 以某种方式把它搞砸了。
  • 丢失的 TAG 文件在整个应用程序中使用。它们基本上是 HTML 设计模板...
  • Iirc 在 Eclipse 的服务器视图中有一个“发布到服务器”按钮,您需要单击该按钮才能正确部署更改。
  • 我是一名 Java 教师,在过去的 3 年里,我每年都在使用当前版本的 Eclipse、Tomcat 6 和 7、在我的几台学生机器上遇到同样的问题。一旦项目开始具有合理的规模,就会发生这种情况,hello world 项目不会发生这种情况。我们通常使用 JPA/Hibernate 3/4、Spring 3、Spring MVC、JSP、SVN。我认为唯一安装的插件是 subclipse。 JSP 所需的第一个 .tag 文件会触发异常。需要清理/重启。

标签: eclipse jsp tomcat custom-tags


【解决方案1】:

尝试以下任何一种方法,它应该可以工作

  1. 复制WEB-INF/lib/目录下的jar,然后重启你的web容器

  2. 试试

    <%@ page language="java" import="Pkgname.className.*" %>
    

例如

    <%@ page language="java" import="org.apache.jsp.tag.webrating" %>
  1. 清理项目并重启服务器

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 2010-10-05
    • 1970-01-01
    • 1970-01-01
    • 2011-05-02
    • 2012-06-03
    相关资源
    最近更新 更多