日期:2014-05-20  浏览次数:20997 次

jsp页面纠结求教。
小弟目前在jsp页面form action中使用${pageContext.request.contextPath }/servlet的写法,但是一直提示有错误,错误如下:javax.servlet.jsp.PageContext cannot be resolved to a type
- Attribute (width) is obsolete. Its use is discouraged in HTML5 documents.
- javax.servlet.jsp.JspException cannot be resolved to a type
- Attribute (cellpadding) is obsolete. Its use is discouraged in HTML5 
documents.
- Attribute (border) is obsolete. Its use is discouraged in HTML5 
documents.
- Attribute (cellspacing) is obsolete. Its use is discouraged in HTML5 
documents.
网上解答过说要缺少jsp-api.jar,导入这个包之后不报错了,但是程序启动访问这个页面的时候出现如下错误:
org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld" from JAR file "file:/C:/Users/jason/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:181)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:182)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:449)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1396)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
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)
acl.demo.servlet.filter.SecurityFilter.doFilter(SecurityFilter.java:50)

网上说需要把jsp-api.jar去掉。。这我就不会了。这不是互相矛盾了么。请问前辈们有没有遇见这个问题,如何处理呢?

------解决方案--------------------
<%
String path = request.getContextPath();
%>

<form method="post" action = "<%=path%>/login">

这样试试