本文整理匯總了Java中com.entity.User類的典型用法代碼示例。如果您正苦於以下問題:Java User類的具體用法?Java User怎麽用?Java User使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
User類屬於com.entity包,在下文中一共展示了User類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Add
import com.entity.User; //導入依賴的package包/類
@RequestMapping("/Add")
public String Add(ModelMap model, HttpServletRequest request, HttpServletResponse response, HttpSession httpSession) {
model.addAttribute("message", "Home !");
String title = request.getParameter("title");
String content = request.getParameter("content");
int id;
User user = (User) httpSession.getAttribute("User");
if (user == null) {
return "false";
} else {
id = user.getId();
}
String type = request.getParameter("type");
Date date = new Date();
Article art = new Article();
art.setCreateUserId(id);
art.setTitle(title);
art.setContent(content);
art.setCreateTime(date);
art.setModifyTime(date);
art.setType(type);
articleService.save(art);
return "article";
}
示例2: GetIdByUserData
import com.entity.User; //導入依賴的package包/類
/**
* get user's id by user data
*
* @param userData
* user data
* @return user id if exist or -1 if not exist
*/
public static int GetIdByUserData(List<User> userList, int userData) {
// initialize id is -1
int id = -1;
int size = userList.size();
// traverse by line
for (int i = 0; i < size; i++) {
if (userList.get(i).userData == userData) {
id = userList.get(i).userId;
break;
}
}
return id;
}
示例3: Login
import com.entity.User; //導入依賴的package包/類
@RequestMapping("/Login")
public String Login(ModelMap model, HttpServletRequest request, HttpSession httpSession) {
String loginName = request.getParameter("loginName");
String psw = request.getParameter("psw");
User user = (User) userService.login(loginName, psw);
if (user == null) {
return "Error loginName or passWord !";
} else {
httpSession.setAttribute("User", user);
}
model.addAttribute("isLogin", "true");
return "redirect:/Home/Index";// �ض���
}
示例4: List
import com.entity.User; //導入依賴的package包/類
@RequestMapping("/List")
public String List(ModelMap model) {
model.addAttribute("message", "this is article page !");
List<User> userList = userService.listAll();
model.addAttribute("userList", userList);
return "UserList";
}
示例5: Add
import com.entity.User; //導入依賴的package包/類
@RequestMapping("/Add")
public String Add(ModelMap model, HttpServletRequest request, HttpServletResponse response) {
model.addAttribute("message", "User !");
String name = request.getParameter("name");
int age = Integer.parseInt(request.getParameter("age"));
String loginName = request.getParameter("loginName");
String passWord = request.getParameter("passWord");
User user = new User();
user.setName(name);
user.setAge(age);
user.setLoginName(loginName);
user.setPassWord(passWord);
userService.save(user);
return "UserList";
}
示例6: goToIndex2
import com.entity.User; //導入依賴的package包/類
@RequestMapping("/Home")
public String goToIndex2(ModelMap model, HttpSession httpSession) {
model.addAttribute("message", "/Home !");
User curUser = (User) httpSession.getAttribute("User");
if (curUser == null) {
return "login";
}
return "index";
}
示例7: LoginFilter
import com.entity.User; //導入依賴的package包/類
public ModelAndView LoginFilter(HttpSession httpSession) {
User curUser = (User) httpSession.getAttribute("User");
if (curUser == null) {
return new ModelAndView(new RedirectView("../login.jsp"));
}
return new ModelAndView(new RedirectView("../admin/login.jsp"));
}
示例8: login
import com.entity.User; //導入依賴的package包/類
public Object login(String loginName, String psw) {
String hql = "from User user where user.LoginName='" + loginName + "' and user.PassWord='" + psw + "'";
User user = super.loadOne(hql);
if (user != null) {
return user;
} else {
return null;
}
}
示例9: initializeItem
import com.entity.User; //導入依賴的package包/類
@Override
protected void initializeItem(int position, BaseNotify inputViewModel,
User item) {
VMUserSpinnerAdapter viewModel = CS.as(inputViewModel);
viewModel.textView_Header.setText(item.getFirstName() + " "
+ item.getLastName());
}
示例10: save
import com.entity.User; //導入依賴的package包/類
public void save(User art) {
super.save(art);
}
示例11: load
import com.entity.User; //導入依賴的package包/類
public User load(int id) {
return super.load(id);
}
示例12: update
import com.entity.User; //導入依賴的package包/類
public void update(User user) {
super.update(user);
}
示例13: listAll
import com.entity.User; //導入依賴的package包/類
public List<User> listAll() {
return super.listAll("User");
}
示例14: isRegister
import com.entity.User; //導入依賴的package包/類
public boolean isRegister(String loginName) {
String hql = "from User user where user.LoginName=" + loginName + "";
User user = super.loadOne(hql);
return user != null;
}
示例15: UserSpinnerAdapter
import com.entity.User; //導入依賴的package包/類
public UserSpinnerAdapter(Activity activity, User[] users) {
super(activity, R.layout.adapter_user);
updateItems(users);
}