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

📄 property.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   Property.java

package org.apache.struts2.components;

import com.opensymphony.xwork2.util.TextUtils;
import com.opensymphony.xwork2.util.ValueStack;
import java.io.IOException;
import java.io.Writer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

// Referenced classes of package org.apache.struts2.components:
//			Component

public class Property extends Component
{

	private static final Log LOG = LogFactory.getLog(org/apache/struts2/components/Property);
	private String defaultValue;
	private String value;
	private boolean escape;

	public Property(ValueStack stack)
	{
		super(stack);
		escape = true;
	}

	public void setDefault(String defaultValue)
	{
		this.defaultValue = defaultValue;
	}

	public void setEscape(boolean escape)
	{
		this.escape = escape;
	}

	public void setValue(String value)
	{
		this.value = value;
	}

	public boolean start(Writer writer)
	{
		boolean result = super.start(writer);
		String actualValue = null;
		if (value == null)
			value = "top";
		else
		if (altSyntax() && value.startsWith("%{") && value.endsWith("}"))
			value = value.substring(2, value.length() - 1);
		actualValue = (String)getStack().findValue(value, java/lang/String);
		try
		{
			if (actualValue != null)
				writer.write(prepare(actualValue));
			else
			if (defaultValue != null)
				writer.write(prepare(defaultValue));
		}
		catch (IOException e)
		{
			LOG.info((new StringBuilder()).append("Could not print out value '").append(value).append("'").toString(), e);
		}
		return result;
	}

	private String prepare(String value)
	{
		if (escape)
			return TextUtils.htmlEncode(value);
		else
			return value;
	}

}

⌨️ 快捷键说明

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