Javabean is used in this way.

Source: Internet
Author: User
Tags homesite php windows
Java-based J2EE is the latest e-commerce solution. its complexity and the high cost of development tool systems have also discouraged many people. in actual project applications, there are not many applications that really need to fully use the J2EE solution. The following combinations are sufficient for small and medium-sized enterprises to deal with e-commerce applications: JSP/servlet + JavaBeans (taglib) + MySQL (XML)

In terms of implementation, the combination of Linux + Tomcat + JDK + MySQL has proved to be stable, fast, and cost-effective. We hope that, among many small and medium systems, the combination of Linux + Tomcat + JDK + MySQL will rely on the power of open source, java will remain undefeated.

How to construct a simple JSP/JavaBean development and release environment?

After practice, I found that the combination of the following development tools can easily form a dynamic and scalable IDE environment:

Jcreator is used to edit and debug JavaBean;
Homesite (editplus Dreamweaver) is used to edit JSP files;
Tomcat serves as the Serlvet/JSP Container server;
MySQL acts as a database server;

JBoss acts as an EJB container server (if you do not use EJB, do not install it );
Ant is a release tool (not installed if you do not use EJB or J2EE );

This combination can be used to debug JSP or JavaBean directly through the IE browser, compared with the huge ide tool software such as JBuilder. the biggest advantage is the low resource consumption and the features of their respective tools. For example, homesite is very powerful in HTML/jsp writing. If your JSP/servlet server or EJB server uses open source software, this combination is no inferior to JBuilder.

Let's start with the specific configuration: first, let's assume that such a development and running environment: development is in a Windows system, while running is in a Linux system:

Development Environment

1. First, you need to install Tomcat + JDK on your PC windows, and install Tomcat + JDK on Linux;

2. Create a directory for your project. For example, C: myweb stores the JSP or JavaBean directory of your project. Create three directories under myweb:

JSP --> JSP source code
Beans --> JavaBean source program
WEB-INF/classes --> compiled JavaBean runtime program.

3. we hope that the compiled jsp can immediately see the running effect from the IE browser, and the JSP can be called immediately after the JavaBean compilation. Therefore, the Directory of our project must be placed in the Tomcat environment:

If you want to use http: // localhost: 8080/myweb to access your JSP program, modify server. XML in the conf directory of Tomcat:

.........

<! -- Tomcat Manager context -->
<Context Path = "/manager" docbase = "manager" DEBUG = "0" privileged = "true"/>

<! -- The following is a self-added -->
<Context Path = "/myweb" docbase = "C: myweb" DEBUG = "0" reloadable = "true"/>

.........

Restart tomcat.

You can access and debug your project through http: // localhost: 8080/myweb.

4. install the MySQL database. we recommend that you install the PHP Windows environment and phpMyAdmin to better manage MySQL. Of course, you can also use the management tool provided by MySQL windows. very troublesome. apache for Windows is required for PHP installation, or IIS of Win2000 can be used.

Install JDBC, download MySQL JDBC on the MySQL homepage, unzip it to mm. mysql-2.0.4-bin.jar, add the file to Tomcat's common/lib directory.

5. To install javamail, go to java.sun.com to download two support packages for javamail. The installation location is also in the common/lib directory of Tomcat.

6. Install JSP development tools: editplus, homesite, or JRun studio.

7. jcreator is recommended for installing Java development tools. It is a free software that runs fast and has low configuration requirements. The disadvantage is that manual programming is required. however, this is good for understanding many underlying concepts of Java.

After completing the preceding steps, we recommend that you start Windows before installing jcreator, so that Tomcat can run effectively and automatically search for your JDK directory during jcreator installation. you must enter jcreator to manually configure jcreator no matter whether it is found or not.

It is troublesome to configure the Java environment of jcreator. Select Options under the config menu to enter JDK profiles. if jcreator finds your JDK directory, an item is displayed. select "edit", select "add", and select "add jar" to add all the jar files in the common/lib directory under the Tomcat directory one by one.

In particular, the JDBC driver mm. mysql-2.0.4-bin.jar added to the environment, while tomcat/lib/common can be added to the servlet. jar and Sendmail package
In this way, no errors will occur when your jcreator compiles Java-related calling technologies.

8. after the above development environment is installed successfully, you can start to develop JSP/JavaBean, and open the browser, http: // localhost: 8080/myweb/to access your project directory, start JSP to run.

Debugging
In JSP/JavaBean, use out. println and system. out. println performs some breakpoint settings and debugging. Note that this is two different outputs. The former can see the output debugging results in the browser, and the latter can only be seen in the Tomcat console, which is easy to see in the Windows Tomcat console, it is the Black Start window of Tomcat. in Linux, you need to open logs/Catalina under the Tomcat directory. out

Release to running environment
Release the JSP/JavaBean you developed in windows to the Linux system for running. Use the FTP software to upload:

In Linux, a directory structure similar to myweb under Windows is also created, and the corresponding JSP and compiled javebeans FTP can be uploaded to the corresponding directory. note: you may need to restart tomcat, but Tomcat will automatically call the new JavaBean.

If you think there are too many files, you can use ant to compile and upload Shucheng. War packages. For more information, see other articles.

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.