⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 displayaction.java

📁 旅游自助系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package org.tshs.struts.action;

import java.util.List;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.tshs.core.CacheManager;
import org.tshs.entity.SightSpot;
import org.tshs.entity.TravelCorp;
import org.tshs.entity.TravelGroup;

/** 
 * MyEclipse Struts
 * Creation date: 12-25-2006
 * 
 * XDoclet definition:
 * @struts.action validate="true"
 */
public class DisplayAction extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String type = request.getParameter("type");
		String unique = request.getParameter("unique");
		if("group".equals(type)){
			TravelGroup group = null;
			try {
				group = (TravelGroup)CacheManager.getById(Long.valueOf(unique));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Vector errors = new Vector(1);
				errors.add("旅游团信息查询失败,请稍后重试!");
				request.setAttribute("errors", errors);
				return mapping.findForward("error");
			}
			request.setAttribute("group", group);
			Vector sightnames = new Vector();
			List<Long> list = group.getSightIds();

			try {
				for (Long id : list) {
					SightSpot sight = (SightSpot) CacheManager.getById(id);
					sightnames.add(sight.getName());
				}
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Vector errors = new Vector(1);
				errors.add("旅游团信息查询失败,请稍后重试!");
				request.setAttribute("errors", errors);
				return mapping.findForward("error");
			}
			request.setAttribute("sightnames", sightnames);
			return new ActionForward("/corp/groupdisplay.jsp");
		}else if("sightspot".equals(type)){
			SightSpot sight = null;
			try {
				sight = (SightSpot)CacheManager.getById(Long.valueOf(unique));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Vector errors = new Vector(1);
				errors.add("景点信息查询失败,请稍后重试!");
				request.setAttribute("errors", errors);
				return mapping.findForward("error");
			}
			request.setAttribute("sight", sight);
			return new ActionForward("/dept/sightdisplay.jsp");
		}else if("corp".equals(type)){
			TravelCorp corp = null;
			try {
				corp = (TravelCorp)CacheManager.getById(Long.valueOf(unique));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Vector errors = new Vector(1);
				errors.add("公司信息查询失败,请稍后重试!");
				request.setAttribute("errors", errors);
				return mapping.findForward("error");
			}
			request.setAttribute("corp", corp);
			return new ActionForward("/corp/corpdisplay.jsp");
		}else{
			Vector errors = new Vector(1);
			errors.add("旅游团信息查询失败,请稍后重试!");
			request.setAttribute("errors", errors);
			return mapping.findForward("error");
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -