资源简介

100%可运行,注解详细,适合新手入门学习。解压后,将hq_ssh文件夹导入MyEclipse,阅读“如何运行.doc”。

资源截图

代码片段和文件信息

package com.hq.action;

import java.util.List;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

import com.hq.entity.Student;
import com.hq.entity.User;
import com.hq.service.AllService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AllAction extends ActionSupport {
private User user;
private Student student;
private AllService allService;
ActionContext context = ActionContext.getContext();
/*
 * getter和setter方法
 */
public Student getStudent() {
return student;
}

public void setStudent(Student student) {
this.student = student;
}

public User getUser() {
return user;
}

public void setUser(User user) {
this.user = user;
}

public AllService getAllService() {
return allService;
}

public void setAllService(AllService allService) {
this.allService = allService;
}

/*
 * 注册
 */
public String register() {
allService.register(user);
return “success“;
}

/*
 * 登录
 */
public String login() {
int i = allService.login(user);
if (i != 0) {
return “success“;
} else {
return “fail“;
}
}

/*
 * 查询
 */
public String query() {
HttpServletRequest request = (HttpServletRequest) context
.get(ServletActionContext.HTTP_REQUEST);
String queryString = request.getParameter(“queryString“);
String flagfordegree = request.getParameter(“flagfordegree“);
if(““.equals(flagfordegree) || flagfordegree == null){
if (““.equals(queryString) || queryString == null) {//查询全部
List list = allService.queryAll();
request.setAttribute(“querydata“ list);
request.setAttribute(“resultflag“ 1);
return “queryall“;
} else {
List list = allService.query(queryString);//按字段查询
request.setAttribute(“querydata“ list);
request.setAttribute(“resultflag“ 1);
return “success“;
}
}else{
if(!““.equals(queryString) && queryString != null){
List list =allService.queryDegree(queryString);//成绩查询
request.setAttribute(“querydegree“ list);
request.setAttribute(“flagfordegree“ flagfordegree);
return “success“;
}
return “success“;
}


}

/*
 * 修改
 */
public String updatedata() {
allService.updatedata(student);
return “success“;
}

/*
 * 删除
 */
public String deletedata() {
allService.deletedata(student);
return “success“;
}

/*
 * 增加
 */
public String adddata() {
allService.adddata(student);
return “success“;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-08-09 10:15  hq_ssh\
     文件        4197  2014-08-07 11:03  hq_ssh\.classpath
     目录           0  2014-08-09 10:21  hq_ssh\.myeclipse\
     文件         562  2014-08-07 09:55  hq_ssh\.myhibernatedata
     文件         291  2014-08-06 17:03  hq_ssh\.mymetadata
     文件        1614  2014-08-07 10:40  hq_ssh\.project
     目录           0  2014-08-09 10:15  hq_ssh\.settings\
     文件         500  2014-08-06 17:03  hq_ssh\.settings\.jsdtscope
     文件         109  2014-08-06 17:03  hq_ssh\.settings\com.genuitec.eclipse.ws.prefs
     文件         330  2014-08-06 17:03  hq_ssh\.settings\org.eclipse.jdt.core.prefs
     文件          49  2014-08-06 17:03  hq_ssh\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2014-08-06 17:03  hq_ssh\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\meta-INF\
     文件          36  2014-08-06 17:03  hq_ssh\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\My97DatePicker\
     文件       10235  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\WdatePicker.js
     文件       22544  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\calendar.js
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\My97DatePicker\lang\
     文件         644  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\lang\en.js
     文件        1089  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\lang\zh-cn.js
     文件        1088  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\lang\zh-tw.js
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\My97DatePicker\skin\
     文件         192  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\skin\WdatePicker.css
     文件        1043  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\skin\datePicker.gif
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\My97DatePicker\skin\default\
     文件        3726  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\skin\default\datepicker.css
     文件        1578  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\skin\default\img.gif
     目录           0  2014-08-09 10:15  hq_ssh\WebRoot\My97DatePicker\skin\whyGreen\
     文件         307  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\skin\whyGreen\bg.jpg
     文件        3933  2014-08-01 16:35  hq_ssh\WebRoot\My97DatePicker\skin\whyGreen\datepicker.css
............此处省略106个文件信息

评论

共有 条评论