`
everlxq
  • 浏览: 108620 次
  • 性别: Icon_minigender_1
  • 来自: 青岛
社区版块
存档分类
最新评论

BaseAction

 
阅读更多
package com.web.base;

import java.io.*;
import java.util.*;

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

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.jdbc.core.JdbcTemplate;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.web.displaytag.PageList;
import com.web.event.service.EventStepService;
import com.web.event.service.EventsService;
import com.web.event.service.JcxxeventService;
import com.web.event.service.JtcyqkeventService;
import com.web.event.service.RhhjlbeventService;
import com.web.event.service.RwqjleventService;
import com.web.event.service.ShgxqkeventService;
import com.web.event.service.SjfjbService;
import com.web.event.service.SjyhxxbService;
import com.web.event.vo.EventStep;
import com.web.event.vo.Jcxxevent;
import com.web.event.vo.Jtcyqkevent;
import com.web.event.vo.Rhhjlbevent;
import com.web.event.vo.Rwqjlevent;
import com.web.event.vo.Shgxqkevent;
import com.web.event.vo.Sjfjb;
import com.web.sys.service.JcxxService;
import com.web.sys.service.JtcyqkService;
import com.web.sys.service.OpinfoService;
import com.web.sys.service.PagemenuService;
import com.web.sys.service.RhhjlbService;
import com.web.sys.service.RwqjlService;
import com.web.sys.service.ShgxqkService;
import com.web.sys.service.SysUsersService;
import com.web.sys.service.WordbookService;
import com.web.sys.vo.Jcxx;
import com.web.sys.vo.Jtcyqk;
import com.web.sys.vo.Opinfo;
import com.web.sys.vo.Pagemenu;
import com.web.sys.vo.Rhhjlb;
import com.web.sys.vo.Rwqjl;
import com.web.sys.vo.Shgxqk;
import com.web.sys.vo.SysUsers;
import com.web.sys.vo.User;
import com.web.utils.ExcelUtils;
import com.web.utils.FacesUtils;
import com.web.utils.Tools;

public abstract class BaseAction extends ActionSupport implements Action, SessionAware, ServletRequestAware {
	    public OpinfoService opinfoService;
	 
	    public JdbcTemplate jdbcTemplate;
	    
	    protected String returnPage = "list";
	    
	    private JtcyqkeventService jtcyqkeventService;
		
	    private RhhjlbeventService rhhjlbeventService;
		
	    private RwqjleventService rwqjleventService;
	 	
		private ShgxqkeventService shgxqkeventService;
		
		private JcxxeventService jcxxeventService;
		
//		private List<Jtcyqkevent> jtcyqklist;
//		private List<Rhhjlbevent> rhhjlblist;
//		private List<Rwqjlevent> rwqjllist;
//		private List<Shgxqkevent> shgxqklist;
//		private List<Jcxxevent> jcxxlist;
		
		public JtcyqkService jtcyqkService;
			
		public RhhjlbService rhhjlbService;
			
		public RwqjlService rwqjlService;
			
		public ShgxqkService shgxqkService;
			
		public JcxxService jcxxService;
			
			public List jtcyqklist;
			public List rhhjlblist;
			public List rwqjllist;
			public List shgxqklist;
			public List jcxxlist;
		
		
	 public void saveOpinfo(String message) {
		Date insertTime = new Date(System.currentTimeMillis());
		Long userid = getLoginuser().getId();
		String ip = getIpAddr(this.getRequest());
		Opinfo opinfo = new Opinfo();
		opinfo.setInsertTime(insertTime);
		opinfo.setIp(ip);
		opinfo.setMessage(message);
		opinfo.setUserid(userid);
		opinfoService.save(opinfo);
	}
	 
	public int persize;
	
    public int PAGE_SIZE = 20;
	
	public int pageNumber=1;

	

	public String getSortOrder() {
		return this.getRequest().getParameter("sort");
	}
	
	public String getSortOrderstr(String str) {
		String orderstr=str;
		if(FacesUtils.getValueInHashtableOfSession("sortstr")!=null)
			orderstr=FacesUtils.getValueInHashtableOfSession("sortstr").toString();
		if(this.getRequest().getParameter("sort")!=null&&this.getRequest().getParameter("dir")!=null&&this.getRequest().getParameter("page")==null){
		   String sortdir="asc";
		   Object obj=FacesUtils.getValueInHashtableOfSession("sortdir");
				if(obj!=null){
					if(obj.toString().equals("asc"))
						sortdir="desc";
					else sortdir="asc";
				}
				FacesUtils.setValueInHashtableOfSession("sortdir", sortdir);
				orderstr=" order by t."+this.getSortOrder()+" "+sortdir;
			}
		return orderstr;
	}
    
    public abstract BaseService getService();
    
    public abstract Object[] getSearchParam();
    
    public abstract String getSortstr();
    
    public String search() {
    	if(persize==0)
    		persize=20;
    	PAGE_SIZE=persize;
    	
		if(this.getSearch()!=null&&this.getSearch().equals("1")){
			FacesUtils.clearValueInHashtableOfSessionKey("list");
	        FacesUtils.clearValueInHashtableOfSessionKey("pageNumber");
	        FacesUtils.clearValueInHashtableOfSessionKey("hql");
	        FacesUtils.clearValueInHashtableOfSessionKey("hql_count");
	        FacesUtils.clearValueInHashtableOfSessionKey("map");
	        FacesUtils.clearValueInHashtableOfSessionKey("sortstr");
	        
	        FacesUtils.clearValueInHashtableOfSessionKey("ids");
	        FacesUtils.clearValueInHashtableOfSessionKey("sends");
		}		
		if(this.getRequest()!=null){
			if (StringUtils.isNotEmpty(this.getRequest().getParameter("page")))
				pageNumber = Integer.parseInt(this.getRequest().getParameter("page"));
			else{
				Object obj=FacesUtils.getValueInHashtableOfSession("pageNumber",this.getSession());
	        	if(obj!=null)
	        		pageNumber=(Integer)obj;
			}
		}
		
		String hql=null;
		String hql_count=null;
		Map map=null;
		Object obj1=FacesUtils.getValueInHashtableOfSession("hql");
		Object obj2=FacesUtils.getValueInHashtableOfSession("hql_count");
		Object obj3=FacesUtils.getValueInHashtableOfSession("map");
		
		
		if(obj1!=null&&obj2!=null&&obj3!=null){
		    hql=obj1.toString();
			hql_count=obj2.toString();
			map=(Map)obj3;
			
		}else{
			Object[] objs = this.getSearchParam();
			hql=objs[0].toString();
			hql_count=objs[1].toString();
			map=(Map)objs[2];
			
		}		
		
		String sortstr=this.getSortstr();
	    
		int resultSize=this.getService().getPageSize(hql_count.toString(),map);
		if(pageNumber>Tools.ceil(resultSize, PAGE_SIZE))
			pageNumber=Tools.ceil(resultSize, PAGE_SIZE);
		List list = this.getService().getPageData(hql+sortstr, map, pageNumber, PAGE_SIZE);
		
		PageList pageList = new PageList();        
        List pages = list;
        pageList.setPageNumber(pageNumber);// 设置当前页数
        pageList.setList(pages);// 设置当前页列表        
        pageList.setObjectsPerPage(PAGE_SIZE);// 设置page size        
        pageList.setFullListSize(resultSize); // 设置总页数
        
        FacesUtils.setValueInHashtableOfSession("list", pageList);
        FacesUtils.setValueInHashtableOfSession("pageNumber", pageNumber);  
        FacesUtils.setValueInHashtableOfSession("hql", hql);
        FacesUtils.setValueInHashtableOfSession("hql_count", hql_count);
        FacesUtils.setValueInHashtableOfSession("map", map);
        FacesUtils.setValueInHashtableOfSession("sortstr", sortstr);

		return returnPage;
	}

	public HttpServletRequest getRequest() {
		return this.request;
	}

	public HttpSession getSession() {
		//HttpServletRequest request = ServletActionContext.getRequest();
		return this.request.getSession();
	}

	public User getUserInSession() {
		Object obj = getSession().getAttribute("loginUser");
		if (obj != null){
			User user = (User) obj;
			return user;
		}
		else
			return null;
	}

	public String getIpAddr(HttpServletRequest request) {
		String ip = request.getHeader("x-forwarded-for");
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("Proxy-Client-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("WL-Proxy-Client-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getRemoteAddr();
		}
		return ip;
	}

	public Map session;

	public void setSession(Map session) {
		this.session = session;
	}

	public User getLoginuser() {
		return (User) session.get("loginUser");
	}
	
	public HttpServletRequest request;
	
	public void setServletRequest(HttpServletRequest request) {
	     this.request=request;
	}
	
	public String delete(){
		search=null;
		getService().removes(ids);
		
		if(codes!=null)
			getService().removes(codes);
		
		return search();
	}

	public abstract String edit();
	public abstract String save();
	public abstract String deleteForm();
	public abstract void editForm(Long id);    
	public Long[] ids;
	public String[] idss;//附件删除转换
	public String[] codes;
	public String idsString;
	public Long[] getIds() {
		return ids;
	}
	public void setIds(Long[] ids) {
		this.ids = ids;
	}
	public String[] getCodes() {
		return codes;
	}
	public void setCodes(String[] codes) {
		this.codes = codes;
	}
	
	public String search;

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		this.search = search;
	}
	
	public void setOpinfoService(OpinfoService opinfoService) {
		this.opinfoService = opinfoService;
	}
	
	public WordbookService wordbookService;

	public void setWordbookService(WordbookService wordbookService) {
		this.wordbookService = wordbookService;
	}
	
	public void exportExcel(Map beans,String templateName,String filename) {
		try {
			HttpServletResponse response = ServletActionContext.getResponse();
			response.setContentType("application/vnd.ms-excel");
			response.setHeader("Content-disposition", "attachment; filename=\"" + filename);
			ServletOutputStream outStream = response.getOutputStream();
			ExcelUtils.exportExcel(beans, this.getText("template.path") + System.getProperty("file.separator") + templateName, outStream);			
			response.getOutputStream().flush();
			response.getOutputStream().close();			
			outStream.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public void exportAll() {
		if(getTemplateName()!=null){
			String templateName=getTemplateName();			
			String sortstr=FacesUtils.getValueInHashtableOfSession("sortstr").toString();
			String hql=FacesUtils.getValueInHashtableOfSession("hql").toString()+sortstr;
			Map map=(Map)FacesUtils.getValueInHashtableOfSession("map");		
			List list = this.getService().getPageData(hql, map);			
			Map beans=new HashMap();
			beans.put("list", list);
			String filename=templateName+Tools.getNowTime()+".xls";			
			exportExcel(beans, templateName+".xls", filename);			
	        //日志
			String message=templateName+"报表导出";
			saveOpinfo(message);
		}
	}
	
	public String getTemplateName(){
		return null;
	}

	public int getPersize() {
		return persize;
	}

	public void setPersize(int persize) {
		this.persize = persize;
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	
	public boolean getAdd(){
		String menuKey=(String)FacesUtils.getValueInHashtableOfSession("menuKey");
		if(StringUtils.isNotBlank(menuKey)){
			Long pagemenuid=Long.valueOf(menuKey.trim());
			List list=(List)session.get("add_pagemenus");
			if(list!=null&&list.contains(pagemenuid))
				return true;
		}
		return false;
	}
	public boolean getModify(){		
		String menuKey=(String)FacesUtils.getValueInHashtableOfSession("menuKey");
		if(StringUtils.isNotBlank(menuKey)){
			Long pagemenuid=Long.valueOf(menuKey.trim());
			List list=(List)session.get("modify_pagemenus");
			if(list!=null&&list.contains(pagemenuid))
				return true;
		}
		return false;
	}
	public boolean getDelete(){
		String menuKey=(String)FacesUtils.getValueInHashtableOfSession("menuKey");
		if(StringUtils.isNotBlank(menuKey)){
			Long pagemenuid=Long.valueOf(menuKey.trim());
			List list=(List)session.get("delete_pagemenus");
			if(list!=null&&list.contains(pagemenuid))
				return true;
		}
		return false;
	}
	public boolean getConfirm(){
		String menuKey=(String)FacesUtils.getValueInHashtableOfSession("menuKey");
		if(StringUtils.isNotBlank(menuKey)){
			Long pagemenuid=Long.valueOf(menuKey.trim());
			List list=(List)session.get("confirm_pagemenus");
			if(list!=null&&list.contains(pagemenuid))
				return true;
		}
		return false;
	}
	public int getFiltertype(){
		String menuKey=(String)FacesUtils.getValueInHashtableOfSession("menuKey");
		if(StringUtils.isNotBlank(menuKey)){
			Long pagemenuid=Long.valueOf(menuKey.trim());
			Pagemenu pagemenu=pagemenuService.get(pagemenuid);
			return pagemenu.getFiltertype();
		}
		return 0;
	}
	public List<String> getTagList(){
		String menuKey=(String)FacesUtils.getValueInHashtableOfSession("menuKey");
		if(StringUtils.isNotBlank(menuKey)){
			Long pagemenuid=Long.valueOf(menuKey.trim());
			Pagemenu pagemenu=pagemenuService.get(pagemenuid);
			if(pagemenu.getUsertags()!=null)
			return Arrays.asList(pagemenu.getUsertags());
		}
		return null;
	}
	
	public EventStepService eventStepService;
	
	public EventsService eventsService;
	
	private PagemenuService pagemenuService;
	
	public SysUsersService sysusersService;
	
	public SjyhxxbService sjyhxxbService;
	
	public SjfjbService sjfjbService;
	
	public SysUsers sysUsers;
	
	public String selectUser(){
		sysUsers=sysusersService.get(sysUsers.getUserid());
		//人员基本信息   
		jtcyqklist = jtcyqkService.getByHql("from Jtcyqk t where t.qykrybh = ? ", new Object[]{sysUsers.getUserid()});
		
		rhhjlblist = rhhjlbService.getByHql("from Rhhjlb t where t.qykrybh = ?", new Object[]{sysUsers.getUserid()});
		
		rwqjllist = rwqjlService.getByHql("from Rwqjl t where t.qykrybh = ?", new Object[]{sysUsers.getUserid()});
		
		shgxqklist = shgxqkService.getByHql("from Shgxqk t where t.qykrybh = ?", new Object[]{sysUsers.getUserid()});
		
		jcxxlist = jcxxService.getByHql("from Jcxx t where t.qykrybh = ?", new Object[]{sysUsers.getUserid()});
		
		return "edit";
	}
	public String selectUser2(String eid){
		//人员基本信息   
		jtcyqklist = jtcyqkeventService.getByHql("from Jtcyqkevent t where t.eid = ? ", new Object[]{eid});
		
		rhhjlblist = rhhjlbeventService.getByHql("from Rhhjlbevent t where t.eid = ?", new Object[]{eid});
		
		rwqjllist = rwqjleventService.getByHql("from Rwqjlevent t where t.eid = ?", new Object[]{eid});
		
		shgxqklist = shgxqkeventService.getByHql("from Shgxqkevent t where t.eid = ?", new Object[]{eid});
		
		jcxxlist = jcxxeventService.getByHql("from Jcxxevent t where t.eid = ?", new Object[]{eid});
		
		return "edit";
	}

	public SysUsers getSysUsers() {
		return sysUsers;
	}

	public void setSysUsers(SysUsers sysUsers) {
		this.sysUsers = sysUsers;
	}

	public void setSysusersService(SysUsersService sysusersService) {
		this.sysusersService = sysusersService;
	}

	public void setPagemenuService(PagemenuService pagemenuService) {
		this.pagemenuService = pagemenuService;
	}

	public void setSjyhxxbService(SjyhxxbService sjyhxxbService) {
		this.sjyhxxbService = sjyhxxbService;
	}

	public void setEventStepService(EventStepService eventStepService) {
		this.eventStepService = eventStepService;
	}

	public void setEventsService(EventsService eventsService) {
		this.eventsService = eventsService;
	}
	
	public List<EventStep> list;

	public List<EventStep> getList() {
		return list;
	}

	public void setList(List<EventStep> list) {
		this.list = list;
	}
	
	public List<Sjfjb> filelist;

	public List<Sjfjb> getFilelist() {
		return filelist;
	}

	public void setFilelist(List<Sjfjb> filelist) {
		this.filelist = filelist;
	}
	
	public File[] files; // 上传的文件
	public String[] filesFileName; // 文件名称
	public String[] filesContentType; // 文件类型
	public int[] yxxzs;
	
	public File[] getFiles() {
		return files;
	}
	public void setFiles(File[] files) {
		this.files = files;
	}
	public String[] getFilesContentType() {
		return filesContentType;
	}
	public void setFilesContentType(String[] filesContentType) {
		this.filesContentType = filesContentType;
	}
	public String[] getFilesFileName() {
		return filesFileName;
	}
	public void setFilesFileName(String[] filesFileName) {
		this.filesFileName = filesFileName;
	}
	public int[] getYxxzs() {
		return yxxzs;
	}
	public void setYxxzs(int[] yxxzs) {
		this.yxxzs = yxxzs;
	}

	public void setSjfjbService(SjfjbService sjfjbService) {
		this.sjfjbService = sjfjbService;
	}	
	

	public JtcyqkeventService getJtcyqkeventService() {
		return jtcyqkeventService;
	}

	public void setJtcyqkeventService(JtcyqkeventService jtcyqkeventService) {
		this.jtcyqkeventService = jtcyqkeventService;
	}

	public RhhjlbeventService getRhhjlbeventService() {
		return rhhjlbeventService;
	}

	public void setRhhjlbeventService(RhhjlbeventService rhhjlbeventService) {
		this.rhhjlbeventService = rhhjlbeventService;
	}

	public RwqjleventService getRwqjleventService() {
		return rwqjleventService;
	}

	public void setRwqjleventService(RwqjleventService rwqjleventService) {
		this.rwqjleventService = rwqjleventService;
	}

	public ShgxqkeventService getShgxqkeventService() {
		return shgxqkeventService;
	}

	public void setShgxqkeventService(ShgxqkeventService shgxqkeventService) {
		this.shgxqkeventService = shgxqkeventService;
	}

	public JcxxeventService getJcxxeventService() {
		return jcxxeventService;
	}

	public void setJcxxeventService(JcxxeventService jcxxeventService) {
		this.jcxxeventService = jcxxeventService;
	}


	public EventStepService getEventStepService() {
		return eventStepService;
	}

	public EventsService getEventsService() {
		return eventsService;
	}

	public SysUsersService getSysusersService() {
		return sysusersService;
	}

	public SjyhxxbService getSjyhxxbService() {
		return sjyhxxbService;
	}

	public SjfjbService getSjfjbService() {
		return sjfjbService;
	}

	public JtcyqkService getJtcyqkService() {
		return jtcyqkService;
	}

	public void setJtcyqkService(JtcyqkService jtcyqkService) {
		this.jtcyqkService = jtcyqkService;
	}

	public RhhjlbService getRhhjlbService() {
		return rhhjlbService;
	}

	public void setRhhjlbService(RhhjlbService rhhjlbService) {
		this.rhhjlbService = rhhjlbService;
	}

	public RwqjlService getRwqjlService() {
		return rwqjlService;
	}

	public void setRwqjlService(RwqjlService rwqjlService) {
		this.rwqjlService = rwqjlService;
	}

	public ShgxqkService getShgxqkService() {
		return shgxqkService;
	}

	public void setShgxqkService(ShgxqkService shgxqkService) {
		this.shgxqkService = shgxqkService;
	}

	public JcxxService getJcxxService() {
		return jcxxService;
	}

	public void setJcxxService(JcxxService jcxxService) {
		this.jcxxService = jcxxService;
	}

	public List<Jtcyqk> getJtcyqklist() {
		return jtcyqklist;
	}

	public void setJtcyqklist(List<Jtcyqk> jtcyqklist) {
		this.jtcyqklist = jtcyqklist;
	}

	public List<Rhhjlb> getRhhjlblist() {
		return rhhjlblist;
	}

	public void setRhhjlblist(List<Rhhjlb> rhhjlblist) {
		this.rhhjlblist = rhhjlblist;
	}

	public List<Rwqjl> getRwqjllist() {
		return rwqjllist;
	}

	public void setRwqjllist(List<Rwqjl> rwqjllist) {
		this.rwqjllist = rwqjllist;
	}

	public List<Shgxqk> getShgxqklist() {
		return shgxqklist;
	}

	public void setShgxqklist(List<Shgxqk> shgxqklist) {
		this.shgxqklist = shgxqklist;
	}

	public List<Jcxx> getJcxxlist() {
		return jcxxlist;
	}

	public void setJcxxlist(List<Jcxx> jcxxlist) {
		this.jcxxlist = jcxxlist;
	}

	public String[] getIdss() {
		return idss;
	}

	public void setIdss(String[] idss) {
		this.idss=idss;
	}

	public String getIdsString() {
		return idsString;
	}

	public void setIdsString(String idsString) {
		this.idsString = idsString;
		String[] ss = idsString.split(",");
		setIdss(ss);
	}


}

分享到:
评论

相关推荐

    BaseAction的小测试代码

    本测试代码主要关注`BaseAction`,一个常见的Action基类,它为其他具体的业务Action提供了一些基础功能和通用逻辑。`BaseAction`通常会包含错误处理、日志记录、请求参数验证等常见操作,以此提高代码的可重用性和可...

    utils类及baseAction

    在Java编程中,`Utils` 类和 `BaseAction` 是两个常见的概念,它们在软件开发中扮演着重要的角色。下面将详细阐述这两个概念及其在实际应用中的作用。 首先,我们来了解一下 `Utils` 类。`Utils`(工具类)通常是...

    抽取的BaseAction通用工具类

    很好用的工具类,希望帮助到大家

    BaseAction.rar_Java编程_Java_

    在Java编程领域,"BaseAction"常常被用作一个基类或者抽象类,为其他类提供通用的功能和行为。在给定的`BaseAction.rar`压缩包中,包含了一个名为`BaseAction.java`的源代码文件,这通常意味着这个文件定义了一个名...

    教务管理系统概要设计及详细设计.doc

    业务逻辑层是通过 Spring 框架实现的,首先建立一个 BaseAction,它继承了 Action 类,而其他定义的 Action 都要继承这个 BaseAction。这个 BaseAction 需要导入 AppContext 工具类,通过 Spring 中的 org.spring...

    原创技术:史上最灵活,强大的分页框架

    本篇将深入探讨一个被誉为“史上最灵活、强大”的分页框架,结合提供的`BaseAction.java`源码,我们将分析其设计思路和技术要点。 首先,强大的分页框架应具备以下几个核心特性: 1. **灵活性**:框架需要适应不同...

    教务管理系统(概要设计及详细设计).doc

    BaseAction类中导入了AppContext工具类,该工具类需要从Spring框架中导入,使得继承BaseAction的子类能够通过getXXXService()方法来获取服务的实例,体现了服务定位器的设计模式。这一设计使得业务层的功能得到了...

    crm人员关系管理系统spring+struts2+Hibernate

    技术上的提升:在web层和dao层都提取了公共代码封装到BaseAction和BaseDao中,提高了代码的复用,同时按照OO设计原则,针对接口编程,而不是针对实现编程。使用拦截器的方法对系统权限进行初步控制(后续可以采用...

    JAVA读取同一路径下所有类及其方法

    = null && ("com.post.common.BaseAction".equals(supercls.getName()) || "BaseAction".equals(supercls.getSimpleName()))) { classes.add(c); } } return classes; } ``` 这个方法使用 `getClasses` 方法来...

    PHP 登录完成后如何跳转上一访问页面

    具体实现 我现在的程序是基于ThinkPHP框架的,我们会有一个父类控制器,下面我就把这个设置cookie的代码加到这个BaseAction里面的_initialize()函数中,这样程序就大大简化工作量了。 复制代码 代码如下:$refer = ...

    初学JAVA-WEB开发的小项目

    在web层和dao层都提取了公共代码封装到BaseAction和BaseDao中,提高了代码的复用,同时按照OO设计原则,针对接口编程,而不是针对实现编程。 使用拦截器的方法对系统权限进行初步控制(后续可以采用Shiro框架进行...

    Struts+Spring+Hibernate 简单例子开发

    - **Action层**:`BaseAction`作为基础Action类,用于处理前端请求。 ```java import org.springframework.web.context.WebApplicationContext; public class BaseAction { // 通过Spring注入的...

    Java实现真分页.自己领悟.

    `AreaAction.java`可能是具体的业务操作类,它继承了`BaseAction.java`,实现了特定领域的分页操作。 `AccNodes.java`可能是表示数据节点的类,包含了分页数据的实体对象。这些节点可能被用于构建分页列表,每个...

    教务管理系统(概要设计与详细设计).doc

    middle层是通过 Spring 框架实现的,首先建立一个 BaseAction,然后其他定义的 Action 都要继承这个 BaseAction。持久层是由 Hibernate 架构实现的,包括关于整体数据库的 hibernate.cfg.xml 文件、每个表的 ...

    初学JAVA-WEB开发的小项目sparkling-heart.zip

    本仓库仓库是开始学习JAVA-WEB开发的一些练手...技术支持在web层和dao层都提取了公共代码封装到BaseAction和BaseDao中,提高了代码的复用性,同时遵循OO设计原则,接口是针对编程的,而不是针对实现编程的。使用拦截

    java javascript

    在这个例子中,Action需要继承自BaseAction,BaseAction提供了一些基础功能,如增删查改。Action层通过@Autowired注解来注入需要的Service实例,例如UserService。同时,如果要使用BaseAction中的方法,还需要注入...

    天下陶网络商城.zip

    6. **BaseAction类**:`BaseAction`可能是所有Action类的基类,它可能包含了一些通用的方法,如事务管理、日志记录等,以减少代码重复。 7. **StartExam类和QuestionsForm类**:`StartExam`可能是考试功能的实现,...

Global site tag (gtag.js) - Google Analytics