2013年9月13日星期五

servlet configuration issues




novices new to jsp, there are two simple questions to ask you ;

1. My myeclipse project directory web-inf folder, how no classes folder in the tomcat project file but you can see ;

2.servlet in web.xml how to write and Configuration Yeah, the above figure configuration is written / servlet/servlet1, ask a servlet this folder where the file is not written servlet1.java path ah ?

hope to have good people to answer in detail under these few simple questions , grateful ah

------ Solution ------------------------------------ --------
1, classess should exist in your web projects , rather than in your project in myeclipse . If you use the tomcat and virtual path is not configured , the following should be that corresponding to the webapps folder . But you can find in the build inside the class bytecode files .


2,2. servlet in web.xml how to write and Configuration Yeah, the figure above < ; url-pattern> configuration is written / servlet/servlet1, ask a servlet this folder where the file is not written servlet1.java path ah ?

This is no folder , just a virtual path . How to write whatever you can .
Under normal circumstances , your servlet1 is a class that put the location where is it . WEB-INF in the class you are in , usually WEB-INF where the data are not directly accessible .
So you need to configure a virtual path to allow outsiders access to him. ( For example, you configured here servlet/servlet1, is the case )
under your project will not have this folder .
And, personally feel that it is best not to put a servlet virtual path of the folder to build out, to avoid confusion.
------ For reference only -------------------------------------- -


very detailed , thanks

没有评论:

发表评论