开发者

How to handle Servlet program on submitting a JSP form

JSP CODE:

Upload File:
<input name="file" type="file" id="file"><br><br>
<input type="submit" name="Submit" value="Submit"/><br><br>
<input type="reset" name="Reset" value="Reset"/>   
</form>

I have the above JSP file which will be executed with the help of Tomcat server and this is stored in the following location of my system.

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\CheckURL

I have written a servlet program for catching the request and sending the reponse from the given JSP file.

My query here is, in which path the servlet program must be stored in my system.

And please let me know whether a servlet program can be compiled using javac NewServlet.java or it can be executed direc开发者_StackOverflowtly during runtime. Because on compiling that servelet program I get a lot of errors.

Am a beginner in java. If u can give me a detailed outlook on the above issue, it would be of great use. Thanks in advance.


The servlet tutorial is a good place to start.

A few points to answer your particular questions:

  • you can compile a servlet with javac NewServlet.java but you have to specify classpath (-cp) that contains the servlet-api.jar
  • you store the .class file in webapps\checkURL\WEB-INF\classes
  • you map the servlet in WEB-INF\web.xml using <servlet> and <servlet-mapping>. (there is a easier way with Tomcat 7 and Servlets 3, but you are on 5.5)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜