Problem Description:
to register by login.html then call the service method RequestDemo01.java due to the problem of virtual paths, leading to errors in the registration page to register.
Virtual path configuration:
login.html的配置
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>注册</title> </head> <body> <form action="/requestDemo01" method="get"> <input type="text" name="username"> <input type="submit" value= "Sign" > </ form > </ body > </ HTML >
the Servlet class annotation configuration:
Error Screenshot:
solve:
The reason for the above error is action path in a form incorrectly set form
for this case, action should be set to
action = "requestDemo01"
or action = "./ requestDemo01"
or action = "/ Learning / requestDemo01"
followed by the virtual path
if you write a virtual path, when the browser visits Do not forget to write in the url.
Also a virtual path can be set to empty
or only a " /" can be