當前位置: 首頁>>代碼示例>>Java>>正文


Java User類代碼示例

本文整理匯總了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";
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:25,代碼來源:ArticleController.java

示例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;
}
 
開發者ID:lanxuezaipiao,項目名稱:movie-recommendation-system,代碼行數:23,代碼來源:UserBase.java

示例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";// �ض���
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:14,代碼來源:UserController.java

示例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";
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:8,代碼來源:UserController.java

示例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";
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:16,代碼來源:UserController.java

示例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";
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:10,代碼來源:HomeController.java

示例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"));
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:8,代碼來源:HomeController.java

示例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;
    }
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:10,代碼來源:UserService.java

示例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());
}
 
開發者ID:SimoneLocatelli,項目名稱:androidbase,代碼行數:10,代碼來源:UserSpinnerAdapter.java

示例10: save

import com.entity.User; //導入依賴的package包/類
public void save(User art) {
    super.save(art);
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:4,代碼來源:UserService.java

示例11: load

import com.entity.User; //導入依賴的package包/類
public User load(int id) {
    return super.load(id);
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:4,代碼來源:UserService.java

示例12: update

import com.entity.User; //導入依賴的package包/類
public void update(User user) {
    super.update(user);
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:4,代碼來源:UserService.java

示例13: listAll

import com.entity.User; //導入依賴的package包/類
public List<User> listAll() {
    return super.listAll("User");
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:4,代碼來源:UserService.java

示例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;
}
 
開發者ID:nizhaorong,項目名稱:S4S4H4,代碼行數:6,代碼來源:UserService.java

示例15: UserSpinnerAdapter

import com.entity.User; //導入依賴的package包/類
public UserSpinnerAdapter(Activity activity, User[] users) {
	super(activity, R.layout.adapter_user);

	updateItems(users);

}
 
開發者ID:SimoneLocatelli,項目名稱:androidbase,代碼行數:7,代碼來源:UserSpinnerAdapter.java


注:本文中的com.entity.User類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。