当前位置:网站首页>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 .
边栏推荐
- Redis highly available slice cluster
- What is the difference between canvas and SVG?
- PXE startup configuration and principle
- Semantic segmentation experiment: UNET network /msrc2 dataset
- Complete activity switching according to sliding
- 语义分割实验:Unet网络/MSRC2数据集
- The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
- Hash tag usage in redis cluster
- struct MySQL
- Learn JVM garbage collection 05 - root node enumeration, security points, and security zones (hotspot)
猜你喜欢
- [email protected] (using password"/>
Solve the error 1045 of Navicat creating local connection -access denied for user [email protected] (using password
报错ModuleNotFoundError: No module named ‘cv2.aruco‘
[pytorch pre training model modification, addition and deletion of specific layers]
abap查表程序
Redis highly available slice cluster
Take you two minutes to quickly master the route and navigation of flutter
Troubleshooting of high memory usage of redis in a production environment
Multi table operation - Auto Association query
What is digital existence? Digital transformation starts with digital existence
Matlab boundarymask function (find the boundary of the divided area)
随机推荐
The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
POJ-2499 Binary Tree
Simply solve the problem that the node in the redis cluster cannot read data (error) moved
MySQL multi table operation
Time tools
Solve the problem of cache and database double write data consistency
Deep discussion on the decoding of sent protocol
mysql拆分字符串做条件查询
嵌入式软件架构设计-消息交互
2022年国内云管平台厂商哪家好?为什么?
Learn the memory management of JVM 02 - memory allocation of JVM
Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
abap查表程序
Semantic segmentation experiment: UNET network /msrc2 dataset
Tabbar configuration at the bottom of wechat applet
Four operations and derivative operations of MATLAB polynomials
Recyclerview paging slide
Take you two minutes to quickly master the route and navigation of flutter
How to design an interface?
Two minutes will take you to quickly master the project structure, resources, dependencies and localization of flutter