package com.house.action;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.house.entity.District;
import com.house.entity.House;
import com.house.entity.Street;
import com.house.entity.Type;
import com.house.entity.User;
import com.house.service.DistrictService;
import com.house.service.HouseService;
import com.house.service.StreetService;
import com.house.service.TypeService;
import com.house.service.UserService;
import com.house.service.impl.DistrictServiceImpl;
import com.house.service.impl.HouseServiceImpl;
import com.house.service.impl.StreetServiceImpl;
import com.house.service.impl.TypeServiceImpl;
import com.house.service.impl.UserServiceImpl;
import com.house.util.Change_date;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class HouseAction extends ActionSupport {
private Street street;
private District district ;
private Type type;
private String currentPage;
private List list;
private int maxPage;
private String msg;
private House house;
private int where;
private List slist;
private List tlist;
private List dlist;
private User user;
private String housedate;
ActionContext ac=ActionContext.getContext();
Map session = ac.getSession();
public String showlist(){
String current=(this.getCurrentPage()==null) ? "1" :this.getCurrentPage();
int curpage= Integer.parseInt(current);
this.setCurrentPage(current);
HouseService ss=new HouseServiceImpl();
list =(List) ss.QueryAllHouse(curpage);
maxPage=ss.selectmaxPage();
where=1;
if(list==null){
if(this.getMsg().equals("")||this.getMsg()==null||this.getMsg()==""){
this.setMsg("获取列表失败!");
}
}
return "suc";
}
public String showlistbyuser(){
User u=(User) session.get("use");
System.out.println("1");
String current=(this.getCurrentPage()==null) ? "1" :this.getCurrentPage();
int curpage= Integer.parseInt(current);
this.setCurrentPage(current);
System.out.println("2");
HouseService ss=new HouseServiceImpl();
list =(List) ss.QueryHouseByUserId(u.getId(),curpage);
System.out.println("3");
maxPage=ss.selectmaxPagebyid(u.getId());
where=2;
System.out.println("4");
if(list==null){
System.out.println("5");
if(this.getMsg().equals("")||this.getMsg()==null||this.getMsg()==""){
this.setMsg("获取列表失败!");
}
}
System.out.println("6");
return "suc";
}
public String toupdate(){
DistrictService ds=new DistrictServiceImpl();
setDlist(ds.QueryAllAllDistrict());
TypeService ts=new TypeServiceImpl();
setTlist(ts.QueryAllAllType());
StreetService ss=new StreetServiceImpl();
setSlist(ss.QueryAllAllStreet());
HouseService hs=new HouseServiceImpl();
house=hs.QueryHousebyId(house.getId());
if(house.getTitle()==null||house.getTitle()==""||house.getTitle().equals("")){
this.setMsg("获取信息失败!");
}
return SUCCESS;
}
public String update(){
int a=0;
Date houseday=null;
try {
houseday = Change_date.todate(housedate);
} catch (ParseException e) {
e.printStackTrace();
}
TypeService ts=new TypeServiceImpl();
type= ts.QueryTypebyId(type.getId());
StreetService ss=new StreetServiceImpl();
street=ss.QueryStreetbyId(street.getId());
UserService us=new UserServiceImpl();
user=us.QueryUserbyId(user.getId());
house.setHouse_date(houseday);
house.setStreet(street);
house.setType(type);
house.setUser(user);
HouseService hs=new HouseServiceImpl();
a = hs.UpdateHouse(house);
if(a==2){
this.setMsg("");
}
else{
this.setMsg("修改失败!");
}
return "success";
}
public String delete(){
int a=0;
HouseService ts=new HouseServiceImpl();
a=ts.DeleteHousebyId(house.getId());
if(a!=2){
this.setMsg("删除失败");
}
return "success";
}
public String toadd(){
DistrictService ds=new DistrictServiceImpl();
setDlist(ds.QueryAllAllDistrict());
TypeService ts=new TypeServiceImpl();
setTlist(ts.QueryAllAllType());
StreetService ss=new StreetServiceImpl();
setSlist(ss.QueryAllAllStreet());
return SUCCESS;
}
public String add(){
int a=0;
Date housedate=new Date();
TypeService ts=new TypeServiceImpl();
type= ts.QueryTypebyId(type.getId());
StreetService ss=new StreetServiceImpl();
street=ss.QueryStreetbyId(street.getId());
UserService us=new UserServiceImpl();
User u=(User) session.get("use");
house.setType(type);
house.setUser(u);
house.setHouse_date(housedate);
house.setStreet(street);
HouseService hs=new HouseServiceImpl();
a = hs.AddHouse(house);
if(a==2){
return "bytitle";
}else{
this.setMsg("发布房源失败!");
return "all";
}
}
public String bytitle(){
String current=(this.getCurrentPage()==null) ? "1" :this.getCurrentPage();
int curpage= Integer.parseInt(current);
this.setCurrentPage(current);
maxPage=1;
HouseService ds=new HouseServiceImpl();
list=ds.QueryHouseByTitle(house.getTitle(),curpage);
if(list==null){
this.setMsg("出错啦!");
}else{
this.setMsg("");
}
return "success";
}
public Street getStreet() {
return street;
}
public void setStreet(Street street) {
this.street = street;
}
public District getDistrict() {
return district;
}
public void setDistrict(District district) {
this.district = district;
}
public String getCurrentPage() {
return currentPage;
}
public void setCurrentPage(String currentPage) {
this.currentPage = currentPage;
}
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public int getMaxPage() {
return maxPage;
}
public void setMaxPage(int maxPage) {
this.maxPage = maxPage;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public House getHouse() {
return house;
}
public void setHouse(House house) {
this.house = house;
}
public void setWhere(int where) {
this.where = where;
}
public int getWhere() {
return where;
}
public void setSlist(List slist) {
this.slist = slist;
}
public List getSlist() {
return slist;
}
public void setTlist(List tlist) {
this.tlist = tlist;
}
public List getTlist() {
return tlist;
}
public void setDlist(List dlist) {
this.dlist = dlist;
}
public List getDlist() {
return dlist;
}
public void setType(Type type) {
this.type = type;
}
public Type getType() {
return type;
}
public void setUser(User user) {
this.user = user;
}
public User getUser() {
return user;
}
public String getHousedate() {
return housedate;
}
public void setHousedate(String housedate) {
this.housedate = housedate;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
租房系统 源代码 java jsp servlet技术 struts2技术 (237个子文件)
HouseAction.class 8KB
HouseDaoImpl.class 7KB
HouseListAction.class 7KB
UserAction.class 5KB
StreetDaoImpl.class 5KB
StreetAction.class 4KB
UserDaoImpl.class 4KB
DistrictAction.class 4KB
TypeAction.class 4KB
DistrictDaoImpl.class 4KB
TypeDaoImpl.class 4KB
House.class 3KB
HouseServiceImpl.class 2KB
PublicAction.class 2KB
User.class 2KB
UserServiceImpl.class 2KB
StreetServiceImpl.class 2KB
Search.class 2KB
EncodingFilter.class 2KB
Date_convertor.class 2KB
DistrictServiceImpl.class 1KB
TypeServiceImpl.class 1KB
UserDaoImpl$1.class 1KB
Islog.class 1KB
Street.class 1KB
HibernateUtil.class 1KB
District.class 1023B
Type.class 1005B
HouseService.class 760B
HouseDao.class 748B
Change_date.class 724B
StreetService.class 518B
StreetDao.class 506B
DistrictService.class 478B
UserDao.class 472B
DistrictDao.class 466B
UserService.class 455B
TypeService.class 434B
TypeDao.class 422B
Constants.class 330B
.classpath 4KB
.classpath 2KB
.classpath 2KB
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 7KB
thumb_house.gif 7KB
logo.gif 4KB
btn_bg.gif 968B
selector_arrow.gif 79B
spring.jar 2.81MB
hibernate3.jar 2.31MB
struts2-dojo-plugin-2.2.1.jar 1.65MB
ojdbc14.jar 1.47MB
jbosscache-core-3.1.0.GA.jar 1.1MB
xwork-core-2.2.1.jar 997KB
freemarker-2.3.16.jar 860KB
struts2-core-2.2.1.jar 755KB
javaee.jar 720KB
jboss-cache-1.4.1.GA.jar 690KB
c3p0-0.9.1.jar 594KB
javassist-3.9.0.GA.jar 583KB
commons-collections.jar 558KB
commons-collections-3.1.jar 546KB
standard.jar 504KB
proxool-0.8.3.jar 465KB
antlr-2.7.6.jar 433KB
jstl.jar 407KB
log4j-1.2.15.jar 383KB
hibernate-cglib-repack-2.1_3.jar 377KB
dom4j-1.6.1.jar 307KB
commons-httpclient.jar 298KB
cglib-2.2.jar 272KB
commons-lang-2.3.jar 240KB
commons-lang.jar 237KB
ognl-3.0.jar 224KB
ehcache-1.2.3.jar 203KB
commons-beanutils.jar 184KB
commons-digester.jar 164KB
commons-dbcp.jar 119KB
hibernate-entitymanager.jar 116KB
oscache-2.1.jar 112KB
commons-io-1.3.2.jar 86KB
commons-validator.jar 82KB
commons-io.jar 82KB
commons-discovery.jar 70KB
commons-pool.jar 61KB
commons-logging.jar 59KB
commons-fileupload-1.2.1.jar 56KB
commons-fileupload.jar 52KB
commons-codec.jar 46KB
commons-attributes-api.jar 36KB
swarmcache-1.0RC2.jar 30KB
slf4j-api-1.5.8.jar 23KB
struts2-spring-plugin-2.2.1.jar 21KB
jboss-archive-browsing.jar 15KB
jta-1.1.jar 13KB
slf4j-log4j12-1.5.8.jar 9KB
HouseAction.java 7KB
共 237 条
- 1
- 2
- 3
快乐大笨宁
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页