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

📄 editthreadaction.java

📁 Chinaxp 论坛源代码
💻 JAVA
字号:
/** XP Forum** Copyright (c) 2002-2003 RedSoft Group.  All rights reserved.**/package org.redsoft.forum.web;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 org.redsoft.forum.ForumConstants;import org.redsoft.forum.dao.DAOFactory;import org.redsoft.forum.dao.ThreadDAO;import org.redsoft.forum.exception.DAOException;import org.redsoft.forum.exception.ThreadNotFoundException;/** * Edit a thread * * @@author <a href="mailto:chjxm@msn.com">cinc</a> * * @@version $Id: EditThreadAction.java,v 1.3 2004/04/10 19:57:01 cinc Exp $ */public final class EditThreadAction extends Action {    public ActionForward execute(ActionMapping mapping,                                 ActionForm form,                                 HttpServletRequest request,                                 HttpServletResponse response)            throws ThreadNotFoundException, DAOException {        final String threadID = ((EditThreadForm) form).getThreadID();        final String subject = ((EditThreadForm) form).getSubject();        final String content = ((EditThreadForm) form).getContent();        final String notifyString = ((EditThreadForm) form).getNotify();        String category = "1";        boolean notify = false;        if( notifyString != null &&  notifyString.equals("Y") ){            notify = true;        }        final ThreadDAO dao = DAOFactory.getInstance().getThreadDAO();        final org.redsoft.forum.dao.Thread thread = dao.findByUID( Long.parseLong( threadID ) );        // set category and parentID        category = "" + thread.getCategory();        thread.setTitle(subject);        thread.setContent(content);        thread.setNotify(notify);        dao.updateThread(thread);        // Remove the obsolete form bean        if (mapping.getAttribute() != null) {            if ("request".equals(mapping.getScope()))                request.removeAttribute(mapping.getAttribute());        }        // Forward control to the specified success URI        request.setAttribute( ForumConstants.FORUM_ID_PARAM, category );        return (mapping.findForward("success"));    }}

⌨️ 快捷键说明

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