<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
metadata-complete="true">
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>he</servlet-name>
<jsp-file>/WEB-INF/test1.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>he</servlet-name>
<url-pattern>/hello.adml</url-pattern>
</servlet-mapping>
</web-app>
上面是web.xml配置文件,放在webapps/web1/WEB-INF下面,web1是我自建的文件,服务器tomcat7.0. 上面没有贴出jsp文件test1.jsp,它和web.xml放在一起。在当我在浏览器中地址栏输入地址:http://localhost:8080/web1/hello.adml
提示错误:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: No servlet class has been specified for servlet he
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.
这个该怎么改,才能通过映射访问WEB-INF下的文件???
------解决方案--------------------------------------------------------
servlet是后台的提交对象~ 你这里没有
这么还定义个servlet呢!
------解决方案--------------------------------------------------------
哥们你太有才了,页面跳转到servlet里面去跳啊
这样怎么跳,你以为这是struts2啊