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


Java VariableMapper.setVariable方法代码示例

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


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

示例1: doStartTagInternal

import javax.el.VariableMapper; //导入方法依赖的package包/类
@Override
protected int doStartTagInternal() throws Exception {
	CodeManager codeManager = getCodeManager();
	T object = getObject(codeManager, codeName, value, plainLabel);
	if (StringUtils.isNotEmpty(var)) {
		VariableMapper vm = pageContext.getELContext().getVariableMapper();
		if (vm != null) {
			vm.setVariable(var, null);
		}
		pageContext.setAttribute(var, object, PageContext.PAGE_SCOPE);
	}
	if (doesEvalBody(codeManager, codeName, value, plainLabel)) {
		return EVAL_BODY_INCLUDE;
	} else {
		return SKIP_BODY;
	}
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:18,代码来源:CodeTagSupport.java

示例2: _restoreContextVariables

import javax.el.VariableMapper; //导入方法依赖的package包/类
/**
 * Restore the variables backed up in the {@link #_backupContextVariables(VariableMapper)}
 * function.
 * @param vm the current variable mapper
 */
private void _restoreContextVariables(VariableMapper vm)
{
  if (_var != null)
  {
    vm.setVariable(_var, _previousVarExpression);
    pageContext.setAttribute(_var, _previousPageContextVarValue);
  }

  if (_varStatus != null)
  {
    vm.setVariable(_varStatus, _previousVarStatusExpression);
    pageContext.setAttribute(_varStatus, _previousPageContextVarStatusValue);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:ForEachTag.java

示例3: _updateVars

import javax.el.VariableMapper; //导入方法依赖的package包/类
/**
 * Sets up the variable mapper, exposing the var and the iteration status data to EL.
 * @param vm the variable mapper to modify
 */
private void _updateVars(
  VariableMapper vm)
{
  if (_var != null)
  {
    if (_items != null)
    {
      // Expose the var to the user. The key is used instead of the index so that changes to the
      // order of items in the collection will not cause the value expression to get out of sync
      // with the collection resulting in corruputed component state. This expression will be
      // used inside the variable mapper that is stored in each value expression that is created
      // by JSP when components in the body of the for each tag are created.
      KeyedValueExpression keyExpr = new KeyedValueExpression(_items,
        _currentIterationStatus.getKey());
      vm.setVariable(_var, keyExpr);
    }

    if (_itemsWrapper != null)
    {
      // Put the item onto the page context
      Object item = _itemsWrapper.getValue(_currentIterationStatus.getIndex());
      pageContext.setAttribute(_var, item);
    }
  }

  if (_varStatus != null)
  {
    // Store a new var status value expression into the variable mapper
    vm.setVariable(_varStatus, new VarStatusValueExpression(
      _iterationUtils.getCurrentIterationId()));

    // Put the value onto the page context
    pageContext.setAttribute(_varStatus, _currentIterationStatus);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:40,代码来源:ForEachTag.java

示例4: populateAttributes

import javax.el.VariableMapper; //导入方法依赖的package包/类
protected void populateAttributes(String scopeObjectName, Enumeration<String> attributes,
		ExpressionFactory expressionFactory, VariableMapper variables, Function<String, Object> l) {
	Map<String, Object> scopeObject = new HashMap<>();
	while (attributes.hasMoreElements()) {
		String attribute = attributes.nextElement();
		Object value = l.apply(attribute);
		if (value != null) {
			variables.setVariable(attribute, expressionFactory.createValueExpression(value, value.getClass()));
			scopeObject.put(attribute, value);
		}
	}
	variables.setVariable(scopeObjectName, expressionFactory.createValueExpression(scopeObject, scopeObject.getClass()));
}
 
开发者ID:ggeorgovassilis,项目名称:fauxjsp,代码行数:14,代码来源:ELEvaluationImpl.java

示例5: doStartTagInternal

import javax.el.VariableMapper; //导入方法依赖的package包/类
@Override
protected int doStartTagInternal() throws JspException {
	Object bean = getBean(getRequestContext().getWebApplicationContext(), beanName, beanType);
	VariableMapper vm = pageContext.getELContext().getVariableMapper();
	if (vm != null) {
		vm.setVariable(var, null);
	}
	pageContext.setAttribute(var, bean, PageContext.PAGE_SCOPE);
	return SKIP_BODY;
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:11,代码来源:GetBeanTag.java

示例6: populateVariables

import javax.el.VariableMapper; //导入方法依赖的package包/类
protected void populateVariables(ELContext context, ExpressionFactory expressionFactory, RenderSession session) {
	VariableMapper variables = context.getVariableMapper();
	variables.setVariable("request",
			expressionFactory.createValueExpression(session.request, HttpServletRequest.class));
	variables.setVariable("response",
			expressionFactory.createValueExpression(session.response, HttpServletResponse.class));
	// TODO: set output stream and writer
	// variables.setVariable(
	// "out",
	// expressionFactory.createValueExpression(
	// session.response.getWriter(), PrintWriter.class));
	HttpSession httpSession = session.request.getSession(false);
	if (httpSession != null)
		variables.setVariable("session", expressionFactory.createValueExpression(httpSession, HttpSession.class));

	variables.setVariable("application",
			expressionFactory.createValueExpression(session.request.getServletContext(), ServletContext.class));

	JspPageContextImpl pageContext = new JspPageContextImpl();
	try {
		pageContext.initialize(session.servlet, session.request, session.response, null, false, 0, false);
		variables.setVariable("pageContext",
				expressionFactory.createValueExpression(pageContext, JspPageContextImpl.class));
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	// TODO: check that servletConfig is spelled correctly
	variables.setVariable("servletConfig",
			expressionFactory.createValueExpression(session.servlet.getServletConfig(), ServletConfig.class));
	// TODO: set page page attribute
	// TODO: set exception page attribute

	populateAttributes("contextScope", session.request.getServletContext().getAttributeNames(), expressionFactory,
			variables, (attr) -> session.request.getServletContext().getAttribute(attr));
	if (session.request.getSession() != null)
		populateAttributes("sessionScope", session.request.getSession().getAttributeNames(), expressionFactory,
				variables, (attr) -> session.request.getSession().getAttribute(attr));
	populateAttributes("requestScope", session.request.getAttributeNames(), expressionFactory, variables,
			(attr) -> session.request.getAttribute(attr));
	populateAttributes("applicationScope", Collections.emptyEnumeration(), expressionFactory, variables,
			null);
}
 
开发者ID:ggeorgovassilis,项目名称:fauxjsp,代码行数:43,代码来源:ELEvaluationImpl.java


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