About a problem encountered during a small example of javabean jsp
There is no connection error in the database, and index.jsp can also be displayed. . .
Please help the newbies to answer~~... ...under the guidance of my little brother...^ ^
Thank you very much ~! !
Jump to login.jsp
Why is a null pointer error reported?
sql table
The code is as follows:
index.jsp
login.jsp
UserService.java
User.java
Conn.java
欧阳克2017-06-12 09:22:10
user is empty, username and password cannot be obtained
In this case, you have written the logic of data submission in jsp, but the background does not receive it. You can write it in action or controller
User u = new User();
u.setUsername(request.getParameter("username"));
u.setPassword(request.getParameter("password"));
调用service并传参就ok了
漂亮男人2017-06-12 09:22:10
Personally, I think a checkInput should be added first to determine whether it is the data passed by the login form? Otherwise, it will be null at the beginning when the page is rendered?
String name=request.getPamareter("name");
if(name=="loin"){//It should be login
............
}