strutsvelocitycontext.java
来自「struts 2 核心包 的源码 有错误是难免的」· Java 代码 · 共 77 行
JAVA
77 行
// 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 + =
减小字号Ctrl + -
显示快捷键?