?? guestnewsaction.java
字號:
package com.xdf.news.web.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.xdf.news.bean.Reply;
import com.xdf.news.bo.BOFactory;
import com.xdf.news.bo.INewsService;
import com.xdf.news.web.form.ReplyForm;
/**
* MyEclipse Struts
* Creation date: 03-23-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class GuestNewsAction extends DispatchAction {
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
String path = mapping.getPath();
String method = path.substring(path.lastIndexOf("/")+1);
return dispatchMethod(mapping,form,request,response,method);
}
public ActionForward showall(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
INewsService ser = BOFactory.getNewsService();
request.setAttribute("newslist",ser.findAllNews());
return mapping.findForward("showall");
}
public ActionForward showone(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
INewsService ser = BOFactory.getNewsService();
Long id = new Long(request.getParameter("newsid"));
request.setAttribute("news",ser.findNewsById(id));
return mapping.findForward("showone");
}
public ActionForward reply(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ReplyForm rf = (ReplyForm) form;
INewsService ser = BOFactory.getNewsService();
Reply r = new Reply();
r.setContent(rf.getContent());
r.setName(rf.getName());
r.setNews(ser.findNewsById(new Long(rf.getNewsid())));
ser.addreply(r);
request.setAttribute("replyForm",null);
return mapping.findForward("showone");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -