In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "SpringBoot integration netty how to achieve front-end data interaction", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "SpringBoot integration netty how to achieve front-end data interaction" bar!
Use SpringBoot to integrate with netty, and netty can be managed using Gradle. Here, since Gradle is not very familiar with, Maven integration continues, and SpringBoot uses version 2.x.
Create a new Maven project-- >
Enter gav and click finish to introduce pom dependency
Mainly output SpringBoot and some tool classes
Create a new application.properties under the resource directory
Configure port number, character set, and integrate mabatis. Previous projects used Ali's druid connection pool, and the information here uses Hikari, which is more or less the same.
Create a new com.kk package, and then create a new Application
Then under the kk package, create a new HelloController
Right-click to run application, and type localhost:8080/hello in the browser to show that hello~ is successfully integrated.
Since you are going to use netty, the back-end data interaction of the project is handed over to netty
Introduce netty dependency
Io.netty
Netty-all
4.1.25.Final
Create a new netty package at the same level as the controller package
WSServer binds the port number
WSserverInitializer specifies handler
Chathandler
The main information has been completed, start the previously written page for testing
Debugging completed
Create a new login page in Hbuilder for the login page of the project
Page code
Page effect-- >
Because the back-end code is simple and tedious, the login registration is written in a submit event, and the back-end interaction code can be sent privately.
The front end carries out a length limit for passwords and usernames through js
Start the joint debugging pedestal. After starting here, the chat record box will be displayed by default on the page we previously set up. Here, change the setting to display it as a login page.
Double-click mainfest.json to change the page entry to login.html
Page effect
Enter more than 12 user passwords
We use alert () in the bullet layer here. Previous projects have used layer. It is suggested that the ToastOptions method of nativeUi of html5+ should be changed. For some methods, it is encapsulated in app.js.
/ * *
* encapsulate the message prompt box. The default mui does not support centering and custom icon, so h6 + is used.
* @ param {Object} msg
* @ param {Object} type
, /
ShowToast: function (msg, type) {
Plus.nativeUI.toast (msg
{icon: "image/" + type + ".png", verticalAlign: "center"})
}
Picture of image prompt, location of center prompt
Restart joint adjustment
Effect debugging completed
Conduct back-end joint adjustment
When the backend sends data, we usually use Ajax. Here, we use mui's Ajax according to the document.
Thank you for your reading, the above is the content of "how SpringBoot integrates netty to achieve the interaction of front and rear data". After the study of this article, I believe you have a deeper understanding of how SpringBoot integrates netty to achieve the interaction of front and rear data, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.