first of all, it is not possible to reference react components directly in jsp, because react code needs to be packaged and compiled into native js code
you can create a new jsp: such as nav.jsp, then write react code normally and package it into nav.js, introduced in nav.jsp (including login function), and then add this nav.jsp include to the existing jsp
if it's too troublesome or just wants to write js code directly in jsp, you should write native js code or use some auxiliary library files such as JQ
Previous: The type of method binding of golang, when to pass the value and when to pass the pointer?