加载JSP时出错

时间:2014-07-31 08:21:23

标签: java javascript jsp jsp-tags

渲染JSP时,我遇到了一个奇怪的问题。我在加载时收到以下错误

Error:  org.apache.jasper.JasperException: javax.servlet.ServletException:  java.lang.NoSuchMethodError: org.springframework.web.servlet.tags.form.InputTag.setDisabled(Z)V

如何解决这个问题?

编辑:下面是错误的堆栈跟踪:

    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)

JSP Code Snippet:

                            <td width="8%"><form:button
                                    id="id1"
                                    name="id1" disabled="true"
                                    class="idClass"
                                    onClick="operate()">Operate</form:button>
                            </td>

我上面提到的代码很少,我禁用按钮。有javascript代码可以在某些条件下启用它们;像:

document.getElementById("id1").disabled = false;

1 个答案:

答案 0 :(得分:0)

在您的代码示例中,您有<form:button>。我猜 form 引用了spring form taglib。但是在spring form taglib中没有按钮标记。也许您应该使用简单的HTML按钮标记:

<button
   id="id1"
   name="id1" disabled="true"
   class="idClass"
   onClick="operate()">Operate</button>

以下是spring form taglib的链接:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/spring-form.tld.html