📄 topicsearchaction.java
字号:
package j2eebbs.admin.action;
import j2eebbs.Constants;
import j2eebbs.DB;
import j2eebbs.Topic;
import j2eebbs.admin.form.TopicManagerForm;
import java.util.Vector;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public final class TopicSearchAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
TopicManagerForm topicManagerForm = (TopicManagerForm) form;
String title = topicManagerForm.getTitle();
HttpSession session = request.getSession();
Vector topicVector = new Vector();
ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource) context.getAttribute(Constants.DATASOURCE_KEY);
DB db = new DB(dataSource);
topicVector = Topic.search(db, title);
session.setAttribute(Constants.TOPIC_LIST_KEY, topicVector);
session.setAttribute(Constants.SEARCH_TOPIC_KEY, title);
db.close();
return (mapping.findForward("ToTopicManager"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -