Graphical use of Eclipse3+lomboz3+tomcat to develop JSP

Source: Internet
Author: User
Tags add foreach copy interface version window xmlns apache tomcat
JS I recently read a lot of information about Lomboz, found that many netizens are interested in this eclipse plug-in, but suffer from getting started. Feel the need to learn lomboz of their own experience to write down so that Up-and not go too many detours.


I. Environmental requirements:


1. Related Resources for Lomboz

As the focus of this article is on the Lomboz, it is necessary to emphasize. Lomboz is an Eclipse plug-in that integrates many Java application servers, EE components, and Web application development into eclipse to help Java developers build, test, and deploy EE applications using Eclipse. 

Note 

Download two files, one for Lomboz3.0.1 and one for Emf-sdo-runtime-2.0.0.zip (this program can also be downloaded from Eclipe's official website http://www.eclipse.org/emf/ ) TutorialsAnd the forum is belong to Lomboz official website, although all is the English material, but has the very big help to the study lomboz. For a real understanding of lomboz words (preferably directly to see the source code), English is passable, or should look at the tutorials and forum information. 

2. My Configuration

Winxp SP1, JDK 1.4.2-04 can download Eclipse 3.0.1 and language pack Tomcat 5.0.28 lomboz from Sun official website 3.0.1 

3. Directory Structure

F:\\\\J2SDK JDK directory d:\\\\eclipse eclipse directory F:\\\\java\\\\jakarta-tomcat Tomcat 5.0.28 directory d:\\\\plug-in\\\\lomboz.301 Lomboz directory (I am here to use the links method installed,

Two. Configure the development environment


To open Eclipse, click the Menu window-> preferences and the following are configured in preferences: 1. Java-> Build Path




2. Lomboz




3.lomboz->server definitions->properties




4. Switch to the main screen, click on the "Window" menu-> custom Perspective




Switch to the Command menu




5. The effect after the configuration




   Note:Because Tomcat 5.0.27, version 5.0.28 cannot be started in Lomboz, some modifications are required.
Find "D:\\\\plug-in\\\\lomboz.301\\\\eclipse\\\\plugins\\\\com.objectlearn.jdt.j2ee_3.0.1\\\\servers" Directory (I'm using the links installation method), and if you're installing it directly by extracting Lomboz to eclipse, find the "Eclipse installation directory \\\\plugins\\\\com.objectlearn.jdt.j2ee_3.0.1\\\\serversDirectory
This directory contains the relevant server configuration files, if some of the configuration files are not used, although deleted, to avoid visual fatigue. For example, I only left a few files.




First the "tomcat50x.server" file renamed "Tomcat5028.server" (I used the 5.0.28 version), looks convenient. Open this file and make the following modifications:







Finally save it.



Three. Edit a JSP instance


1. Create a new "Lomboz java Project". In the project name, fill in "Jspsample", click "Next", and then click "Next".




2. Fill in the Web module




3. Add a server (you can add multiple servers, one of which is the default)




4. The effect is as follows:




5. Double hit Open index.jsp, click the "Lomboz View" button, the following figure:




First click on the "Start Server" button (or in "Apache Tomcat v5.0.28" Right click, select "Run Server"), if everything works, in the console window will output "information: Server Startup in ... MS". Then switch to the "Lomboz Java View" bar, select "Demoweb", click the "Deploy Module" button, you can see the output information, roughly generated a "Demoweb.war" file, and deployed to the "f:\\\\java\\\\   Jakarta-tomcat\\\\webapps "(This is the Tomcat directory on my Computer), then the Tomcat server automatically extracts and initializes" Demoweb.war ". Open the browser and enter "Http://127.0.0.1:8080/demoWeb/index.jsp" in the Address bar ok! You should be able to see the following interface:




You can also right-click the Demoweb folder in Package Explorer, and then take the following steps, as shown in figure:




6. Add a statement "index.jsp" to "<% out.println" ("Use jsp!"); %> ", then save, click" Deploy module ", refresh browser, should be able to see the following interface:







7. Add the following statements, save, deploy the module, and refresh the browser.







1. Software Required    

JSTL 1.1.1Home http://jakarta.apache.org/taglibs/doc/standard-doc/intro.htmlDownload Http://www.apache.org/dist/jakarta/taglibs/standard/binaries/jakarta-taglibs-standard-1.1.1.zip 

XML BuddyHome http://xmlbuddy.comDownload Http://xmlbuddy.com/2.0/58904908428240984589/409502405985075764578/3.0M9/xmlbuddy_2.0.10.zipThis is an Eclipse plug-in that can help you edit an XML file (optional installation). 

2. Environment ConfigurationCreate a new Lomboz Java project, project name: "JSTL Sample"; Fill out the Web Modules: "DEMOWEB2"; Added servers: "Tomcat 5.0.28", because of my last article on Eclipse New architectural    Process introduction of the more detailed, here Jane.      Directory structure f:\\\\j2sdk JDK directory d:\\\\eclipse Eclipse directory F:\\\\java\\\\jakarta-tomcat Tomcat 5.0.28 directory d:\\\\plug-in\\\\lomboz.301 lomboz directory (I am here to use the links method installed,D:\\\\java\\\\jstl Jakarta-taglibs-standard-1.1.1.zip's Extract directory D:\\\\eclipse\\\\workspace\\\\jstl Sample just Establishment of JSTL sample engineering directory according to the installed software, make a suitable configuration for yourself.

3. Join the library fileLocate the Jslt\\\\lib directory, copy the Jstl.jar, Standard.jar files to the Lib directory in the newly established "JSTL Sample" project directory (here is "d:\\\\eclipse\\\\workspace\\\\   JSTL sample\\\\demoweb2\\\\web-inf\\\\lib ").   Locate 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 as shown, and you can see that the three files you added are already displayed:



4. Modify the procedure

Attention

Since Lomboz only supports versions above JSTL1.1, EL is formally incorporated into JSP 2.0, so web.xml should use a schema of 2.4 instead of a 2.3 dtd.  
 Open the Web.xml file in the Web-inf directory and modify it as follows:

Web-inf/web.xml

<?xml version= "1.0" encoding= "Iso-8859-1"?>
<web-app xmlns= " HTTP://JAVA.SUN.COM/XML/NS/J2EE "
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" >
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
</web-app>

Attention

If you install the Xmlbuddy plugin and use it to open the "web.xml" file, you may receive the following error "cannot find the declaration of the element \\\ ' web-app\\\ '", Turn off the "Web.xml" file and the error disappears. It does not interfere with the operation of the program.
  Modify the index.jsp file below

DEMOWEB2/INDEX.JSP

<% @pageContenttype= "TEXT/HTML;CHARSET=GBK"%>
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core"prefix=" C "%> <title>count to Example (using JSTL and Scriptlet) </title>
<body>

<%--this is to use Jstl to print 1 to ten--%>
Use Jstl to print 1 to <p>
<c:foreach var= "I" begin= "1" end= "ten" step= "1" >
<c:out value= "${i}"/>
<br/>
</c:forEach>

<%--this is to use JSP scriptlet print 1 to ten--%>
<p> print 1 to ten <p> using JSP scriptlet
<% for (int i=1;i<=10;i++) {%>
<%=i%><br/>
<%}%>

</body>
Attention
In Lomboz, only the JSTL 1.1 version is supported, so the URI of its core tag library defaults to Http://java.sun.com/jsp/jstl/core. Because JSTL 1.1 also supports JSTL 1.0 and 1.1, if the URI of the core tag library is Http://java.sun.com/jstl/core, then the core tag Library of Jstl 1.0 will be used. An error occurs at this point in Lomboz.

5. Run the progra

 After you save the file, deploy the DEMOWEB2 module, run the server, and then enter the address in the browser window:    http://localhost:8080/demoWeb2    ok! should be able to see the following interface:





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.