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

📄 announcelistaction.java

📁 采用Eclispe开发平台
💻 JAVA
字号:
package com.whatratimes.webedu.bbs;

import com.whatratimes.tables.t_user;
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 org.apache.struts.validator.DynaValidatorActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Hashtable;

/**
 * User: Tao
 * Date: May 29, 2003
 * Time: 9:57:36 PM
 *
 * 显示一个主题的所有回复消息的列表
 */
public class AnnounceListAction extends Action
{
    public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception
    {
        int page = 0;

        Object p = httpServletRequest.getParameter("Page");

        if (p != null)
        {
            try
            {
                page = Integer.valueOf(p.toString()).intValue();
            } catch (NumberFormatException e)
            {
                page = 1;
            }
        }

        HttpSession session = httpServletRequest.getSession();

        t_user user = (t_user) session.getAttribute("User");

        String topic_id = httpServletRequest.getParameter("TopicId");

        if (topic_id == null)
        {
            topic_id = (String) session.getAttribute("TopicId");
        } else
        {
            session.setAttribute("TopicId", topic_id);
        }

        Object[] objs = BBSHelper.setAnnounces(session, Integer.valueOf(topic_id), page);

        if (objs.length > 0)
        {
            DynaValidatorActionForm form = (DynaValidatorActionForm) actionForm;

            form.initialize(actionMapping);

            Hashtable h = (Hashtable) objs[0];
            form.set("ParentId", Integer.valueOf(topic_id));
            form.set("UserId", new Integer(user.UserId));
            form.set("BoardId", h.get("BoardId"));
            form.set("CourseId", h.get("CourseId"));
            form.set("ClassId", h.get("ClassId"));
            form.set("Operation", "Create");
        } else
        {
            return actionMapping.findForward("topic");

        }
        return actionMapping.findForward("success");
    }
}

⌨️ 快捷键说明

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