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

📄 text.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:   Text.java

package org.apache.struts2.components;

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

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

public class Text extends Component
	implements Param.UnnamedParametric
{

	private static final Log LOG = LogFactory.getLog(org/apache/struts2/components/Text);
	protected List values;
	protected String actualName;
	protected String name;

	public Text(ValueStack stack)
	{
		super(stack);
		values = Collections.EMPTY_LIST;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public boolean usesBody()
	{
		return true;
	}

	public boolean end(Writer writer, String body)
	{
		actualName = findString(name, "name", "You must specify the i18n key. Example: welcome.header");
		String defaultMessage;
		if (TextUtils.stringSet(body))
			defaultMessage = body;
		else
			defaultMessage = actualName;
		String msg = null;
		ValueStack stack = getStack();
		Iterator iterator = getStack().getRoot().iterator();
		do
		{
			if (!iterator.hasNext())
				break;
			Object o = iterator.next();
			if (!(o instanceof TextProvider))
				continue;
			TextProvider tp = (TextProvider)o;
			msg = tp.getText(actualName, defaultMessage, values, stack);
			break;
		} while (true);
		if (msg != null)
			try
			{
				if (getId() == null)
					writer.write(msg);
				else
					stack.getContext().put(getId(), msg);
			}
			catch (IOException e)
			{
				LOG.error("Could not write out Text tag", e);
			}
		return super.end(writer, "");
	}

	public void addParameter(String key, Object value)
	{
		addParameter(value);
	}

	public void addParameter(Object value)
	{
		if (values.isEmpty())
			values = new ArrayList(4);
		values.add(value);
	}

}

⌨️ 快捷键说明

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