com.opensymphony.xwork2.util.ValueStack.setValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(16.6k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中com.opensymphony.xwork2.util.ValueStack.setValue()方法的一些代码示例,展示了ValueStack.setValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ValueStack.setValue()方法的具体详情如下:
包路径:com.opensymphony.xwork2.util.ValueStack
类名称:ValueStack
方法名:setValue

ValueStack.setValue介绍

[英]Attempts to set a property on a bean in the stack with the given expression using the default search order.
[中]尝试使用默认的搜索顺序,使用给定的表达式在堆栈中的bean上设置属性。

代码示例

代码示例来源:origin: OneBusAway/onebusaway-application-modules

@Override
 public String intercept(ActionInvocation invocation) throws Exception {

  ValueStack stack = invocation.getStack();

  boolean forceRefresh = false;

  Object v = stack.findValue("refreshConfiguration");
  if (v != null)
   forceRefresh = Boolean.parseBoolean(v.toString());

  HttpServletRequest request = ServletActionContext.getRequest();
  Map<String, Object> configuration = _configurationService.getConfiguration(forceRefresh, request.getContextPath());

  stack.setValue("#configuration", configuration);

  return invocation.invoke();
 }
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doStartTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  ValueStack stack = this.getStack();
  try {
    List<HookPointElementContainer> containers = extractElements(request);
    if (containers.size()>0) {
      stack.getContext().put(this.getObjectName(), containers);
      stack.setValue("#attr['" + this.getObjectName() + "']", containers, false);
      return EVAL_BODY_INCLUDE;
    }
  } catch (Throwable t) {
    throw new JspException("Error detected ", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-core-engine

@Override
public int doStartTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  ValueStack stack = this.getStack();
  try {
    List<HookPointElementContainer> containers = extractElements(request);
    if (containers.size()>0) {
      stack.getContext().put(this.getObjectName(), containers);
      stack.setValue("#attr['" + this.getObjectName() + "']", containers, false);
      return EVAL_BODY_INCLUDE;
    }
  } catch (Throwable t) {
    throw new JspException("Error detected ", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-core-engine

@Override
public int doStartTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(request);
  List<PluginSubMenuContainer> containters = new ArrayList<PluginSubMenuContainer>();
  ValueStack stack = this.getStack();
  try {
    String[] beanNames =  wac.getBeanNamesForType(PluginSubMenuContainer.class);
    for (int i=0; i<beanNames.length; i++) {
      PluginSubMenuContainer container = (PluginSubMenuContainer) wac.getBean(beanNames[i]);
      containters.add(container);
    }
    if (containters.size()>0) {
      stack.getContext().put(this.getObjectName(), containters);
      stack.setValue("#attr['" + this.getObjectName() + "']", containters, false);
      return EVAL_BODY_INCLUDE;
    }
  } catch (Throwable t) {
    throw new JspException("Error creating the plugins menu list", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doStartTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  ValueStack stack = this.getStack();
  try {
    List<HookPointElementContainer> containers = extractElements(request);
    if (containers.size()>0) {
      stack.getContext().put(this.getObjectName(), containers);
      stack.setValue("#attr['" + this.getObjectName() + "']", containers, false);
      return EVAL_BODY_INCLUDE;
    }
  } catch (Throwable t) {
    throw new JspException("Error detected ", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doStartTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(request);
  List<PluginSubMenuContainer> containters = new ArrayList<PluginSubMenuContainer>();
  ValueStack stack = this.getStack();
  try {
    String[] beanNames =  wac.getBeanNamesForType(PluginSubMenuContainer.class);
    for (int i=0; i<beanNames.length; i++) {
      PluginSubMenuContainer container = (PluginSubMenuContainer) wac.getBean(beanNames[i]);
      containters.add(container);
    }
    if (containters.size()>0) {
      stack.getContext().put(this.getObjectName(), containters);
      stack.setValue("#attr['" + this.getObjectName() + "']", containters, false);
      return EVAL_BODY_INCLUDE;
    }
  } catch (Throwable t) {
    throw new JspException("Error creating the plugins menu list", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    UserConfigBean config = (UserConfigBean) request.getSession().getAttribute(MyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    if (null == config || !currentUser.getUsername().equals(config.getUsername())) {
      request.getSession().removeAttribute(MyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
      IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils.getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext);
      config = shortcutManager.getUserConfigBean(currentUser);
    }
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), config);
      stack.setValue("#attr['" + this.getVar() + "']", config, false);
    }
  } catch (Throwable t) {
    _logger.error("Error on doStartTag", t);
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    UserConfigBean config = (UserConfigBean) request.getSession().getAttribute(MyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    if (null == config || !currentUser.getUsername().equals(config.getUsername())) {
      request.getSession().removeAttribute(MyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
      IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils.getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext);
      config = shortcutManager.getUserConfigBean(currentUser);
    }
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), config);
      stack.setValue("#attr['" + this.getVar() + "']", config, false);
    }
  } catch (Throwable t) {
    _logger.error("Error on doStartTag", t);
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doStartTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(request);
  List<PluginSubMenuContainer> containters = new ArrayList<PluginSubMenuContainer>();
  ValueStack stack = this.getStack();
  try {
    String[] beanNames =  wac.getBeanNamesForType(PluginSubMenuContainer.class);
    for (int i=0; i<beanNames.length; i++) {
      PluginSubMenuContainer container = (PluginSubMenuContainer) wac.getBean(beanNames[i]);
      containters.add(container);
    }
    if (containters.size()>0) {
      stack.getContext().put(this.getObjectName(), containters);
      stack.setValue("#attr['" + this.getObjectName() + "']", containters, false);
      return EVAL_BODY_INCLUDE;
    }
  } catch (Throwable t) {
    throw new JspException("Error creating the plugins menu list", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    Date lastUpdate = loggerManager.lastUpdateDate(currentUser);
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), lastUpdate);
      stack.setValue("#attr['" + this.getVar() + "']", lastUpdate, false);
    }
  } catch (Throwable t) {
    _logger.error("Error on doStartTag", t);
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    Date lastUpdate = loggerManager.lastUpdateDate(currentUser);
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), lastUpdate);
      stack.setValue("#attr['" + this.getVar() + "']", lastUpdate, false);
    }
  } catch (Throwable t) {
    _logger.error("Error on doStartTag", t);
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    List<Integer> ids = loggerManager.getActivityStream(currentUser);
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), ids);
      stack.setValue("#attr['" + this.getVar() + "']", ids, false);
    }
  } catch (Throwable t) {
    _logger.error("Error on doStartTag", t);
    //ApsSystemUtils.logThrowable(t, this, "doStartTag");
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    List<Integer> ids = loggerManager.getActivityStream(currentUser);
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), ids);
      stack.setValue("#attr['" + this.getVar() + "']", ids, false);
    }
  } catch (Throwable t) {
    _logger.error("Error on doStartTag", t);
    //ApsSystemUtils.logThrowable(t, this, "doStartTag");
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: org.entando.entando/entando-core-engine

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    UserConfigBean config = (UserConfigBean) request.getSession().getAttribute(IMyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    if (null == config || !currentUser.getUsername().equals(config.getUsername())) {
      request.getSession().removeAttribute(IMyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
      IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils.getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext);
      config = shortcutManager.getUserConfigBean(currentUser);
    }
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), config);
      stack.setValue("#attr['" + this.getVar() + "']", config, false);
    }
  } catch (Throwable t) {
    ApsSystemUtils.logThrowable(t, this, "doStartTag");
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doStartTag() throws JspException {
  try {
    IPageActionHelper helper = this.getHelper(this.isOnline());
    ITreeNode root = this.getAllowedTreeRootNode(helper);
    ValueStack stack = this.getStack();
    stack.getContext().put(this.getVar(), root);
    stack.setValue("#attr['" + this.getVar() + "']", root, false);
  } catch (Throwable t) {
    _logger.error("error in doStartTag", t);
    throw new JspException("Error during tag initialization", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-core-engine

@Override
public int doEndTag() throws JspException {
  HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
  try {
    IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    List<Integer> ids = loggerManager.getActivityStream(currentUser);
    if (null != this.getVar()) {
      ValueStack stack = this.getStack();
      stack.getContext().put(this.getVar(), ids);
      stack.setValue("#attr['" + this.getVar() + "']", ids, false);
    }
  } catch (Throwable t) {
    ApsSystemUtils.logThrowable(t, this, "doStartTag");
    throw new JspException("Error on doStartTag", t);
  }
  return super.doEndTag();
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doStartTag() throws JspException {
  try {
    IPageActionHelper helper = this.getHelper(this.isOnline());
    ITreeNode root = this.getAllowedTreeRootNode(helper);
    ValueStack stack = this.getStack();
    stack.getContext().put(this.getVar(), root);
    stack.setValue("#attr['" + this.getVar() + "']", root, false);
  } catch (Throwable t) {
    _logger.error("error in doStartTag", t);
    throw new JspException("Error during tag initialization", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-admin-console

@Override
public int doStartTag() throws JspException {
  UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
  try {
    Object retval = null;
    IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils.getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext);
    List<Shortcut> myShortcuts = shortcutManager.getAllowedShortcuts(currentUser);
    if (this.getType().equalsIgnoreCase(TYPE_LIST_OBJECT)) {
      retval = (Object) myShortcuts;
    } else if (this.getType().equalsIgnoreCase(TYPE_LIST_ITEMS)) {
      retval = (Object) this.getAllowedShortcutSelectItems(myShortcuts, currentUser);
    } else {
      _logger.warn("Invalid param for attribute 'value'. Expected '{}' or '{}' but was {}", TYPE_LIST_ITEMS, TYPE_LIST_OBJECT, this.getType());
    }
    ValueStack stack = super.getStack();
    stack.getContext().put(this.getVar(), retval);
    stack.setValue("#attr['" + this.getVar() + "']", retval, false);
  } catch (Throwable t) {
    _logger.error("Error extracting shortcuts for user '{}'", currentUser.getUsername() , t);
    throw new JspException("Error extracting shortcuts", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: entando/entando-core

@Override
public int doStartTag() throws JspException {
  UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
  try {
    Object retval = null;
    IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils.getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext);
    List<Shortcut> myShortcuts = shortcutManager.getAllowedShortcuts(currentUser);
    if (this.getType().equalsIgnoreCase(TYPE_LIST_OBJECT)) {
      retval = (Object) myShortcuts;
    } else if (this.getType().equalsIgnoreCase(TYPE_LIST_ITEMS)) {
      retval = (Object) this.getAllowedShortcutSelectItems(myShortcuts, currentUser);
    } else {
      _logger.warn("Invalid param for attribute 'value'. Expected '{}' or '{}' but was {}", TYPE_LIST_ITEMS, TYPE_LIST_OBJECT, this.getType());
    }
    ValueStack stack = super.getStack();
    stack.getContext().put(this.getVar(), retval);
    stack.setValue("#attr['" + this.getVar() + "']", retval, false);
  } catch (Throwable t) {
    _logger.error("Error extracting shortcuts for user '{}'", currentUser.getUsername() , t);
    throw new JspException("Error extracting shortcuts", t);
  }
  return super.doStartTag();
}

代码示例来源:origin: org.entando.entando/entando-core-engine

compPagerVo.initPager(pagerVo);
  stack.getContext().put(this.getObjectName(), compPagerVo);
  stack.setValue("#attr['" + this.getObjectName() + "']", compPagerVo, false);
} catch (Throwable t) {
  ApsSystemUtils.logThrowable(t, this, "doStartTag");

相关文章