?? baseaction.java
字號:
/*
* $Id: BaseAction.java 54929 2004-10-16 16:38:42Z germuska $
*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.struts.webapp.example;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.webapp.example.UserDatabase;
import javax.servlet.http.HttpServletRequest;
/**
* Base Action for MailReader application.
*
* @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
*/
public class BaseAction extends Action {
// ----------------------------------------------------- Instance Variables
/**
* The <code>Log</code> instance for this application.
*/
protected Log log = LogFactory.getLog(Constants.PACKAGE);
// ------------------------------------------------------ Protected Methods
/**
* Return a reference to the UserDatabase
* or null if the database is not available.
* @param request The request we are processing
* @return a reference to the UserDatabase or null if the database is not available
*/
protected UserDatabase getUserDatabase(HttpServletRequest request) {
return (UserDatabase) servlet.getServletContext().getAttribute(
Constants.DATABASE_KEY);
}
/**
* Return the local or global forward named "failure"
* or null if there is no such forward.
* @param mapping Our ActionMapping
* @return Return the mapping named "failure" or null if there is no such mapping.
*/
protected ActionForward findFailure(ActionMapping mapping) {
return (mapping.findForward(Constants.FAILURE));
}
/**
* Return the mapping labeled "success"
* or null if there is no such mapping.
* @param mapping Our ActionMapping
* @return Return the mapping named "success" or null if there is no such mapping.
*/
protected ActionForward findSuccess(ActionMapping mapping) {
return (mapping.findForward(Constants.SUCCESS));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -