Before
1.Servlet (Hello.java)编译
编译
javac -encoding utf-8 -d ..\classes -sourcepath . chapter3\Hello.java
生成Hello.class
2.启动Tomcat
3.运行
http://localhost:8080/book/chapter3/hello
Servlet修改后可以不用重启Tomcat 的方法演示如下
1.编写文件context.html
C:\work\tomcat\webapps\book\META-INF
<Context reloadable="true"/>
2.修改Servlet (Hello.java),然后编译
修改后
out.println("Hello Servlet!");
编译
javac -encoding utf-8 -d ..\classes -sourcepath . chapter3\Hello.java
生成Hello.class
不用重启Tomcat,会提示reload
3.刷新下面页面,发现页面更新成功!
http://localhost:8080/book/chapter3/hello