资源简介

利用SSM+mysql实现的网上商城,该系统简单易懂,包含网站管理的前后台操作页面

资源截图

代码片段和文件信息

package com.daowen.action;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;



import com.daowen.bll.SystemParam;
import com.daowen.dal.DALbase;
import com.daowen.entity.*;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AdminLogin extends ActionSupport {

public String execute() {

HttpServletResponse response = (HttpServletResponse)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE);
HttpServletRequest request = (HttpServletRequest)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
String actiontype = request.getParameter(“actiontype“);
System.out.println(“actiontype=“ + actiontype);

// 登录
if (actiontype.equals(“login“)) {
login(request response);
}

return null;
}

private void login(HttpServletRequest request HttpServletResponse response) {

String usertype = request.getParameter(“usertype“);

String validcode = (String) request.getSession().getAttribute(
“validcode“);

String inputvalidcode = request.getParameter(“validcode“);

if (validcode != null && !validcode.equals(inputvalidcode)) {

System.out.println(“系统验证错误“);
request.setAttribute(“errmsg“
系统验证码错误“);

// 分发请求参数
dispatchParams(request response);
try {
request.getRequestDispatcher(“/admin/login.jsp“).forward(
request response);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return;

}

System.out.println(“验证码=“ + validcode);

if (usertype != null && usertype.equals(“0“)) {
adminLogin(request response);

}




}

private void adminLogin(HttpServletRequest request
HttpServletResponse response) {

String username = request.getParameter(“username“);
String password = request.getParameter(“password“);
String usertype = request.getParameter(“usertype“);

String action = request.getParameter(“action“);

Users u = (Users) DALbase.load(“users“ “ where username=‘“ + username
+ “‘ and password=‘“ + password + “‘“);

if (u != null) {

HttpSession session = request.getSession();
u.setLogtimes(u.getLogtimes() + 1);
DALbase.update(u);
session.setAttribute(“users“ u);

try {
response.sendRedirect(SystemParam.getSiteRoot()
+ “/admin/index.jsp“);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} else {

// 分发
dispatchParams(request response);
request.setAttribute(“errmsg“
用户与密码不匹配“);


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-14 15:45  biyesheji\
     目录           0  2018-04-25 15:38  biyesheji\代码\
     目录           0  2018-04-25 15:38  biyesheji\代码\computer\
     文件        3945  2016-04-03 10:29  biyesheji\代码\computer\.classpath
     目录           0  2018-04-25 15:38  biyesheji\代码\computer\.externalToolBuilders\
     文件         548  2013-04-17 09:43  biyesheji\代码\computer\.externalToolBuilders\org.eclipse.wst.jsdt.core.javascriptValidator (7).launch
     文件         547  2013-04-17 09:43  biyesheji\代码\computer\.externalToolBuilders\org.eclipse.wst.validation.validationbuilder (3).launch
     目录           0  2018-05-15 11:50  biyesheji\代码\computer\.myeclipse\
     文件         297  2018-04-22 21:07  biyesheji\代码\computer\.mymetadata
     文件        2353  2018-04-22 21:07  biyesheji\代码\computer\.project
     目录           0  2018-04-25 15:38  biyesheji\代码\computer\.settings\
     文件         500  2013-04-16 09:37  biyesheji\代码\computer\.settings\.jsdtscope
     文件         139  2013-01-09 23:00  biyesheji\代码\computer\.settings\com.genuitec.eclipse.core.prefs
     文件        1009  2016-04-03 10:29  biyesheji\代码\computer\.settings\com.genuitec.eclipse.j2eedt.core.prefs
     文件         247  2016-04-03 10:21  biyesheji\代码\computer\.settings\com.genuitec.eclipse.migration.prefs
     文件         356  2018-03-16 17:30  biyesheji\代码\computer\.settings\org.eclipse.core.resources.prefs
     文件         629  2013-01-02 21:15  biyesheji\代码\computer\.settings\org.eclipse.jdt.core.prefs
     文件         550  2018-04-22 21:07  biyesheji\代码\computer\.settings\org.eclipse.wst.common.component
     文件         359  2016-04-03 10:21  biyesheji\代码\computer\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2013-04-16 09:37  biyesheji\代码\computer\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2013-04-16 09:37  biyesheji\代码\computer\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件        1935  2013-01-09 23:00  biyesheji\代码\computer\.settings\org.eclipse.wst.validation.prefs
     目录           0  2018-04-25 15:38  biyesheji\代码\computer\WebRoot\
     目录           0  2018-04-25 15:38  biyesheji\代码\computer\WebRoot\meta-INF\
     文件          39  2013-01-02 21:12  biyesheji\代码\computer\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2018-04-25 15:38  biyesheji\代码\computer\WebRoot\WEB-INF\
     目录           0  2018-05-15 09:32  biyesheji\代码\computer\WebRoot\WEB-INF\classes\
     目录           0  2018-05-03 16:42  biyesheji\代码\computer\WebRoot\WEB-INF\classes\meta-INF\
     文件          25  2016-04-03 10:21  biyesheji\代码\computer\WebRoot\WEB-INF\classes\meta-INF\MANIFEST.MF
     文件        3270  2018-05-15 09:32  biyesheji\代码\computer\WebRoot\WEB-INF\classes\applicationContext.xml
     目录           0  2018-05-03 16:42  biyesheji\代码\computer\WebRoot\WEB-INF\classes\com\
............此处省略1496个文件信息

评论

共有 条评论