Step-by-Step teaches you to use Eclipse and Tomcat for seam development

Source: Internet
Author: User
Tags jboss tomcat server
Step-by -Step teaches you to use Eclipse and Tomcat for seam development

author : Prem translation : Thomas Origin : techieexchange

Author Introduction : Prem, Senior advisor and technical project leader, currently works for fourth project Group.

Summary: This article demonstrates how to use eclipse and Tomcat for seam development, and this article can be used as a project template based on pojo+jpa+hibernate seam development.

JBoss Seam is one of the most innovative, fully-stack Web application frameworks in the Java EE field.

Here, we are not going to introduce the basic concepts of seam, let's go straight to the tutorial.

In order to develop an enterprise application, you must first install an application server locally, which is painful if you take into account system resources and performance issues.

During the development phase, developers usually want the code to be hot-deployed for as short a time as possible, because it will greatly improve their development efficiency. But in the development process, when the application server is running, this will be difficult to achieve.

Alternatively, you can use a Web server that is lighter than the application server. Seam has good support for Tomcat Web servers.

This tutorial focuses on demonstrating seam development under a Tomcat Web server that does not support EJBS, which also means using Pojo and using JPA and hibernate as persistent providers for seam development.

The primary goal of this tutorial is to use seam, Tomcat, and Eclipse for rapid application development.

environment requirements for seam development :

Download the latest version of seam 2.0.0 GA

Download Tomcat 5.5 or Tomcat 6

Download the latest version of Eclipse

Download Sysdeo Tomcat Plugin

Let's get started.

1. Decompression Seam 2 GA distribution to local hard drive

(Figure 1)

2. JPA example from seam 2 GA distribution

(Figure 2)

3. Use ant to deploy the JPA instances in tomcat5.5 (make sure you have Ant installed).

Type command:ant tomcat55, create the JPA war file.

(Figure 3)

4. Once the creation is successful, you can find Jboss-seam-jpa.war this war file in the Dist-tomcat55 directory.

(Figure 4)

5. Now import the war file into Eclipse and build an Eclipse project.

(Figure 5)

6. Select Web-> War file import war files in the Eclipse import console

(Figure 6)

7. Select the absolute path to the Jboss-seam-jpa.war file and click next.

(Figure 7)

8. Import all libs from the Web-inf/lib directory

(Figure 8)

9. This is a new project to create on the Eclipse Workbench

(Figure 9)

10. Create a Classes folder in the Web-inf directory for storing class files.

(Figure 10)

11. Configure the compile path so that the SRC directory can use the correct classes directory.

(Figure 11)

12. Select the classes directory as the default output directory

(Figure 12)

13. Copy all files in the SRC directory from the SEAM-JPA instance

(Figure 13)

14. Paste into the SRC directory in the Eclipse project

(Figure 14)

15. Now the file under SRC has been shown as a directory structure, but there are errors.

(Figure 15)

16. Delete the importedclasses directory under the root directory of the Eclipse Project Workbench

(Figure 16)

17. In order to remove the error display in the SRC directory, import the testng package into the Web-inf/lib directory.

(Figure 17)

18. Now the error in the SRC directory disappears.

(Figure 18)

19. Configure the Tomcat Sysdeo plugin to Tomcat's installation directory

(Figure 19)

20. On the Eclipse toolbar, you will see the Sysdeo-tomcat shortcut keys –start,shutdown and restart.

(Figure 20)

21. Tell the established project (JBOSS-SEAM-JPA) It is a Web project based on Sysdeo Plug-ins ( project-> Right-click-Properties->tomcat)

(Figure 21)

22. Update/Define the context of the project now in Tomcat (Server.xml will be updated)

(Figure 22)

23. Open the Context.xml file (in the Webcontent/meta-inf directory) and copy the Resource label.

(Figure 23)

24. Open the Server.xml file (under the tomcat_home/conf directory) to see if the project context is defined.

(Figure 24)

25. Paste the resource label from Context.xml as a child label under the Context tab in Server.xml (please make sure resource is off)

(Figure 25)

26. In order to use Hsql DB, copy Hsql.jar from seam distribution to tomcat-home/common/lib directory.

(Figure 26)

27. Now all the configuration work is done, then click the Start button on the Eclipse-sysdeo toolbar to start Tomcat.

(Figure 27)

28. You can see that the console is outputting information that the Tomcat server has started

(Figure 28)

29. Test whether the application has started by opening the browser and browsing the HTTP://LOCALHOST:8080/JBOSS-SEAM-JPA .

Note the footer section of the first page, and we'll modify it in the next step.

(Figure 29)

30. Open the Home.xhtml file (the first page of the application) in the WebContent directory and check the footer section.

(Figure 30)

31. Edit footer Notes to save the page.

(Figure 31)

32. Now back to the browser running the application, click Refresh or F5 key to overload the page.

That's it. You don't need to reboot the server, your code is hot deployed, and the page is loaded again.

(Figure 32)

Note that to improve development efficiency, Tomcat should be used only during the development phase, while in the product deployment phase, other application servers should be used.

I would like to be able to "give a look" through this tutorial to provide a project template based on pojo+jpa+hibernate seam development.

Look forward to sharing your insights.

revisers : Richard

Original articles such as reprint, please specify: Reproduced from the JBoss seam Chinese station
[http://www.jbossseam.com/]
This article link address: http://www.jbossseam.com/2007/11/16/seam-development-with-eclipse-and-tomcat/

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.