资源简介

基于Idea的struts2.3.16+spring4.3.14+hibernate4.3.8的SSH整合代码

资源截图

代码片段和文件信息

package edu.abc.sshdemo.action;

import com.opensymphony.xwork2.ActionSupport;
import edu.abc.sshdemo.model.bean.Person;
import edu.abc.sshdemo.service.PersonService;
import org.apache.struts2.ServletActionContext;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

public class PersonAction extends ActionSupport {

    private PersonService personService;
    private Person person;

    public PersonService getPersonService() {
        return personService;
    }

    public void setPersonService(PersonService personService) {
        this.personService = personService;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public String add(){
        System.out.println(person.getName()+“\t“+person.getAge()+“\t“+person.getMajor());

        if(personService.add(person)){
            return “success“;
        }else{
            return “fail“;
        }
    }
    public String delete(){
        if(personService.delete(person)){
            return “success“;
        }else{
            return “fail“;
        }
    }
    public String update(){
        if(personService.update(person)){
            return “success“;
        }else{
            return “fail“;
        }
    }
    public String listAll(){
        ArrayList person=personService.listAll();
        if(person!=null){
            System.out.println(person);
            ServletActionContext.getRequest().getSession().setAttribute(“person“person);
            return “success“;
        }else{
            return “fail“;
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-07-28 16:12  .idea\
     目录           0  2018-07-28 08:13  .idea\artifacts\
     文件        4691  2018-07-28 08:13  .idea\artifacts\SSHDemo_war_exploded.xml
     文件         626  2018-07-27 17:33  .idea\compiler.xml
     文件         832  2018-07-27 17:48  .idea\dataSources.local.xml
     文件         905  2018-07-27 17:46  .idea\dataSources.xml
     目录           0  2018-07-27 17:46  .idea\dataSources\
     文件        5431  2018-07-27 17:46  .idea\dataSources\a398c6e4-f062-495e-bc71-d64c74225a2a.xml
     目录           0  2018-07-27 17:27  .idea\inspectionProfiles\
     目录           0  2018-07-28 09:43  .idea\libraries\
     文件         462  2018-07-27 17:33  .idea\libraries\Maven__antlr_antlr_2_7_7.xml
     文件         426  2018-07-27 21:39  .idea\libraries\Maven__asm_asm_3_3.xml
     文件         482  2018-07-27 21:39  .idea\libraries\Maven__asm_asm_commons_3_3.xml
     文件         461  2018-07-27 21:39  .idea\libraries\Maven__asm_asm_tree_3_3.xml
     文件         605  2018-07-27 21:39  .idea\libraries\Maven__commons_fileupload_commons_fileupload_1_3_1.xml
     文件         503  2018-07-27 21:39  .idea\libraries\Maven__commons_io_commons_io_2_2.xml
     文件         558  2018-07-27 17:33  .idea\libraries\Maven__commons_logging_commons_logging_1_2.xml
     文件         462  2018-07-27 17:33  .idea\libraries\Maven__dom4j_dom4j_1_6_1.xml
     文件         574  2018-07-27 17:33  .idea\libraries\Maven__mysql_mysql_connector_java_5_1_26.xml
     文件         451  2018-07-27 21:39  .idea\libraries\Maven__ognl_ognl_3_0_6.xml
     文件         556  2018-07-27 21:39  .idea\libraries\Maven__org_apache_commons_commons_lang3_3_1.xml
     文件         580  2018-07-27 21:39  .idea\libraries\Maven__org_apache_struts_struts2_core_2_3_16_3.xml
     文件         643  2018-07-27 22:18  .idea\libraries\Maven__org_apache_struts_struts2_spring_plugin_2_3_16_3.xml
     文件         590  2018-07-27 21:39  .idea\libraries\Maven__org_apache_struts_xwork_xwork_core_2_3_16_3.xml
     文件         540  2018-07-27 21:39  .idea\libraries\Maven__org_freemarker_freemarker_2_3_19.xml
     文件         732  2018-07-27 17:33  .idea\libraries\Maven__org_hibernate_common_hibernate_commons_annotations_4_0_5_Final.xml
     文件         599  2018-07-27 17:33  .idea\libraries\Maven__org_hibernate_hibernate_core_4_3_8_Final.xml
     文件         662  2018-07-28 08:23  .idea\libraries\Maven__org_hibernate_hibernate_entitymanager_4_3_8_Final.xml
     文件         720  2018-07-27 17:33  .idea\libraries\Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml
     文件         550  2018-07-27 17:33  .idea\libraries\Maven__org_javassist_javassist_3_18_1_GA.xml
     文件         527  2018-07-27 17:33  .idea\libraries\Maven__org_jboss_jandex_1_1_0_Final.xml
............此处省略141个文件信息

评论

共有 条评论