ArticleDirectory
- I. environment requirements:
I recently read a lot of information about lomboz and found that many netizens are interested in this Eclipse plug-in, but suffer from getting started. I feel it is necessary to write down my lomboz learning experience so that later people will not take too many detours.
I. environment requirements:
1. lomboz related resources This article focuses on lomboz, so it is necessary to emphasize it. Lomboz is a J2EE plug-in of eclipse. It integrates many Java application servers, J2EE components, and Web application development into eclipse, java developers can use eclipse to create, test, and deploy J2EE applications.
Note: You need to download two files, lomboz3.0.1 and emf-sdo-runtime-2.0.0.zip. Program You can also download the latest version of http://www.eclipse.org/emf/ from the official website of eclipe) tutorials and forums are belong to the lomboz official website, although are English information, but for learning lomboz has a lot of help. If you really want to know about lomboz (of course, it is best to read the source code directly), you can still read the tutorials and Forum materials in English.
2. My configurations For WINXP SP1 and JDK 1.4.2-04, you can download eclipse 3.0.1 and the Language Pack Tomcat 5.0.28 lomboz 3.0.1 from the official website of sun.
3. directory structure F: \\\\ j2sdk JDK Directory D :\\\ eclipse directory F :\\\ Java \\\ Jakarta-Tomcat 5.0.28 Directory D: \ plug-in \ lomboz.301 lomboz directory (I am using links to install it here, II. configure the development environment to open eclipse, and click "window"-> preferences. The following are all configured in "Preferences": 1. java-> build path
2. lomboz
3. lomboz-> server definitions-> Properties
4. Switch to the main interface and click "window"> customize perspective.
Switch to the "command" menu
5. effect after Configuration
Note: Some modifications are required because Tomcat 5.0.27 and 5.0.28 cannot be started in lomboz. Find "d :\\\\ plug-in \\\\ lomboz.301 \\\\ eclipse \\\\ plugins \\\ COM. objectlearn. jdt. j2ee_3.0.1 \ servers "Directory (I use the links installation method); if you use the lomboz directly decompress it to eclipse for installation, find "Eclipse installation directory \ plugins \ COM. objectlearn. jdt. j2ee_3.0.1 \\\\ servers "directory. This directory contains the configuration files of related servers. If some configuration files are not used, you can delete them to avoid visual fatigue. For example, I only have a few files.
First, rename the "tomcat50x. Server" file to "tomcat5028.server" (I use version 5.0.28), which looks convenient. Open the file and make the following changes:
Save it.
3. edit a JSP instance 1. Create a "lomboz J2EE project ". Enter "jspsample" in "project name", click "Next", and then click "Next ".
2. Enter the web module
3. Add a server (multiple servers can be added, one of which is the default one)
4. The effect is as follows:
5. Double-click index. jsp and click "lomboz View", for example:
Click the "Start server" button (or right-click "Apache Tomcat v5.0.28" and select "run server"). If everything works properly, the "information" is output in the "Console window: server startup in... ms ". Switch to the "lomboz J2EE View" column, select "demoweb", and click the "deployment module" button to view the output information, which generates a "demoweb. war file and deploy it to "f :\\\\ Java \\\ Jakarta-Tomcat \\\\ webapps" (this is the Tomcat directory on my computer) directory, then, the Tomcat server automatically decompress and initialize "demoweb. war ". Open your browser and enter "http: // 127.0.0.1: 8080/demoweb/index. jsp" in the address bar. OK! You can see the following interface:
You can also right-click the "demoweb" folder in "package Resource Manager" and follow these steps,
6. Add a statement <% Out. println ("use JSP! "); %>", Save it, click "deployment module", and refresh the browser. The following page is displayed:
7. Add the following statement, save, deploy the module, and refresh the browser.
1. Required Software
Jstl 1.1.1 Home http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html download http://www.apache.org/dist/jakarta/taglibs/standard/binaries/jakarta-taglibs-standard-1.1.1.zip
XML buddy Home http://xmlbuddy.com download http://xmlbuddy.com/2.0/58904908428240984589/409502405985075764578/3.0M9/xmlbuddy_2.0.10.zip this is an Eclipse plug-in that can help edit XML files (optional ).
2. Environment Configuration Create a lomboz J2EE project with the Project name: "jstl sample"; fill in web modules: "demoweb2"; add servers: "Tomcat 5.0.28 ", as my previous article introduces eclipse new project in more detail, here is a simple introduction. Directory structure F: \\\\ j2sdk JDK directory
D: \\\ eclipse directory F :\\\ Java \\\ Jakarta-Tomcat 5.0.28 Directory D: \\\\ plug-in \\\\ lomboz.301 lomboz directory (I installed it in links mode here, D: \ Java \ decompress directory of the jstl jakarta-taglibs-standard-1.1.1.zip D: \ eclipse \ workspace \ jstl sample just created jstl sample project directory
Make appropriate Configurations Based on the installed software.
3. Add the warehouse receiving File Find the jslt \ lib directory and copy the jstl. jar, standard. JAR file to the lib directory ("D: \ eclipse \ workspace \ jstl sample \ demoweb2 \ WEB-INF \ Lib "). Find the jstl \ TLD directory and copy the c. TLD file to the \ demoweb2 \ WEB-INF directory in the jstl sample directory. Refresh the demoweb2 directory and expand it. The added three files are displayed:
4. modify the program
Note: |
Since lomboz only supports jstl1.1 and later versions, El is formally incorporated into the specification in JSP 2.0. Therefore, Web. xml should use a schema of 2.4 instead of a DTD of 2.3. |
Open the Web. xml file under the WEB-INF directory and modify it as follows:
WEB-INF/web. XML |
xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" Version = "2.4"> index. JSP 404 /error. JSP |
Note: |
If you have installed the xmlbuddy plug-in and use it to open "Web. XML file, the following error may occur: "cannot find the declaration of the element \ 'web-app \ '", disable "Web. XML file, the error disappears. It does not affect the running of the program. |
Modify the index. jsp file
Demoweb2/index. jsp |
<% @ Page contenttype = "text/html; charset = GBK" %> <% @ Taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "C" %> <HTML> <Head> <Title> count to 10 example (using jstl and scriptlet) </title> </Head> <Body>
<% -- This is to use jstl to print 1 to 10 -- %> Use jstl to print 1 to 10 <p> <C: foreach Var = "I" begin = "1" End = "10" step = "1"> <C: Out value = "$ {I}"/> <Br/> </C: foreach>
<% -- This is the use of JSP scriptlet to print 1 to 10 -- %> <P> use JSP scriptlet to print 1 to 10 <p> <% For (INT I = 1; I <= 10; I ++) {%> <% = I %> <br/> <% }%>
</Body> </Html> |
Note: |
In lomboz, only jstl 1.1 is supported. Therefore, the URI of its core tag library is http://java.sun.com/jsp/jstl/coreby default. Jstl 1.1 supports both jstl 1.0 and 1.1. Therefore, if the URI of the core tag library is http://java.sun.com/jstl/core, the core tag library of jstl 1.0 will be used, and lomboz will have an error. |
5. Run the program
Save the file, deploy the demoweb2 module, run the server, and enter the address: http: // localhost: 8080/demoweb2 OK in the browser window! You can see the following interface:
(Keywords: Eclipse lomboz Tomcat JSP Java) (Source: Fei Mao blog [http://www.cnblogs.com/sunsonbaby/])