现在的位置: 首页 > 综合 > 正文

Use JSP with Eclipse in Ubuntu

2019年04月16日 ⁄ 综合 ⁄ 共 1681字 ⁄ 字号 评论关闭

(1)Install Tomcat7 in Ubuntu:

    It is very easy to install tomcat7 in ubuntu. Just refer to[1],

     (1)type the command:

    sudo apt-get install tomcat7,

     (2) check the website http://localhost:8080/

    In my version it is showed like this:



      (2) If you have already use the JavaEE eclipse, you can skip this step. Otherwise you need to install the JavaEE plugin[3] and JSTServer Adapters[4](if you ignore the JST Server Adapter
      you will not see the tomcat server).

      (3)Create tomcat7 server in eclipse, basically just “ click on Servers tab at bottom of eclipse. (If you don't see Servers tab,add the tab via Window, Show View, Servers.) R-click on
      Servers tab,New, Server, Apache, Tomcat v7.0 ”[2][6].

      In ubuntu the tomcat7's installation directory is usually“/usr/share/tomcat7”if you follow step1.

      If you run into some trouble like 'Couldnot load the Tomcat server configuration at /usr/share/tomcat7/conf.The configuration may be corrupt or incomplete/usr/share/tomcat7/conf/catalina.policy
      (No such file ordirectory)', follow the instruction[5].

      (4)Afterthat you can create a “dynamic web project” in the eclipse,create a .jsp file,

      writea hello world code lie:

      <%

    out.print("HelloJSP");

    %>


    run it, if you failed because of port is being used, stop the tomcatfirst with the command

    sudo/etc/init.d/tomcat7 stop

    or refer to[6]


    Reference:

    [1]:http://sukharevd.net/environment-for-j2ee-development-under-ubuntu.html#tomcat

    [2]:https://www.cise.ufl.edu/~bn0/jsp_eclipse_tutorial/

    [3]:http://coding-for-dummies.blogspot.com/2012/10/how-to-get-dynamic-web-project-option.html

    [4]:http://stackoverflow.com/questions/2000078/apache-tomcat-not-showing-in-eclipse-server-runtime-environments

    [5]:http://stackoverflow.com/questions/13423593/eclipse-4-2-juno-cannot-create-a-server-using-the-selected-type-in-tomcat-7

    [6]:http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html


抱歉!评论已关闭.