📄 findsomefriendinfoaction.java
字号:
package com.lideedu.huang.addressBook.struts.action;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
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.pojos.Friend;
import com.lideedu.huang.addressBook.struts.form.FriendForm;
public class FindSomeFriendInfoAction extends DispatchAction {
// fileds
IFriendService friendService;
Friend friend;
// 查看朋友信息
public ActionForward findSomeFriendInfo(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IllegalAccessException,
InvocationTargetException {
FriendForm friendForm = new FriendForm();
int friendID = Integer.parseInt(request.getParameter("friendID"));
request.getSession().setAttribute("friendID", friendID);
Friend friend = friendService.getFriend(friendID);
BeanUtils.copyProperties(friendForm, friend);
request.setAttribute("friendForm", friendForm);
return mapping.findForward("toUpdateFriendInfoJsp");
}
// getter and setter
public IFriendService getFriendService() {
return friendService;
}
public void setFriendService(IFriendService friendService) {
this.friendService = friendService;
}
public Friend getFriend() {
return friend;
}
public void setFriend(Friend friend) {
this.friend = friend;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -