bbscontentsaction.java

来自「使用J2EE Struts开发的房地产信息咨询系统」· Java 代码 · 共 44 行

JAVA
44
字号
/**
 * 查看BBS内容的Action Bean
 * BBSContentsAction.java
 * @author usr
 */

package building;

import java.util.*;
import javax.sql.*;
import javax.servlet.http.*;
import javax.servlet.ServletContext;
import org.apache.struts.action.*;

public final class BBSContentsAction extends Action
{
	public ActionForward execute(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response)
	throws Exception
	{
		DynaActionForm bbsIdForm = (DynaActionForm)form;
		
		Integer bbsId = (Integer)bbsIdForm.get("bbsId");
		
		ServletContext context = servlet.getServletContext();
		DataSource dataSource = (DataSource)context.getAttribute(Constants.DATASOURCE_KEY);
		DB db = new DB(dataSource);
		
		HttpSession session = request.getSession();
		
		session.setAttribute(Constants.BBS_CONTENTS_KEY,BBS.getOneInfo(db,bbsId.intValue()));
		session.setAttribute(Constants.BBS_NEXT_KEY,BBSnext.getInfoByBBSID(db,bbsId.intValue()));
		String PageForward = "toBBSContents";
		
		db.close();
		
		return(mapping.findForward(PageForward));
	}//End of execute
	
}//End of class BBSContentsAction

⌨️ 快捷键说明

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