SSH Framework Online Mall Project 27th War application of domain name space and project deployment and release _java

Source: Internet
Author: User
Tags ftp ssh buy domain tomcat server

The front land continued to complete the online mall some basic functions, although there are many places to be perfected, but do not affect the deployment and release of the project, we can play a first, this section mainly introduces the next domain name space applications and project deployment and release process.

1. Application of domain name space

As a great cock silk, certainly have no money to buy domain space, it is natural to want to apply for a free, now free domain name space is also a lot, I am in good JSP technology online application of a probationary period is 15 days, we can also go to apply for a play, anyway, as a study, this is enough, of course, If you want to pay for a long time. The registration process I cut a few figures, as follows:



Then the next step, finally opened as follows:


  

It is recommended that the above information be recorded with a TXT document, especially the domain name, there are some temporary application information, because not long-term use, may not notice, the next day landing, found that may even the most simple login username password forgot yo hello ... To have the habit of recording important information at any time, to have the habit of recording important information, to have the habit of recording important information at any time, the important thing to say three times, you know ~
Then click into the JSP Control Panel, which has a lot of information related to the application of the account, can go to see, the back of our project deployment is here to deploy. As follows:


  

There are a few more important information to record, such as: the domain name is needless to say, theweb directory , this is our project finally deployed to the server after a directory, the server's IP to remember, this to the back to know what to use.
Here, we have applied for 15 days of free use space, and he also sent the domain name and database, then we will start to deploy our own projects.

2. Deployment and release of projects

Although we have applied for a good domain name space, but not directly to our project to throw up on the line, first of all we must not directly to the project's source code to throw it up, and secondly, even if the source is still up, OK can run? The answer is certainly not, and some parts of the local project need to be changed. Next, on my project to specify where things need to be modified.

2.1 Local Project + Local database test

Just at the time of application, he gave us the web directory, this is very important, that is to say, our project deployed to his server, he gave the directory under the root directory, this root is the default root directory, if we direct the code to be sent to root, that can be directly used http://域名/ To visit. If there are other subdirectories, it needs to be http://域名/子目录/ accessed.
So, first we have to test locally, throw the project code to the local tomcat root to run through, first redeploy the engineering E_shop (my project name), then open the Tomcat server, and then see the Tomcat directory \webapps\ The directory has root and e_shop two directories, which the Earth people know, and then turn off Tomcat, e_shop everything in the copy, paste into root (first turn off Tomcat and then copy and paste, or you may report a mistake, my is), Then kill (or not kill) the E_shop deployed under the Tomcat server, restart Tomcat, and then type in the browser: http://localhost:8080/E_shop/index.jsp hang up, because I just killed the E_shop under Tomcat (which is accessible if not killed), enter http://localhost:8080/index.jsp Can be normal access, indicating that I put the original e_shop in the contents of the root can be directly accessed by domain name (because index.jsp can be omitted). This local test is not a problem.
"Note" in the Tomcat directory of the project inside are class files and some JSP files, no source Java files, so the following if we use FTP upload is also a transmission under Tomcat under the Engineering directory of all files.

2.2 Local Project + remote database test

Well, just testing in the local is normal, this has nothing to do with the remote, now we want to use the remote database test, this remote database is just registered when he sent the database, including the database name and connection to use the user name password are given to us, you just write down?
We use MyEclipse to develop the DB browser window and SQL result window, which is very convenient for us to connect the database in the MyEclipse and view the data in the database (if you do not know these two gadgets, you can look at: Struts2, Hibernate4 and Spring4 integration), we create a new connection in DB Browser, as follows:
  


We can see, here we create a new connection is to connect just he gave us the remote database, URL, username and password He gave us, after the connection is successful, we have to test whether we can insert data in our own database in this remote database, So I copy all the contents of my Shop.sql file to the new Remote.sql, open the Remote.sql and connect the new remote database driver We just created, execute all the commands in the SQL file, if you can The result window saw that the same information was inserted in the database indicating that the connection was successful and could be used normally.
OK, the remote database connection is good, the next thing to do is to modify the connection database configuration file, because our current local profile is connected to the local database, so certainly not, we deployed the project, he should automatically connect to the remote database, and read and write the data later in that remote database. Let's take a look at the local database connection profile conn.properties:

Datasource=com.mchange.v2.c3p0.combopooleddatasource
Driverclass=com. MySQL.jdbc.Driver
Jdbcurl=jdbc:mysql://localhost:3306/shop
User=root
Password=root
We create a new remote.properties:

Datasource=com.mchange.v2.c3p0.combopooleddatasource
Driverclass=com.mysql.jdbc.driver
Jdbcurl=jdbc:mysql://115.238.249.172:3306/sq_eson
User=sq_eson
password=squ138
The basic parameters are all given to us, so that we can connect to the remote database, and then modify the configuration in Beans.xml:

<bean class= "Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
 <property Name= "Locations" >
 <array>
 <!--<value>classpath:conn.properties</value>-->
 <value>classpath:remote.properties</value>
 </array>
 </property>
 </bean>

Here you can experience the advantages of using the properties profile, if you want to modify the configuration file only need to modify, do not have to change a large area of the original things in the program! In addition to a friendly tip, try not to delete the original, such as Conn.properties file, because the project later, if you want to change, the test is still in the local, as far as possible do not delete, if you can comment on the annotation, do not affect the words do not delete, unless deleted.
After the above changes, the project will automatically connect to the remote database after startup, and then we open the Tomcat server, open the homepage, select a product, click to Buy, of course, do not pay, click Purchase will be in storage, We can check whether the remote database to add a new shopping information can be judged to be normal. Here we have completed the local project + remote database test, no problem is going down.

2.3 Modify a local project in the original written dead things

This is very good understanding, because originally we write the project in order to facilitate testing, some places directly to the data to test whether the function is normal. This has to be determined in conjunction with the actual project for example, I am the online Mall project, before the mail and text messages are my own mail address and mobile phone number, so now to generate a user in the table, mail and mobile phone number are filled out their own, then after deployment I use this user login to purchase, Then I can receive emails and text messages on my own, and then I want to update the order status as paid after the purchase, I test is just fill in the meaning, these details should pay attention to And the price of modifying a commodity is 0.01 yuan, because after deployment to test whether the function is normal, if the price is hundreds of thousands of, has been crying dizzy in the toilet ~ In addition, my project also has a place, is to add merchandise after the product picture saved to a server address, We have to change to the corresponding directory at the remote server:

#原来的basePath注释掉
#basePath =e\:\\web\\apache-tomcat-8.0.26\\webapps\\e_shop
basepath=e\:\\www1\\eson-0b44449e54c855b40154dbd2b0b906d9\\webapps\\root\\
Filepath=\\files
Bankimagepath=\\files\\bankimages

So in the development of the time, if a place needs to be modified at the time, is to test the convenience of manual to a parameter and so on, it is best to have a note in the corresponding position to facilitate the later deployment of changes, or to the back will certainly fall off.

3. Upload Project file

Preparations are done, and then upload the project file, here are mainly introduced two ways to upload: FTP upload and the provider's website online upload.

3.1 FTP Upload

FTP is a file upload protocol, you can upload files to the designated location or download files from the specified location (provide a free download address, there are cracked key), FTP upload is relatively simple, but the time may be a little longer, suggest 1.1 points of transmission, so that data is not easy to lose. Next I introduce the FTP upload process:

Copy the project that was deployed under the Tomcat directory to the desktop, for example, my project is e_shop open FTP upload software, the left side of the desktop \e_shop, positioning to the project directory in the right configuration to upload the address, as shown in the following picture and then drag the left side of the file to the right window can be completed upload

Let's look at the FTP upload interface, mainly to see the third step above the connection:

The connection is ready to upload, note: After the connection, the right window to navigate to the root directory, can not locate the wrong. Then slowly wait for a good pass, and then direct access to the previous application provided by the domain name can be accessed.

3.2 Online Upload

Just registered, you can upload in the JSP Control Panel, but this requires that we first export project engineering as a war package, and then upload the war package, the project to export as a war package is very simple, in the MyEclipse click File->export-> Input War, Then select the location you want to export (select the desktop) and you can export it successfully. Then we look at the best JSP technology to provide us with the online deployment as follows:

You can then use the domain name directly to access the project that has just been deployed, when the Web page bouncing out that moment, that kind of pleasure, is not the Tokyo heat energy gave ~ ~ Of course, also can not preach the whole project, even a index.jsp play one, look at the effect, go down the process is OK ~
OK, the domain name space application and the deployment release of the project is introduced to this! I will go back to the simple improvement of some places, almost can upload the source code.

Original address: http://blog.csdn.net/eson_15/article/details/51484247

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.