好文档 - 专业文书写作范文服务资料分享网站

基于MVC的美食点评网站管理系统

天下 分享 时间: 加入收藏 我要投稿 点赞

NewsService newsService = new NewsServiceImpl(); this.allNews

=

newsService.queryAllNews(this.pageSize,

this.pageNow);

for(Iterator it = allNews.iterator();it.hasNext();){

News n = it.next();

User user = new UserServiceImpl().queryUser(n.getUserID()); n.setUser(user); NewsType

newsType

=

new

NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID());

}

public String showNewsByTypeID(){ }

public String updateNews(){

NewsService newsService = new NewsServiceImpl(); News news = newsService.queryNews(this.newsID); NewsService newsService = new NewsServiceImpl();

this.allNews = newsService.queryAllNews(this.newsTypeID); return SUCCESS; }

this.totalCount = newsService.queryAllNews().size(); return SUCCESS;

n.setNewsType(newsType);

news.setTitle(this.title); news.setContent(this.content); news.setReleaseDate(this.releaseDate); news.setUserID(this.userID); news.setNewsTypeID(this.newsTypeID); newsService.updateNews(news); this.allNews

=

newsService.queryAllNews(this.pageSize,

this.pageNow);

for(Iterator it = allNews.iterator();it.hasNext();){

News n = it.next();

User user = new UserServiceImpl().queryUser(n.getUserID()); n.setUser(user); NewsType

newsType

=

new

NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID());

}

public String deleteNews(){

NewsService newsService = new NewsServiceImpl(); News news = newsService.queryNews(this.newsID); newsService.deleteNews(news); }

this.totalCount = newsService.queryAllNews().size(); return SUCCESS;

n.setNewsType(newsType);

this.allNews = newsService.queryAllNews(this.pageSize,

this.pageNow); for(Iterator it = allNews.iterator();it.hasNext();){ News n = it.next();

User user = new UserServiceImpl().queryUser(n.getUserID()); n.setUser(user);

NewsType

newsType

=

NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID()); n.setNewsType(newsType);

}

this.totalCount = newsService.queryAllNews().size(); return SUCCESS;

}

public String showAllNewsTypes(){

this.allNewsType

=

NewsTypeServiceImpl().queryAllNewsTypes(); return SUCCESS;

}

}

LoginAction.java

package com.caojun.action;

new

new

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.caojun.model.User;

import com.caojun.service.UserService;

import com.caojun.service.impl.UserServiceImpl; import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport{

private String username; private String password; public String getUsername() { }

public void setUsername(String username) { }

public String getPassword() { }

public void setPassword(String password) {

this.password = password; return password;

this.username = username; return username;

}

@Override

public String execute() throws Exception { UserService userService = new UserServiceImpl(); User user = userService.queryUser(this.getUsername()); if(user == null){ this.addActionError(\密码或用户名不正确!\

return INPUT;

}else{ String psw = user.getPassword(); if(this.getPassword().equals(psw)){

HttpSession

session

ServletActionContext.getRequest().getSession(); session.setAttribute(\ return SUCCESS;

}

}

this.addActionError(\密码或用户名不正确!\ return INPUT;

}

}

NewsTypeDAO.java package com.caojun.dao;

=

036w37fgfg0mq5e7e8io
领取福利

微信扫码领取福利

微信扫码分享