I have been writing Java with Eclipse, and I started learning JSP, but Eclipse did not mention support JSP, and did not associate into JSP files in the file association, not to say text discoloration and code automatic prompt. With Google Search, I know the combination TomcatPlugin You can let Eclipse support JSP and integrate the Tomcat server to it. But it is more disappointing that the article I can find is too old. Now I can't find the corresponding relatively old version. Used close The version is configured for many efforts to try or not, and then the sure will be configured according to the version of the version on their official website. It is configured in the whole day, and it is finally configured at 12:00 last night. In order to make a heart JSP's Eclipse users don't leave this detachment, close to this article, and share.
First prepare the software we need (currently the latest stable distribution, 2004-7-27):
J2SDK1.4.2 http://java.sun.com/j2se
Eclipse3.0 build 2004 http://www.eclipse.org/downloads/index.php
Jakarta-Tomcat-5.0.27 http://jakarta.apache.org/site/binindex.cgi
Tomcatplugin v3 http://www.sysdeo.com/eclipse/tomcatplugin.html
Lomboz3.01 http://forge.objectWeb.org/project/showfiles.php?group_id=97
Now let's start our integration process: Taking the installation path on the disk as an example:
Eclipse decompresses the D: / Eclipse; TomcatPlugin and Lomboz are extracted into the corresponding Plugin or Feature folder of Eclipse.
Tomcat is extracted to C: / Tomcat? Set the environment variable of Tomcat: Calalina_Home = C: / Tomcat
Java_Home = C: / J2SDK ??? Launched the Startup.bat test in C: / Tomcat / bin can run normally.
J2SDK is installed into the C: / J2SDK folder, JRE default installation path C: / Program files / java / j2re1.4.2_05, can be changed, but this is not critical. Set environment variable PATH = C: / J2SDK / BIN
That is to say, you must guarantee Tomcat and JDK before this.
Start Eclipse
Open: Window >> Preferencees
Point Tomcat is set in the figure, point Apply. If your exaggeration path changes, you need to make a corresponding adjustment.
No setting this is the failure of my previous configuration. Later, I learned after the error message. If this is not configured, Tomcat can also start in Eclipse, and browse the sample page, (because those pages are Compiled, but it can't compile JSP, and the error message said that the relevant class is not found.
Other default, click OK.
About Lomboz is not said, this Lomboz can independently complement the JSP and J2EE environment to complete the JSP and J2EE environment, but the total display is wrong, can't start Tomcat in the integrated environment, prompt error.
But why do we have to install it? Because its JSP Editor we can see the text discoloration and automatic prompt function when editing the JSP. Look at the following picture is its configuration preference, it's also Didn't find the reason, it is still exploring but if the configuration is successful, please contact me.
Here is an error message that starts Tomcat under Lomboz:
Bootstrap: Class Loader Creation Threw Exceptionjava.lang.ExceptioninInitializerrRoract Org.Apache.catalina.Loader.standardClassLoader.
(StandardClassLoader.java:207)
At Org.Apache.catalina.startup.classloaderFactory.createClassLoader (ClassLoaderFactory.java: 189)
At Org.Apache.catalina.startup.bootstrap.createClassLoader (Bootstrap.java: 160) at Org.Apache.catalina.Startup.Bootstrap.initclassLoaders (bootstrap.java: 104)
At Org.apache.catalina.Startup.bootstrap.init (bootstrap.java:193)
At Org.Apache.catalina.startup.bootstrap.main (bootstrap.java: 399)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: Java.lang.NullPointerexception (caused by java.lang.nullpointerException))
At Org.Apache.commons.logging.impl.logfactoryImpl.newinstance (logfactoryImpl.java: 543)
At Org.Apache.commons.logging.impl.logfactoryImpl.getInstance (logfactoryImpl.java: 235)
At Org.Apache.commons.logging.impl.logfactoryImpl.getInstance (logfactoryImpl.java: 209)
At Org.Apache.commons.logging.logfactory.getlog (logfactory.java: 351)
At Org.apore.tomcat.util.comPat.jdkcompat.
(JDKCompat.java: 55)
... 6 more
Caused by: org.apache.commons.logging.logconfigurationException: java.lang.nullpointerException (caused by java.lang.nullpointerException)
? at org.apache.commons.logging.impl.logfactoryImpl.getlogconstructor (logfactoryImpl.java: 397)
At Org.Apache.commons.logging.impl.logfactoryImpl.newinstance (logfactoryImpl.java: 529)
... 10 more
Caused by: java.lang.nullpointerException
At Org.Apache.commons.logging.impl.logfactoryImpl.getlogconstructor (logfactoryImpl.java: 374)
... 11 more
No matter what we continue to continue our configuration:
Create a new Project Selection Tomcat Project ???? My project named tomcatproject
All the way by default Next
Right click on the project TomcatProject? New file index.jsp.jsp
Write test code in Index.jsp
<% @ page import = "java.util. *"%> <% out (); out.print ("Hello World, New JSP Program);%> Click Tomcat icon in Tools Start Tomcat can see the correct prompt information
Then open the browser in the address bar to enter http: // localhost: 8080 / tomcatproject / is your local server plus your project name, pay attention to case sensitive.
This is also very successful.
You will see in your browser: Wed Jul 28 13:53:50 CST 2004 Hello World, New JSP Programr
Ok, I finally finished writing, the level is limited, please give you guides, please expert advice on Lomboz. I think lomboz is better than TomcatPlugin, which can complete the engineering deployment of the project in Eclipse and the startup of the server and the project's commissioning browsing.
It supports J2EE development, and our JSP code editor in the article is also relying on it. If it is configured, then there is no need to want TomcatPlugin. Also welcome to discuss and contact me on Java issues: yi_can@163.com