/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package news;

import java.util.ArrayList;

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 database.DBConn;

/** 
 * MyEclipse Struts
 * Creation date: 05-25-2008
 * 
 * XDoclet definition:
 * @struts.action validate="true"
 * @struts.action-forward name="allnews" path="/allnews.jsp"
 */
public class AllNews 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) {
		ArrayList a = new DBConn().selectNews();
		int classes = Integer.parseInt(request.getParameter("classes"));
		request.setAttribute("news", a);
		if(classes==1)
		{
			return mapping.findForward("lingdao");
		}
		if(classes==2)
		{
			return mapping.findForward("jiancha");
		}
		if(classes==3)
		{
			return mapping.findForward("hangye");
		}
		if(classes==4)
		{
			return mapping.findForward("anquan");
		}
		if(classes==5)
		{
			return mapping.findForward("shangwang");
		}
		return mapping.findForward("allnews");
	}
}