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


Java ValueStack.push方法代码示例

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


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

示例1: start

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public boolean start(Writer writer) {
    boolean result = super.start(writer);

    ValueStack stack = getStack();

    try {
        String beanName = findString(name, "name", "Bean name is required. Example: com.acme.FooBean or proper Spring bean ID");
        bean = objectFactory.buildBean(beanName, stack.getContext(), false);
    } catch (Exception e) {
        LOG.error("Could not instantiate bean", e);
        return false;
    }

    // push bean on stack
    stack.push(bean);

    // store for reference later
    putInContext(bean);

    return result;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:22,代码来源:Bean.java

示例2: intercept

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
@Override
public String intercept(ActionInvocation invocation) throws Exception {
    Object action = invocation.getAction();

    if (action instanceof ModelDriven) {
        ModelDriven modelDriven = (ModelDriven) action;
        ValueStack stack = invocation.getStack();
        Object model = modelDriven.getModel();
        if (model !=  null) {
        	stack.push(model);
        }
        if (refreshModelBeforeResult) {
            invocation.addPreResultListener(new RefreshModelBeforeResult(modelDriven, model));
        }
    }
    return invocation.invoke();
}
 
开发者ID:txazo,项目名称:struts2,代码行数:18,代码来源:ModelDrivenInterceptor.java

示例3: getOverrideExpr

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
protected Object getOverrideExpr(ActionInvocation invocation, Object value) {
    ValueStack stack = invocation.getStack();

    try {
        stack.push(value);

        return escape(stack.findString("top"));
    } finally {
        stack.pop();
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:12,代码来源:StrutsConversionErrorInterceptor.java

示例4: start

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public boolean start(Writer writer) {
    boolean result = super.start(writer);

    ValueStack stack = getStack();

    if (stack != null) {
        stack.push(findValue(value, "value", "You must specify a value to push on the stack. Example: person"));
        pushed = true;
    } else {
        pushed = false; // need to ensure push is assigned, otherwise we may have a leftover value
    }

    return result;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:15,代码来源:Push.java

示例5: renderTemplate

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public void renderTemplate(TemplateRenderingContext templateContext) throws Exception {
    Template template = templateContext.getTemplate();

    LOG.debug("Trying to render template [{}], repeating through parents until we succeed", template);
    UIBean tag = templateContext.getTag();
    ValueStack stack = templateContext.getStack();
    stack.push(tag);
    PageContext pageContext = (PageContext) stack.getContext().get(ServletActionContext.PAGE_CONTEXT);
    List<Template> templates = template.getPossibleTemplates(this);
    Exception exception = null;
    boolean success = false;
    for (Template t : templates) {
        try {
            Include.include(getFinalTemplateName(t), pageContext.getOut(),
                    pageContext.getRequest(), (HttpServletResponse) pageContext.getResponse(), encoding);
            success = true;
            break;
        } catch (Exception e) {
            if (exception == null) {
                exception = e;
            }
        }
    }

    if (!success) {
        LOG.error("Could not render JSP template {}", templateContext.getTemplate());

        if (exception != null) {
            throw exception;
        } else {
            return;
        }
    }

    stack.pop();
}
 
开发者ID:txazo,项目名称:struts2,代码行数:37,代码来源:JspTemplateEngine.java

示例6: end

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public boolean end(Writer writer, String body) {
    ValueStack stack = getStack();
    if (iterator != null) {
        stack.pop();
    }

    if (iterator!=null && iterator.hasNext()) {
        Object currentValue = iterator.next();
        stack.push(currentValue);

        putInContext(currentValue);

        // Update status
        if (status != null) {
            statusState.next(); // Increase counter
            statusState.setLast(!iterator.hasNext());
        }

        return true;
    } else {
        // Reset status object in case someone else uses the same name in another iterator tag instance
        if (status != null) {
            if (oldStatus == null) {
                stack.getContext().put(statusAttr, null);
            } else {
                stack.getContext().put(statusAttr, oldStatus);
            }
        }
        super.end(writer, "");
        return false;
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:33,代码来源:IteratorComponent.java

示例7: beforeResult

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public void beforeResult(ActionInvocation invocation, String resultCode) {
    ValueStack stack = invocation.getStack();
    CompoundRoot root = stack.getRoot();

    boolean needsRefresh = true;
    Object newModel = action.getModel();

    // Check to see if the new model instance is already on the stack
    for (Object item : root) {
        if (item.equals(newModel)) {
            needsRefresh = false;
            break;
        }
    }

    // Add the new model on the stack
    if (needsRefresh) {

        // Clear off the old model instance
        if (originalModel != null) {
            root.remove(originalModel);
        }
        if (newModel != null) {
            stack.push(newModel);
        }
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:28,代码来源:ModelDrivenInterceptor.java

示例8: testNullIsNotReturnedWhenCreateNullObjectsIsSpecified

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public void testNullIsNotReturnedWhenCreateNullObjectsIsSpecified() {
    ValueStack vs = ActionContext.getContext().getValueStack();
    vs.push(new MapHolder(Collections.emptyMap()));
    ReflectionContextState.setCreatingNullObjects(vs.getContext(), true);

    Object value = vs.findValue("map['key']");
    assertNotNull(value);
    assertSame(Object.class, value.getClass());
}
 
开发者ID:txazo,项目名称:struts2,代码行数:10,代码来源:XWorkMapPropertyAccessorTest.java

示例9: testCreateNullObjectsIsFalseByDefault

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public void testCreateNullObjectsIsFalseByDefault() {
    ValueStack vs = ActionContext.getContext().getValueStack();
    vs.push(new MapHolder(Collections.emptyMap()));
    assertNull(vs.findValue("map[key]"));
}
 
开发者ID:txazo,项目名称:struts2,代码行数:6,代码来源:XWorkMapPropertyAccessorTest.java

示例10: testMapContentsAreReturned

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public void testMapContentsAreReturned() {
    ValueStack vs = ActionContext.getContext().getValueStack();
    vs.push(new MapHolder(Collections.singletonMap("key", "value")));
    assertEquals("value", vs.findValue("map['key']"));
}
 
开发者ID:txazo,项目名称:struts2,代码行数:6,代码来源:XWorkMapPropertyAccessorTest.java

示例11: testNullIsReturnedWhenCreateNullObjectsIsSpecifiedAsFalse

import com.opensymphony.xwork2.util.ValueStack; //导入方法依赖的package包/类
public void testNullIsReturnedWhenCreateNullObjectsIsSpecifiedAsFalse() {
    ValueStack vs = ActionContext.getContext().getValueStack();
    vs.push(new MapHolder(Collections.emptyMap()));
    ReflectionContextState.setCreatingNullObjects(vs.getContext(), false);
    assertNull(vs.findValue("map['key']"));
}
 
开发者ID:txazo,项目名称:struts2,代码行数:7,代码来源:XWorkMapPropertyAccessorTest.java


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