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

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import news.AddNewsForm;
import news.News;

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-26-2008
 * 
 * XDoclet definition:
 * @struts.action path="/doeditNews" name="addNews" scope="request" validate="true"
 * @struts.action-forward name="ok" path="/admin/newsok.jsp"
 */
public class DoEditNews 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) {
		AddNewsForm addNews = (AddNewsForm) form;// TODO Auto-generated method stub
		DBConn db = new DBConn();
		News news = new News();
		News newsid = (News)request.getSession().getAttribute("shownews");
		news.setId(newsid.getId());
		news.setTitle(addNews.getTitle());
		news.setUsers(addNews.getUsers());
		news.setContent(addNews.getContent());
		db.editNews(news);
		return mapping.findForward("ok1");
	}
}