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

📄 showaction.java

📁 简单的BBS系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.zjy.struts.action;

import java.util.List;

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

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.zjy.struts.form.UsersForm;
import com.zjy.struts.form.ZhutieForm;
import com.zjy.struts.mybean.Fenye;
import com.zjy.struts.mypackage.FenyeDao;
import com.zjy.struts.mypackage.HuitieDao;
import com.zjy.struts.mypackage.UserDao;
import com.zjy.struts.mypackage.ZhutiDao;
import com.zjy.struts.mypackage.ZhutieDao;

/**
 * MyEclipse Struts Creation date: 04-11-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action parameter="method"
 */
public class ShowAction extends DispatchAction {
	/*
	 * Generated Methods
	 */

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward showtie(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub

		String sid = request.getParameter("id");//取主帖id
		if (sid == null || "".equals(sid)) {
			return mapping.findForward("tomessage");
		} else {
			int id = Integer.parseInt(sid);
			ZhutieDao zd = new ZhutieDao();
			ZhutieForm zf = zd.setZhutie(id);//取主帖内容
			FenyeDao fd = new FenyeDao();
			Fenye hfy = fd.selectHuitie("1", id);
			HuitieDao hd = new HuitieDao();
			List hlist = hd.setHuitie(hfy);//取回帖内容
			HttpSession hs = request.getSession();
			hs.setAttribute("zf", zf);
			hs.setAttribute("huitiefy", hfy);
			hs.setAttribute("hlist", hlist);
			return mapping.findForward("tohuitie");
		}
	}

	public ActionForward showhuitie(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		
		String showpage = request.getParameter("showpage");
		if(showpage==null||"".equals(showpage)){
			showpage="1";
		}
		HttpSession hs = request.getSession();
		Fenye hfy1 = (Fenye) hs.getAttribute("huitiefy");
		FenyeDao fd = new FenyeDao();
		Fenye hfy = fd.selectHuitie(showpage, hfy1.getId());
		HuitieDao hd = new HuitieDao();
		List hlist = hd.setHuitie(hfy);//取回帖内容
		hs.setAttribute("huitiefy", hfy);
		hs.setAttribute("hlist", hlist);
		return mapping.findForward("tohuitie");
	}
	public ActionForward showzhuti(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		String sp=request.getParameter("showpage");
		if(sp==null||"".equals(sp)){
			sp="1";
		}
		FenyeDao fd=new FenyeDao();
		Fenye zfy=fd.selectZhutie(sp);	
		ZhutiDao zd=new ZhutiDao();
		List list=zd.selectZhuti(zfy);//取主题列表内容
		HttpSession hs=request.getSession();
		String dname=(String)hs.getAttribute("dname");
		if(dname==null||"".equals(dname)){
			dname="customer";
		}
		hs.setAttribute("zhutify",zfy);
		hs.setAttribute("zhutilist",list);
		hs.setAttribute("dname",dname);
		return mapping.findForward("tozhutie");
	}
	public ActionForward showuser(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		HttpSession hs=request.getSession();
		String dname=(String)hs.getAttribute("dname");
		UserDao ud=new UserDao();
		UsersForm ufi= ud.selectInf(dname);//取用户信息
		hs.setAttribute("ufi", ufi);
		return mapping.findForward("toxiugai");
	}
	public ActionForward showAllusers(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
       String name=request.getParameter("name");
       UserDao ud=new UserDao();
       UsersForm uf=ud.selectInf(name);//取用户信息
       if(uf.getId()==0){
    	   request.setAttribute("u","null");
    	   request.setAttribute("aul",null);
       }else{
    	   request.setAttribute("aul",uf);
       }
		return mapping.findForward("tousers");
	}
	
}

⌨️ 快捷键说明

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