通过某些示例学习Spring MVC。我已从此链接https://github.com/frenmanoj/bookstore
下载了一个简单示例在运行Projects iam获取目录列表页面时正确配置项目,我不理解
以下是页面和控制台输出
http://localhost:9000/bookstore/
Directory Listing For /
--------------------------------------------------------------------------------
Filename Size Last Modified
--------------------------------------------------------------------------------
Apache Tomcat/8.0.9
Mar 09, 2015 7:38:42 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_31\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_31/bin/client;C:/Program Files/Java/jre1.8.0_31/bin;C:/Program Files/Java/jre1.8.0_31/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;D:\maven\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;F:\eclipse;;.
Mar 09, 2015 7:38:42 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:bookstore' did not find a matching property.
Mar 09, 2015 7:38:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-9000"]
Mar 09, 2015 7:38:43 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 09, 2015 7:38:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Mar 09, 2015 7:38:43 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 09, 2015 7:38:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2007 ms
Mar 09, 2015 7:38:43 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 09, 2015 7:38:43 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.9
Mar 09, 2015 7:38:44 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [132] milliseconds.
Mar 09, 2015 7:38:45 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-9000"]
Mar 09, 2015 7:38:45 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Mar 09, 2015 7:38:45 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1532 ms
几乎我已经尝试了过去2天内经历过相同输出的3到4个例子,这个例子有什么问题可以请任何人帮助我
答案 0 :(得分:0)
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>org.apache.Servlet1.MyServlet</servlet-class>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value> <!-- This setting enables/disables directory listings -->
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>