📄 showfriendinfoaction.java
字号:
package com.lideedu.huang.addressBook.struts.action;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.lideedu.huang.addressBook.business.IFriendService;
import com.lideedu.huang.addressBook.utils.PageBean;
public class ShowFriendInfoAction extends DispatchAction {
// fileds
int currentPage;
HashMap queryCondition;
IFriendService friendService;
// 查询朋友信息
public ActionForward showFriendInfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String queryMode = request.getParameter("queryMode");
String currentPageStr = request.getParameter("currentPage");
if (queryMode!=null&&queryMode.equals("queryAll")) {
queryCondition = null;
request.setAttribute("queryMode", "queryAll");
} else {
queryCondition = (HashMap) request.getSession().getAttribute(
"queryCondition");
request.setAttribute("queryMode", "conditionQuery");
}
if (currentPageStr != null)
currentPage = Integer.parseInt(currentPageStr);
else
currentPage = 1;
PageBean pageBean = friendService.getFriends(queryCondition,
new PageBean(currentPage));
request.setAttribute("pageBean", pageBean);
return mapping.findForward("toShowFriendInfoJsp");
}
public ActionForward showFriendInfo2(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
return showFriendInfo(mapping, form, request, response);
}
// getter and setter
public IFriendService getFriendService() {
return friendService;
}
public void setFriendService(IFriendService friendService) {
this.friendService = friendService;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -