⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editregistration.gv

📁 ActionServlet源码 struts的一个步骤都有 知道本来有视频的太大了 就没有上传了
💻 GV
字号:
/*
 * $Id: EditRegistration.gv 481833 2006-12-03 17:32:52Z niallp $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
import java.lang.reflect.InvocationTargetException;
import javax.servlet.ServletException;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.struts.apps.scriptingmailreader.*;
import org.apache.struts.apps.mailreader.dao.*;

act = request.getParameter("task");
if (act == null) {
    act = "Create";
    if (log.isDebugEnabled()) {
        log.debug("EditRegistrationAction:  Processing " + act +
                    " act");
    }
}    

user = null;
// Is there a currently logged on user?
if (!"Create".equals(act)) {
    user = (User) session.getAttribute(Constants.USER_KEY);
    if (user == null) {
        if (log.isDebugEnabled()) {
            log.debug(" User is not logged on in session "
                      + session.getId());
        }
        struts.setForwardName("Logon");
        return;
    }
}

form = struts.form;
if (user != null) {
    if (log.isTraceEnabled()) {
        log.trace(" Populating form from " + user);
    }
    try {
        PropertyUtils.copyProperties((Object)form, user);
        
        form.set("task", act);
        form.set("password", null);
        form.set("password2", null);
    } catch (InvocationTargetException e) {
        Throwable t = e.getTargetException();
        if (t == null)
            t = e;
        log.error("RegistrationForm.populate", t);
        throw new ServletException("RegistrationForm.populate", t);
    } catch (Throwable t) {
        log.error("RegistrationForm.populate", t);
        throw new ServletException("RegistrationForm.populate", t);
    }
}

// Set a transactal control token to prevent double posting
if (log.isTraceEnabled()) {
    log.trace(" Setting transactal control token");
}
struts.action.saveToken(request);

// Forward control to the edit user registration page
if (log.isTraceEnabled()) {
    log.trace(" Forwarding to 'success' page");
}

struts.setForwardName("Success");

⌨️ 快捷键说明

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