I recently ran into a problem with spring mvc and searched the web for a lot of information. I can hardly see the solution!
For example: When we do bulk add or update, in the controller layer to receive the form data problem!
We do a batch of users to add the experiment!
User model:
public class User {
//username
private String username;
Password
private String password;
Public String GetUserName () {return
username;
}
public void Setusername (String username) {
This.username = Username = = null? Null:username.trim ();
}
Public String GetPassword () {return
password;
}
public void SetPassword (String password) {
This.password = password = = null? Null:password.trim ();
}
Public User (string Username, string password) {
super ();
This.username = Username;
This.password = password;
}
Public User () {
super ();
}
}
Control layer:
@Controller
@RequestMapping ("/") public
class Usercontroller {
/**
* Logger to this class * *
private static final Logger Logger = Logger.getlogger (usercontroller.class);
@RequestMapping ("/user") public
void Test (list<user> users) {
logger.debug Jsonarray.tojson (users);
}
}
We are creating a JSP:
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF
-8"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Now let's test it.