问一点jsp经常遇到的问题
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>这是测试页面</title>
</head>
<body>
<s:form action="prime">
<s:textfield label="Please Enter A Prime Number :" name="number"/>
<input type="submit"></input>
</s:form>
</body>
</html><!--这段代码没有错误吧-->
--------------------------------------在服务器运行后出现-------------------------------------
org.apache.jasper.JasperException: File "/struts-tags" not found
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:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:160)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1439)
org.apache.jasper.compiler.Parser.parse(Parser.java:137)
----------------------再次刷新错误页面后又出现下面的--------------------
exception
org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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)
root cause
org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:620)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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)
root cause
java.lang.ClassNotFoundException: org.apache.jsp.Ceshi.AS_jsp
java.net.URLClassLoader$1.run(URLClassLoader.java:299)
java.net.URLClassLoader$1.run(URLClassLoader.java:288)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:287)
---------------------strus的配置和web.xml配置如下-----------
<package name="com" namespace="/" extends="struts-default">
<action name="prime" class="com.vapsec.pk.primeAction">
<result name="success">success.html</result>
<result name="input">AS.jsp</result>
</action>
</package>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
-------------------------------------------
对于这样的问题我一直不解,网上搜索后的结果是配置出错,实在看不明白哪错了
[解决办法]
你没加struts2的jar包吧,没找到struts2的哪些标签文件
[解决办法]
你的Struts2的JAR包拷贝全了吗?
一般说来,这个"/struts-tags"文件的路径是: struts2-core-2.x.jar的META-INF/struts-tags.tld
[解决办法]
你的代码没有错,我以前也遇到这个错误,什么地方引起的这个问题啊?
看起来好像是目录结构不正确引起的。
[解决办法]