*/
protected String saveAndForward(Entity<?> entity) {
User user = (User) entity;
if (entityDao.duplicate(User.class, user.getId(), "name", user.getName())) {
addFlashMessageNow("security.error.usernameNotAvaliable", user.getName());
return forward(new Action(this, "edit"));
}
String errorMsg = "";
// // 收集用户身份
String[] categories = StringUtils.split(get("categoryIds"), ",");
user.getCategories().clear();
for (int i = 0; i < categories.length; i++) {
errorMsg = checkCategory(user, Long.valueOf(categories[i]));
if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
}
// 检验用户合法性
errorMsg = checkUser(user);
if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
processPassword(user);
if (!user.isPersisted()) {
User creator = userService.get(getUserId());
userService.createUser(creator, user);
} else {