当前位置:网站首页>Ecplise development environment configuration and simple web project construction
Ecplise development environment configuration and simple web project construction
2022-07-05 12:21:00 【A finger leaf next to the giant】
Preface :
The laptop is heavy on the back , There are development software and jdk Of the operating environment , It's just that you need to write extra things when running some specific projects .
For computers in the computer room , It's like ecplise Create a new development environment . This needs to be reconfigured . Here I try to summarize the additional things that need to be configured to run the project in the new development environment .
Its core theme is : Reduce the connection with the computer , As long as there is ecplise and jdk Environmental Science , You can run the project through configuration .
Project webpage display :
This is the static web page after running , The project is expected to implement a login function first
Login screen :
After login, the interface 
New development environment :
1. Switch the project environment 
2. New environment file path 
3. New folder , And select 
4. Switching environment 

Configure the basic environment
Operating environment configuration
In general , There are computers in the computer room jdk,jre Environment configuration , It's not recorded here , There are good documents to refer to .
JDK1.8 To configure
see JDK edition :
see jre
Here you can configure multiple running environments , But only the selected one is the running environment
jre Environment configuration :
Click on the right add:

choice Dictionary find jdk perhaps jre File storage location .
Here because of me jdk The version is 1.8 , So the corresponding 8.0jdk edition .jdk contain jre, So choose jdk,jre Can run projects . Remember to check , Select the added environment package 
The coding format is unified
In general , The encoding format is UTF-8 The coding library given is relatively complete , Different results in unexpected garbled code .
Format workspace encoding :

jsp File encoding format 
View the document coding format of the project :

java File font size modification :
jsp Document font size modification :
Window–Preferences–General–Colors and Fonts ( It opens at Basic Set it up )
Server Server configuration
To configure Tomcat The server 
Choose which version you have around 
Select the location of the file 
establish Web project


Click on next->next , Then remember to let the automatic creation web.xml, Or you can copy one by yourself , But we must pay attention to WEB-INF Under the document 

In actual project development , Be sure to pay attention to the specification of file storage path , And naming conventions . Don't litter , It's not easy to integrate at that time , management
About my first struct2 - web project , I want to do the front end of last semester HTML page , As the login home page ,
Then we must first HTML File becomes jsp file , And then css Wait for the image path to be stored :
I'll show you the template I usually set :
.HTML Turn into .jsp file :
Actually jsp The main code of the file is HTML Add a little bit of code java Code
Method 1 :
1. Design jsp How the page is encoded
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
That is, just set jsp The coding method code is placed in the page header , Then change the suffix to jsp Namely jsp The file .
In this way, it can be copied directly into the project .
Method 2 :
This is my general operation
1. establish jsp file ,
jsp and css Files are easy to create :
Selected items new->other file - retrieval jsp perhaps css
And then directly put HTML Copy all the code of the file to jsp In file , primary jsp Only the page header is reserved for the file
namely The selected part is the covered part :
Publish the project :
Try to run a web page first :
You can see that the working environment in the upper left corner is java EE
If the workspace is messy by itself, you can reset the layout of the workspace 
You can also directly show view Find the window you need 
Then click add below Server

Add the project to be published to the area on the right , And then click Finish, This completes the release of the project 
Click the extension to see the project we released
When we're in server When a server is added ,server Will remember this server , When publishing the project again , You can right-click the service to select
add and remove Release and remove the project 
Choose Tomcat And click the running symbol on the right , Note the running server , Instead of clicking on items 
You can see that the release was successful

Run the project
View the project file access suffix


Generally speaking , This suffix defaults to the project name , Sometimes for the convenience of the path , It can be modified here , I often make it shorter , therefore , Take a heart , Take a look .

We enter this string of addresses on the web page , It turned out that it was reported 404 error , This error usually refers to the file not found , It can also be said to be a path error .
Let's see web.xml

Initially generated web.xml Only these , You can see that there are several projects running the files opened by default .
When we created , The project is not automatically generated index.jsp, Or files with other names above .
At this time, you need to manually add index.jsp file
When accessing the project, it defaults to WebContent The file started , So we create one directly under it index.jsp

Refresh our website at this time 
see , This is what I wrote index.jsp Document display .
Be careful : We created it manually index.jsp file , But it is stored directly in WebContent In the catalog , This is the same as we expected jsp In file , The idea of unified management is inconsistent , This is right in the later stage jsp Unified document management is very unfavorable ,
Then how should we try to index.jsp Deposit in WebContent/jsp Under the directory ?
The first document of how to make the project run is WebContent/jsp In the catalog jsp File homepage ?
For the first question , What I want to bring out is , There may be a little friend who thinks that as long as web.xml Just change the access path in the file , But the truth is , Path modification in the file is not feasible , This is because the default page of the project is set except for modification xml Outside the document , You also need to configure tomcat A file in , The location of this file is tomcat In the directory file of the server , The specific location is Servers\MyEclipse Tomcat v7.0-config\web.xml. This is also a xml file
That is to say, use this tomcat Server layout project , Your revelation page can only be named index, But not for student. If you want to modify , Then you need to combine the project with tomcat Medium xml The files have been modified . Many people only pay attention to their own projects xml file , Ignoring the tomact Start page configuration in the server .
Imagine if we would tomcat In the document , So the next time you run the project , Is the home page path still to be modified ? Obviously, this is not worth the loss , It's too troublesome .
ps: In the next development , I tried to modify web.xml The default home page in the file , It turned out that the jump was successful , I was a fool for a moment , I used to write spring Project time , It's impossible , I lost it , The above modification , I have also done experiments , There is a basis for , If you encounter in the development, you can't web.xml Modify the default homepage in the file , Then think about this place …
The general solution , Is when the project is running , By intercepting all requests , And in the regulation “/” Forward the empty path request to the page to jump .
Next , In use struts2 Frame will be used . This is mainly to explain the problem of changing the path above . We continue .
边栏推荐
- MySQL regular expression
- MySQL constraints
- Redis highly available slice cluster
- Codeworks 5 questions per day (1700 average) - day 5
- Solution to order timeout unpaid
- MySQL splits strings for conditional queries
- Understand redis persistence mechanism in one article
- Matlab struct function (structure array)
- Learn memory management of JVM 01 - first memory
- Matlab label2idx function (convert the label matrix into a cell array with linear index)
猜你喜欢

MySQL index - extended data

One article tells the latest and complete learning materials of flutter

ZABBIX customized monitoring disk IO performance

16 channel water lamp experiment based on Proteus (assembly language)

Troubleshooting of high memory usage of redis in a production environment
调查显示传统数据安全工具在60%情况下无法抵御勒索软件攻击

Get data from the database when using JMeter for database assertion

abap查表程序

ZABBIX ODBC database monitoring

Why learn harmonyos and how to get started quickly?
随机推荐
7月华清学习-1
Codeforces Round #804 (Div. 2)
ZABBIX 5.0 - LNMP environment compilation and installation
How can beginners learn flutter efficiently?
JS for loop number exception
Interviewer: is acid fully guaranteed for redis transactions?
【load dataset】
【ijkplayer】when i compile file “compile-ffmpeg.sh“ ,it show error “No such file or directory“.
Seven ways to achieve vertical centering
One article tells the latest and complete learning materials of flutter
II. Data type
Learn the memory management of JVM 02 - memory allocation of JVM
Hiengine: comparable to the local cloud native memory database engine
Matlab superpixels function (2D super pixel over segmentation of image)
想问问,如何选择券商?在线开户是很安全么?
Learn the memory management of JVM 03 - Method area and meta space of JVM
byte2String、string2Byte
A new WiFi option for smart home -- the application of simplewifi in wireless smart home
ABAP table lookup program
Redis highly available sentinel cluster