系统运用了JSP,Javabean,数据库等,能够实现:
(1)由于一项新的软件在被使用之前,对于使用者来说是陌生和崭新的,所以要求系统具有良好的人机界面。
(2)能够实现新闻发布的各项功能,能成功的对用户各种信息进行管理。
(3)查询、修改、删除、添加数据方便,数据的稳定性和可靠性好。
系统角色:1.游客:可以搜索、浏览新闻,不能评论新闻,可以注册成为会员
2.会员:可以搜索、浏览新闻,评论新闻,可以修改密码等个人信息
3.编辑:对新闻进行编辑、发布,可以添加删除修改新闻
4.管理员:拥有系统最高权限,可以添加删除修改新闻,可以删除用户,可以添加删除编辑
前台:
首页:
1.新闻分类:(国际 娱乐 体育 等)新闻分类需要从数据库中动态取出(因为后台中有添加删除修改分类的功能),
可以只显示4—5个分类,后面加个“更多>>”链接,来罗列所有分类
2.新闻搜索:(可以选择分类)以新闻标题模糊搜索,有分页功能
3.热点新闻:按新闻点击率高低显示前10条左右的新闻(显示点击率)
4.最新新闻:显示最新添加的新闻(显示日期)
5.公告栏:显示公告信息
6.登录:可选角色有 会员、编辑、管理员,有注册链接按钮,找回密码链接
会员可以对新闻进行评论,游客点击评论时提示注册
注册时包含密码提示问题,以便找回密码,注册验证用ajax动态验证,有分页功能,
包含在线文本编辑器
登陆后有欢迎信息:“您好,XXX”
后台:
新闻分类管理
分类列表(包含删除、修改)
添加分类
新闻管理
新闻列表(包含删除、修改新闻)
添加新闻(支持新闻、图片上传)
查找新闻 (包含删除、修改新闻)
评论管理
公告修改
会员管理
会员列表(包含删除)
查找会员(包含删除)
编辑管理
编辑列表(包含删除、修改)
查找编辑(包含删除、修改)
修改密码
会员:修改密码等个人信息
代码如下:
package com.action;
/**
- 管理员登陆 增加 修改 删除 删除登陆日志
*/
import java.io.IOException;
import java.util.List;
import java.util.StringTokenizer;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.bean.AdminBean;
import com.bean.SystemBean;
import com.util.Constant;
import com.util.MD5;
public class AdminServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public AdminServlet() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(Constant.CONTENTTYPE);
request.setCharacterEncoding(Constant.CHARACTERENCODING);
try{
String method=request.getParameter("method").trim();
AdminBean loginbean = new AdminBean();
HttpSession session = request.getSession();
session.setMaxInactiveInterval(1200);
SystemBean systembean = new SystemBean();
String sysdir = systembean.getDir();
if(method.equals("one")){//admin登录
String username = request.getParameter("username");
String password = request.getParameter("password");
if(username == null||username.trim().equals("")){
request.setAttribute("message", "请正确输入用户名!");
request.getRequestDispatcher(sysdir+"/login.jsp").forward(request, response);
}
else if(password == null||password.trim().equals("")){
request.setAttribute("message", "请输入密码!");
request.getRequestDispatcher(sysdir+"/login.jsp").forward(request, response);
}
else{
String md5password = MD5.MD5(password);
String agent = request.getHeader("user-agent");
StringTokenizer st = new StringTokenizer(agent,";");
String useros=st.nextToken();
String loginip = request.getRemoteAddr();
int flag = loginbean.adminLogin(username,md5password, password,useros,loginip);
switch (flag){
case Constant.SUCCESS:
List list = loginbean.getAdminInfo(username);
session.setA