📄 manageimagecontroller.java
字号:
/*
* Created on 2004-10-9
* Author: Xuefeng, Copyright (C) 2004, Xuefeng.
*/
package org.crystalblog.web;
import java.util.*;
import javax.servlet.http.*;
import org.crystalblog.domain.*;
import org.crystalblog.logic.Facade;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
/**
* List the images of the specified category.
*
* @author Xuefeng
*/
public class ManageImageController implements Controller {
private Facade facade;
public void setFacade(Facade facade) { this.facade = facade; }
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
int accountId = Identity.getIdentity(request).getAccountId();
int categoryId = (-1);
String s_categoryId = request.getParameter("categoryId");
if(s_categoryId!=null && !s_categoryId.equals(""))
categoryId = Integer.parseInt(s_categoryId);
// get images:
List images = null;
if(categoryId!=(-1))
images = facade.getImages(categoryId);
else
images = Collections.EMPTY_LIST;
// get categories:
List categories = facade.getCategoriesOfType(accountId, Category.TYPE_IMAGES);
Map map = new HashMap();
map.put("categories", categories);
map.put("categoryId", new Integer(categoryId));
map.put("images", images);
map.put("total", new Integer(images.size()));
map.put("account", facade.getAccount(accountId));
map.put("position", "Manage >> Image");
return new ModelAndView("/manage/image-list.html", map);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -