actionutils.java

来自「大家好啊 快来抢购J2ME东东 挺不错的啊 不要后悔啊 抓住机会」· Java 代码 · 共 39 行

JAVA
39
字号
package com.ora.jsp.servlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**
 * This class contains utility methods used by the Action objects
 * in the Project Billboard application.
 *
 * @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
 * @version 1.0
 */
public class ActionUtils {
    
    /**
     * Returns a URL suitable for redirecting to a JSP page 
     * through the controller servlet, as a showPage action.
     *
     * @param page a relative URL to the target page, URL encoded if
     * it contains parameters.
     */
    public String getShowPageURL(HttpServletRequest request, String page) {
        return request.getContextPath() + request.getServletPath() + 
            "?action=showPage&page=" + page;
    }
    
    /**
     * Forwards to the specified URL.
     *
     * @param url a relative URL
     */
    public void forward(String url, HttpServletRequest request,
        HttpServletResponse response) 
        throws IOException, ServletException {
        RequestDispatcher rd = request.getRequestDispatcher(url);
        rd.forward(request, response);
    }
}

⌨️ 快捷键说明

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