当前位置:网站首页>Project Notes - Random 2

Project Notes - Random 2

2022-08-11 06:56:00 kerodaisuki

1. Upload the image to the tomcat server

Deploy the project to webapps

Adapt the deployment method to war mode and deploy the project under the webapps of tomcat

Two ways to deploy projects in Idea

war mode: upload the project to the webapps directory in the form of a wai package;

war exploaded mode: just the mapping of the directory, it is equivalent to tomcat starting in the project source folder

Create upload directory in webapps

The upload directory is specially used to save uploaded pictures

Upload image to server

Modify the output path of the image

1. Get the running directory information of the project

2. Intercept the directory path to webapps

3. Splice the output path and save the image to upload

Page Loading Image

When using tomcat as an image server, after storing the uploaded image, if you want the image to be accessible, you need to configure it in the idea:

1. Select extend source

Select the upload folder in the webapps directory

2. Upload a picture to the server

3. Load pictures on the internal page of the project

4. It can also be accessed through HTTP

http://localhost:8080/upload/xxxxxxxxx.jpg

BeanUtils Tools

BeanUtils is one of the members of Apache commons components, mainly used to simplify the operation of JavaBean package data.All data submitted by a form can be encapsulated into JavaBeans.

. BeanUtils Object Common Methods

populate(Object bean, Map properties) : Encapsulate the Map data into the specified javabean, generally used to encapsulate all the data of the form into the javabean

setProperty(Object obj , String name ,Object value) : set property value

getProperty(Object obj , String name): get the property value

原网站

版权声明
本文为[kerodaisuki]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110516481560.html