0
Follow
0
View

A null pointer exception is displayed. The role cannot be obtained

lwaooo0777 注册会员
2023-02-27 14:22

has been modified successfully, thank you for your comments, change the code role.equals(" administrator ") to Objects.equals(role, "administrator ") can be

dsyy80 注册会员
2023-02-27 14:22

Two directions:

First whether the role parameter is passed
@Param Parameter is passed from the front end by specifying the attribute value. Parameter is passed or no parameter is passed. If role is empty, the method cannot be invoked.

Second, from the perspective of compatibility,
does not use role to call equals directly, but uses "administrator ".equas(role) to do logical processing. If role is empty or null character, do processing; if not, do service processing.

daiemen 注册会员
2023-02-27 14:22

If the problem is solved, be sure to use it.

cyl821122 注册会员
2023-02-27 14:22

reference: < a > http://t.csdn.cn/Eisvx < / a >

cupidfang8 注册会员
2023-02-27 14:22

/login is called by the browser. Check whether the role parameter is passed during the request.

xuhui820407 注册会员
2023-02-27 14:22
I don't know if you have solved this problem, if not:
  • You can refer to this article:

If you have solved the problem, I really hope you can share the solution, write a blog post about it, put a link to it in the comments section, To help more people ^-^

About the Author

Question Info

Publish Time
2023-02-27 14:22
Update Time
2023-02-27 14:22

Related Question

System.console()在使用gradle在Intellij中运行时返回null

WebRTC getDisplayMedia不支持移动端浏览器

我如何在discord.js中使用特定的公会ID ?

Register-ScheduledTask:参数不正确.哪一个?

<>操作符在Chisel?

ArcGIS计算泰勒指数

发现IIS的一个BUG也可能是漏洞,不知道如何解决

SQL语句中的数据错误:AnalysisException:不能从数组中向上转换文档

关于java中mybatis返回bean有继承时属性赋值的问题!

从S3读取数据后用'null'字符串代替null