setpreferencesaction.java

来自「在sun实训时写的」· Java 代码 · 共 61 行

JAVA
61
字号
/* * SetPreferencesAction.java * * Created on December 1, 2006, 9:24 AM */package com.dvd.controller;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionMapping;import org.apache.struts.action.ActionForward;/** * * @author revans * @version */public class SetPreferencesAction extends Action {        /* forward name="success" path="" */    private final static String SUCCESS = "success";        /**     * This is the action called from the Struts framework.     * @param mapping The ActionMapping used to select this instance.     * @param form The optional ActionForm bean for this request.     * @param request The HTTP Request we are processing.     * @param response The HTTP Response we are processing.     * @throws java.lang.Exception     * @return     */    public ActionForward execute(ActionMapping mapping, ActionForm  form,            HttpServletRequest request, HttpServletResponse response)            throws Exception {        // Retrieve form parameters        String[] show_values = request.getParameterValues("show");                // Retrieve the session object        HttpSession session = request.getSession();                // Remove old values        session.removeAttribute("showTitle");        session.removeAttribute("showYear");        session.removeAttribute("showGenre");                // Use the parameter values as attribute names        if ( show_values != null ) {            for ( int i = 0; i < show_values.length; i++ ) {                session.setAttribute(show_values[i], "true");            }        }                return mapping.findForward("success");    }}

⌨️ 快捷键说明

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