关键词不能为空

当前您在: 主页 > 英语 >

SSI框架的一个简单小项目

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-24 15:47
tags:

-

2021年2月24日发(作者:oaa)


SSI(Struts2+Spring+Ibatis)


的简单小项目



1




新建


web


项目



2




加入


jar











< br>





< /p>





< p>








、< /p>





3




写实体


bean



package



import izable;


import



public class Student extends Page {


private int id


private String username;


private String password;


private String phone;


private String email;


private String address


private Page page;


public void setPage(Page page) {



= page;


}


public int getId() {



return id;


}


public void setId(int id) {



= id;


}


public String getUsername() {



return username;


}


public void setUsername(String username) {



me = username;


}


public String getPassword() {



return password;


}


public void setPassword(String password) {



rd = password;


}


public String getPhone() {



return phone;


}


public void setPhone(String phone) {



= phone;


}


public String getEmail() {



return email;


}


public void setEmail(String email) {



= email;


}


public String getAddress() {



return address;


}


public void setAddress(String address) {



s = address;


}



}



package



import izable;



public class Users implements Serializable {


private String username ;


private String password


public String getUsername() {



return username;


}


public void setUsername(String username) {



me = username;


}


public String getPassword() {



return password;


}


public void setPassword(String password) {



rd = password;


}



}





package



import izable;


import



public class Page{










private int pagesize;//


单页记录











private int currentpage = 1;//


当前页面











private int countdate;//


总记录数











private int lastPage;//


上一页











private int nextPage;//


下一页











private int countPage;










public int getCurrentpage()











{


















return currentpage;










}










public void setCurrentpage(int currentpage)











{



































if(currentpage>getCountpage())


















{


























tpage = getCountpage();


















}else {


























if(currentpage < 1)


























{


































tpage = 1;


























}


























else


























{


































tpage = currentpage;


























}


















}










}










public int getPagesize() {


















return pagesize;










}










public void setPagesize(int pagesize) {


















ze = pagesize;










}










public int getCountdate()











{


















return countdate;










}










public void setCountdate(int countdate)











{


















ate = countdate;










}










//


由记录数设定有关的页面数。











public int getCountpage()











{


















int i = ate / ze;


















if((ate % ze)!=0)


















{


























i+=1;


















}


















return i;










}










public int getLastPage()










{


















return rentpage()-1;










}










public int getNextPage()










{


























return rentpage()+1;










}










//



ibatis


用数据











public int getCurrent()











{


















return (tpage-1)*pagesize;










}










public int getNext() {


















return tpage*pagesize;










}










public int getCountPage() {


















return countPage;










}










public void setCountPage(int countPage) {


















age = countPage;










}










public void setLastPage(int lastPage) {


















ge = lastPage;










}










public void setNextPage(int nextPage) {


















ge = nextPage;










}



}


4



< /p>


编写


dao


及其实现类

< br>



package


import


import t;



public interface StudentDao {



public boolean saveStu(Student student);



public boolean delStu(int id);



public boolean updateStu(Student student);



public List queryAll();



public Student queryById(int id);



public List dimStu(Student student);



public int getCountSize(Object obj);



}





package



import eption;


import



import tedList;


import Client;


import tDao;


import t;



public class StudentDaoImpl implements StudentDao {




private SqlMapClient sqlMapClient;





public void setSqlMapClient(SqlMapClient sqlMapClient) {




Client = sqlMapClient;



}





public boolean delStu(int id) {




try {





int i = (





if(i>0){






return true;





}else{






return false;





}




} catch (SQLException e) {





tackTrace();





return false;




}



}




public List queryAll() {




List list = null;










Student st = new Student();




try {





list = orList(




} catch (SQLException e) {





// TODO Auto-generated catch block





tackTrace();




}




return list;



}




public Student queryById(int id) {




Student student = null;




try {





student = (Student) orObject(




} catch (SQLException e) {





tackTrace();




}




return student;



}




public boolean saveStu(Student student) {




boolean b;




try {





(





b = true;




} catch (SQLException e) {





tackTrace();





b = false;




}




return b



}




public boolean updateStu(Student student) {




boolean b




try {





(





b = true;




} catch (Exception e) {





b = false;




}




return b;



}




public List dimStu(Student student) {




List list = null;




try {





list = orList(




} catch (SQLException e) {





tackTrace();




}




return list;



}




public int getCountSize(Object obj) {




int i = 0




try {





i = (Integer)orObject(




} catch (SQLException e) {





// TODO Auto- generated catch block





tackTrace();




}




return i



}



}



package



import ;



public interface UserDao {



public boolean isLogin(Users user);


}



package



import eption;


import



import Client;


import o;


import



public class UserDaoImpl implements UserDao {




private SqlMapClient sqlMapClient;





public void setSqlMapClient(SqlMapClient sqlMapClient) {




Client = sqlMapClient;



}




public boolean isLogin(Users user) {




try {





List list = orList(






if(()>0)












{



















return true;












}




} catch (SQLException e) {





tackTrace();




}




return false;



}



}


5




编写服务层及其实现




package t. servcie;


import


import t;



public interface StudentDao {



public boolean saveStu(Student student);



public boolean delStu(int id);



public boolean updateStu(Student student);



public List queryAll();



public Student queryById(int id);



public List dimStu(Student student);



public int getCountSize(Object obj);



}




package



import ;



import tDao;


import t;


import tService;



public class StudentServiceImpl implements StudentService {



private StudentDao sdao;



public void setSdao(StudentDao sdao) {



= sdao;


}



public boolean delStu(int id) {



boolean b = (id);



if(b){




return true;



}else{




return false;



}


}



public List queryAll() {



List list = ll();



return list;


}



public Student queryById(int id) {



Student student = yId(id);



return student;


}



public boolean saveStu(Student student) {



boolean b = u(student);



if(b){




return true;



}else{




return false;



}


}



public boolean updateStu(Student student) {



boolean b = Stu(student);



if(b){




return true;



}else{




return false;



}


}



public List dimStu(Student student) {



List list = (student);



return list;


}



public int getCountSize(Object obj) {



return ntSize(obj);


}



}



package e;



import



public interface UserService {


public boolean isLogin(Users user);


}



package



import o;


import


import rvice;



public class UserServiceImpl implements UserService {



private UserDao udao;



public void setUdao(UserDao udao) {



= udao;


}



public boolean isLogin(Users user) {



boolean b = n(user);



if(b){




return true;



}else{




return false;



}


}



}


6




编写< /p>


Action





package



import Context;


import Support;


import


import tService;


import rvice;



public class UserAction extends ActionSupport {



private UserService us;


private Users user;



public Users getUser() {



return user;


}



public void setUser(Users user) {



= user;


}



public UserService getUs() {



return us;


}



public void setUs(UserService us) {



= us;


}



public String Login() throws Exception {



String username = rname();



String password = sword();



boolean b = n(user);



if(b){




return



}else{




if((











text().put(


请输入用户名和密码!











}else if((











text().put(


请输入用户名


!










}else if((











text().put(


请输入密码!











}else{











text().put(


请检查用 户名和密码!











}




return



}






}



}



package



import



import rvletRequest;



import tActionContext;



import Context;


import Support;


import


import t;


import tService;



public class StudentAction extends ActionSupport {



private StudentService ss;


private int id;


private String username;


private String password;


private String phone;


private String email;


private String address;


private Student student;


private List list


private Page page ;


private final static int pagesize = 3;







private int countdate;//


总记录





public int getCountdate() {



return countdate;


}



public void setCountdate(int countdate) {



ate = countdate;


}



public static int getPagesize() {



return pagesize;


}



public Page getPage() {



return page;


}



public void setPage(Page page) {



= page;


}



public List getList() {



return list;


}



public void setList(List list) {



= list;


}



public Student getStudent() {



return student;


}



public void setStudent(Student student) {



t = student;


}



public int getId() {



return id;


}



public void setId(int id) {



= id;


}



public HttpServletRequest getRequest() {



return request;


}



public void setRequest(HttpServletRequest request) {



t = request;


}



public StudentService getSs() {



return ss;


}



public void setSs(StudentService ss) {



= ss;


}



public String getUsername() {



return username;


}



public void setUsername(String username) {



me = username;


}



public String getPassword() {



return password;


}



public void setPassword(String password) {



rd = password;


}



public String getPhone() {



return phone;


}



public void setPhone(String phone) {



= phone;


}



public String getEmail() {



return email;


}



public void setEmail(String email) {



= email;


}



public String getAddress() {



return address;


}



public void setAddress(String address) {



s = address;


}



HttpServletRequest request = uest();



public String queryAll() throws Exception {



List list = ll();



if(()==0){




text().put(


没有可以显示的数据!




}else{




text().put(



}



return


}



public String updateStu() throws Exception {



String username = rname();



String password = sword();



String phone = ne();



String email = il();



String address = ress();



rname(username);



sword(password);



ne(phone);



il(email);



ress(address);



boolean b = Stu(student);



if (b) {



< p>
text().put(


更新成功!





return ();



} else {




text().put(


更新失败!





return



}


}



public String queryById() throws Exception {



int id = ();



Student stu = yId(id);



text().put(



return


}



public String delete() throws Exception {



int id = ();



boolean b = (id);



if (b) {




text().put(


删除成功!





return ();



} else {




text(). put(


删除失败!





return



}


}



public String saveStu() throws Exception {



int id = ();



String username = rname();



String password = sword();



String phone = ne();



String email = il();



String address = ress();



(id);



rname(username);



sword(password);



ne(phone);



il(email);



ress(address);



boolean b = u(student);



if (b) {



< p>
text().put(


增加成功!





return ();



}



return


}



public String dimStu() throws Exception {



countdate = ntSize(new Student());



Student stu = new Student();



esize(3);



ntdate(countdate);



list = (student);



int id = 0;



(id);



text().put(



return


}


}


7




配置文件





xml


version


=



encoding


=



?>






<


beans


xmlns


=





xmlns:xsi


=




xmlns:aop


=





xmlns:tx


=< /p>





xsi:schemaLocation


=


< br>





/schema/beans


/schema/beans/spring- beans-







/schema/aop


/schema/aop/spring- aop-2.5.


xsd






/schema/tx


/schema/tx/


d


>

< br>







<


bean


id


=



class

< p>
=



ataSource


>


-


-


-


-


-


-


-


-



本文更新与2021-02-24 15:47,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/670473.html

SSI框架的一个简单小项目的相关文章

  • 余华爱情经典语录,余华爱情句子

    余华的经典语录——余华《第七天》40、我不怕死,一点都不怕,只怕再也不能看见你——余华《第七天》4可是我再也没遇到一个像福贵这样令我难忘的人了,对自己的经历如此清楚,

    语文
  • 心情低落的图片压抑,心情低落的图片发朋友圈

    心情压抑的图片(心太累没人理解的说说带图片)1、有时候很想找个人倾诉一下,却又不知从何说起,最终是什么也不说,只想快点睡过去,告诉自己,明天就好了。有时候,突然会觉得

    语文
  • 经典古训100句图片大全,古训名言警句

    古代经典励志名言100句译:好的药物味苦但对治病有利;忠言劝诫的话听起来不顺耳却对人的行为有利。3良言一句三冬暖,恶语伤人六月寒。喷泉的高度不会超过它的源头;一个人的事

    语文
  • 关于青春奋斗的名人名言鲁迅,关于青年奋斗的名言鲁迅

    鲁迅名言名句大全励志1、世上本没有路,走的人多了自然便成了路。下面是我整理的鲁迅先生的名言名句大全,希望对你有所帮助!当生存时,还是将遭践踏,将遭删刈,直至于死亡而

    语文
  • 三国群英单机版手游礼包码,三国群英手机单机版攻略

    三国群英传7五神兽洞有什么用那是多一个武将技能。青龙飞升召唤出东方的守护兽,神兽之一的青龙。玄武怒流召唤出北方的守护兽,神兽之一的玄武。白虎傲啸召唤出西方的守护兽,

    语文
  • 不收费的情感挽回专家电话,情感挽回免费咨询

    免费的情感挽回机构(揭秘情感挽回机构骗局)1、牛牛(化名)向上海市公安局金山分局报案,称自己为了挽回与女友的感情,被一家名为“实花教育咨询”的情感咨询机构诈骗4万余元。

    语文