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

📄 usersarticleaction.java

📁 本博客系统是在J2EE平台上用Hibernate框架技术和MVC模式构建
💻 JAVA
字号:
package com.blog;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.blog.tableclass.*;

public class UsersArticleAction extends HttpServlet {
    
	public void init(ServletConfig config) throws ServletException {
    }
    
    /*
     *  处理<GET> 请求方法.
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    	//设置接收信息的字符集
    	request.setCharacterEncoding("UTF-8");
    	//接收浏览器端提交的信息
    	HttpSession session = request.getSession(true);
    	Blog blog = (Blog)session.getAttribute(Constants.LOGIN_USER_KEY);
		
		String sortid = request.getParameter("sortid");		
		int iSortId = 0;
		if (sortid!=null) {
			iSortId = Integer.parseInt(sortid);
		}
	    
        /*
         * 执行数据库操作并返回结果
         */
		OperateDatabase	db=new OperateDatabase();
		List articleList=db.getBlogArticles(blog.getId(),iSortId);
		
		session.setAttribute(Constants.ARTICLE_LIST_KEY,articleList);
    	response.sendRedirect("/NewBlog/users/adminArticle.jsp");
       

    }

	protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
		// TODO 自动生成方法存根
		this.doGet(arg0,arg1);
	}
    
    
}

⌨️ 快捷键说明

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