ContentAction.java
上传用户:jishiqi_cj
上传日期:2022-08-08
资源大小:24765k
文件大小:1k
- /*
- /*回复帖子
- */
- package StudyBbs;
- 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 javax.servlet.ServletContext;
- import javax.sql.DataSource;
- import java.sql.Connection;
- import java.sql.Statement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.*;
- import javax.servlet.http.*;
- public final class ContentAction extends Action{
- public ActionForward execute(
- ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws Exception {
-
- TopicForm topicform = (TopicForm) form;
-
- int topicid = topicform.getTopicid();
-
- HttpSession session = request.getSession();
- Vector v = new Vector();
- ResultSet rs;
- ServletContext context = servlet.getServletContext();
- DataSource dataSource =
- (DataSource)context.getAttribute(Constants.DATASOURCE_KEY);
-
- DB db = new DB(dataSource);
- Respond content =new Respond();
- v = content.search(db,topicid);
- session.setAttribute(Constants.RESPONS_LIST_KEY,v);
- // session.setAttribute(Constants.TALK_TYPE_KEY,"content");
- session.setAttribute(Constants.CUR_TOPICID_KEY,new Integer(topicid));
-
- return (mapping.findForward("toBbsContent"));
- }
- }