Question: I am trying to build a register form in java using springboot framework. when I try to register new user I got this error

I am trying to build a register form in java using springboot framework. when I try to register new user I got this error " Required String parameter 'username' is not present]"

**** Here is my register post mapping *****

// request parameter to save User_id and Role_Id in the database

@PostMapping("/register")

public String postRequest(@RequestParam String name, @RequestParam String username, @RequestParam String password) {

da.addUser(name, username ,password);

Long userId = da.findUserAccount(username).getUserID();

da.addRole(userId, Long.valueOf(1)); // Admin (Secured Pages)

da.addRole(userId, Long.valueOf(2)); // User (All Pages)

//after registering, it redirects into the home page again

return "redirect:/poll";

}

**** register Html file ***

onsubmit="return verify()">

Registration Form

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!