Spring 中的 ModelAttribute 和前端请求
spring
RequestBody 和 RequestParam
const buildQueryString = (params, parentKey) => {
if (params === null) {return "";};
const queryString = Object.keys(params).map(key => {
const fullKey = parentKey ? `${parentKey}[${key}]` : key;
if (Array.isArray(params[key])) {
return params[key].map(item => `${encodeURIComponent(fullKey)}=${encodeURIComponent(item)}`).join('&');
} else if (typeof params[key] === 'object') {
return buildQueryString(params[key], fullKey);
} else {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(params[key])}`;
}
}).join('&');
return queryString;
};
class Bean {
private String resourceType;
private String[] groupPath;
private Map<String, String[]> tags;
}