当前位置: 首页>>代码示例>>Java>>正文


Java FileConfiguration.getProperty方法代码示例

本文整理汇总了Java中org.apache.commons.configuration.FileConfiguration.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java FileConfiguration.getProperty方法的具体用法?Java FileConfiguration.getProperty怎么用?Java FileConfiguration.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration.FileConfiguration的用法示例。


在下文中一共展示了FileConfiguration.getProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY)
public Resolution update() {
    setupFormAndBean();
    form.readFromRequest(context.getRequest());
    if (form.validate()) {
        logger.debug("Applying settings to model");
        try {
            FileConfiguration fileConfiguration = (FileConfiguration) configuration;
            Settings settings = new Settings();
            form.writeToObject(settings);
            fileConfiguration.setProperty(PortofinoProperties.APP_NAME, settings.appName);
            fileConfiguration.setProperty(PortofinoProperties.LANDING_PAGE, settings.landingPage);
            fileConfiguration.setProperty(PortofinoProperties.LOGIN_PAGE, settings.loginPage);
            if(!settings.preloadGroovyPages ||
               fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES) != null) {
                fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES, settings.preloadGroovyPages);
            }
            if(!settings.preloadGroovyClasses ||
               fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES) != null) {
                fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES, settings.preloadGroovyClasses);
            }
            fileConfiguration.save();
            logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath());
        } catch (Exception e) {
            logger.error("Configuration not saved", e);
            SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
            return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
        }
        SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
        return new RedirectResolution(this.getClass());
    } else {
        return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:35,代码来源:SettingsAction.java

示例2: update

import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY)
public Resolution update() {
	setupFormAndBean();
	form.readFromRequest(context.getRequest());
	if (form.validate()) {
		logger.debug("Applying settings to model");
		try {
			FileConfiguration fileConfiguration = (FileConfiguration) configuration;
			Settings settings = new Settings();
			form.writeToObject(settings);
			fileConfiguration.setProperty(PortofinoProperties.APP_NAME, settings.appName);
			fileConfiguration.setProperty(PortofinoProperties.LANDING_PAGE, settings.landingPage);
			fileConfiguration.setProperty(PortofinoProperties.LOGIN_PAGE, settings.loginPage);
			if (!settings.preloadGroovyPages
					|| fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES) != null) {
				fileConfiguration
						.setProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES, settings.preloadGroovyPages);
			}
			if (!settings.preloadGroovyClasses
					|| fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES) != null) {
				fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES,
						settings.preloadGroovyClasses);
			}
			fileConfiguration.save();
			logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath());
		} catch (Exception e) {
			logger.error("Configuration not saved", e);
			SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
			return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
		}
		SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
		return new RedirectResolution(this.getClass());
	} else {
		return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
	}
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:37,代码来源:CrudAction4ReportExport.java


注:本文中的org.apache.commons.configuration.FileConfiguration.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。