I have done a little experiment about jsp and servlet. In the first time, I thought both files will be compiled and run in the same way. But in fact, both files are treated different by Tomcat. I have never come across on this little experiment before.
I did 3 experiments. In the first experiment, I went through the following steps:
- Create jsp a very simple jsp file. It only contains the html tag.
- Startup tomcat.
The second experiment, I went through the following steps:
- Create a simple jsp file which contains html tag and several java operation (which is looping something). The filename is test.jsp
- startup Tomcat.
In the third experiment, I went through the following steps:
- Create a very simple java class extends HttpServlet.
- Compile it to be ja va class.
- Create directory
/work/ /WEB-INF/classes. - Create mapping file.
- Startup Tomcat.
My bad that I didnt come across this experiment before. I have gone through the things that is too far such as playing around with spring and webwork but never think on this basic thing. I hope my experiments will be useful for all of the visitor.
No comments:
Post a Comment