Friday, 15 July 2011

java - Deploy and automatically compile servlet with tomcat7 -



java - Deploy and automatically compile servlet with tomcat7 -

i'm having problem getting simple java servlet run under tomcat7 (fresh install ubuntu repository).

it single .java file @webservlet("/testservlet"). set /var/lib/tomcat7/webapps/testservlet/web-inf , tomcat recognize , automatically compile (also, when alter source file). how set in simple way?

you have compile code using java compiler (or ide). deploy *.class file(s) under servlet container (tomcat in case).

the class file must under web-inf/classes directory. if class belongs bundle com.myservlet , name hellowservlet set file /var/lib/tomcat7/webapps/testservlet/web-inf/com/myservlet/helloservlet.class

edit:

if indeed want create tomcat compile servlet, write jsp. key feature of jsp: can deployed source code , compiled automatically servlet container.

java servlets tomcat7

No comments:

Post a Comment