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

📄 strutsvelocitycontext.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:   StrutsVelocityContext.java

package org.apache.struts2.views.velocity;

import com.opensymphony.xwork2.util.ValueStack;
import java.util.Map;
import org.apache.velocity.VelocityContext;

public class StrutsVelocityContext extends VelocityContext
{

	private static final long serialVersionUID = 0x75ec29af15e214e3L;
	ValueStack stack;
	VelocityContext chainedContexts[];

	public StrutsVelocityContext(ValueStack stack)
	{
		this(null, stack);
	}

	public StrutsVelocityContext(VelocityContext chainedContexts[], ValueStack stack)
	{
		this.chainedContexts = chainedContexts;
		this.stack = stack;
	}

	public boolean internalContainsKey(Object key)
	{
		boolean contains = super.internalContainsKey(key);
		if (contains)
			return true;
		if (stack != null)
		{
			Object o = stack.findValue(key.toString());
			if (o != null)
				return true;
			o = stack.getContext().get(key.toString());
			if (o != null)
				return true;
		}
		if (chainedContexts != null)
		{
			for (int index = 0; index < chainedContexts.length; index++)
				if (chainedContexts[index].containsKey(key))
					return true;

		}
		return false;
	}

	public Object internalGet(String key)
	{
		if (super.internalContainsKey(key))
			return super.internalGet(key);
		if (stack != null)
		{
			Object object = stack.findValue(key);
			if (object != null)
				return object;
			object = stack.getContext().get(key);
			if (object != null)
				return object;
		}
		if (chainedContexts != null)
		{
			for (int index = 0; index < chainedContexts.length; index++)
				if (chainedContexts[index].containsKey(key))
					return chainedContexts[index].internalGet(key);

		}
		return null;
	}
}

⌨️ 快捷键说明

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