📄 strutscalendaraction.java
字号:
package com.manning.hq.ch08.struts;import com.manning.hq.ch08.EventServiceLocatorDao;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import java.io.IOException;import java.util.List;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.ServletException;/** * * * @author Patrick Peak * @author Nick Heudecker */public class StrutsCalendarAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { StrutsCalendarForm calendarForm = (StrutsCalendarForm) form; EventServiceLocatorDao dao = new EventServiceLocatorDao(); int month = calendarForm.getMonth(); int year = calendarForm.getYear(); StrutsCalendarModel calendar = new StrutsCalendarModel(month, year); List events = dao.findEventsFor(month, year); calendar.setEvents(events); req.setAttribute("calendar", calendar); return mapping.findForward("success"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -