javax.faces.event.ActionEvent.getSource()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(157)

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

ActionEvent.getSource介绍

暂无

代码示例

代码示例来源:origin: org.springframework.webflow/org.springframework.faces

public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
  if (!JsfUtils.isFlowRequest()) {
    delegate.processAction(actionEvent);
    return;
  }
  FacesContext context = FacesContext.getCurrentInstance();
  ActionSource source = (ActionSource) actionEvent.getSource();
  String eventId = null;
  if (source.getAction() != null) {
    if (logger.isDebugEnabled()) {
      logger.debug("Invoking action " + source.getAction());
    }
    eventId = (String) source.getAction().invoke(context, null);
  }
  if (StringUtils.hasText(eventId)) {
    if (logger.isDebugEnabled()) {
      logger.debug("Event '" + eventId + "' detected");
    }
    if (source.isImmediate() || validateModel(context, eventId)) {
      context.getExternalContext().getRequestMap().put(JsfView.EVENT_KEY, eventId);
    }
  } else {
    logger.debug("No action event detected");
    context.getExternalContext().getRequestMap().remove(JsfView.EVENT_KEY);
  }
  // tells JSF lifecycle that rendering should now happen and any subsequent phases should be skipped
  // required in the case of this action listener firing immediately (immediate=true) before validation
  context.renderResponse();
}

代码示例来源:origin: spring-projects/spring-webflow

public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
  if (!JsfUtils.isFlowRequest()) {
    this.delegate.processAction(actionEvent);
    return;
  }
  FacesContext context = FacesContext.getCurrentInstance();
  ActionSource2 source = (ActionSource2) actionEvent.getSource();
  String eventId = null;
  if (source.getActionExpression() != null) {
    if (logger.isDebugEnabled()) {
      logger.debug("Invoking action " + source.getActionExpression());
    }
    eventId = (String) source.getActionExpression().invoke(context.getELContext(), null);
  }
  if (StringUtils.hasText(eventId)) {
    if (logger.isDebugEnabled()) {
      logger.debug("Event '" + eventId + "' detected");
    }
    if (source.isImmediate() || validateModel(context, eventId)) {
      context.getExternalContext().getRequestMap().put(JsfView.EVENT_KEY, eventId);
    }
  } else {
    logger.debug("No action event detected");
    context.getExternalContext().getRequestMap().remove(JsfView.EVENT_KEY);
  }
  // tells JSF lifecycle that rendering should now happen and any subsequent phases should be skipped
  // required in the case of this action listener firing immediately (immediate=true) before validation
  context.renderResponse();
}

代码示例来源:origin: org.springframework.webflow/spring-faces

public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
  if (!JsfUtils.isFlowRequest()) {
    this.delegate.processAction(actionEvent);
    return;
  }
  FacesContext context = FacesContext.getCurrentInstance();
  ActionSource2 source = (ActionSource2) actionEvent.getSource();
  String eventId = null;
  if (source.getActionExpression() != null) {
    if (logger.isDebugEnabled()) {
      logger.debug("Invoking action " + source.getActionExpression());
    }
    eventId = (String) source.getActionExpression().invoke(context.getELContext(), null);
  }
  if (StringUtils.hasText(eventId)) {
    if (logger.isDebugEnabled()) {
      logger.debug("Event '" + eventId + "' detected");
    }
    if (source.isImmediate() || validateModel(context, eventId)) {
      context.getExternalContext().getRequestMap().put(JsfView.EVENT_KEY, eventId);
    }
  } else {
    logger.debug("No action event detected");
    context.getExternalContext().getRequestMap().remove(JsfView.EVENT_KEY);
  }
  // tells JSF lifecycle that rendering should now happen and any subsequent phases should be skipped
  // required in the case of this action listener firing immediately (immediate=true) before validation
  context.renderResponse();
}

代码示例来源:origin: com.sun.jsftemplating/jsftemplating

UIComponent command = (UIComponent) event.getSource();
if (command == null) {
  throw new IllegalArgumentException(

相关文章