6.5. 自定义AJAX请求参数

添加ajax:param用于自定义AJAX请求的参数

页面代码:

<w:textField jsvar="field">
  <ajax:action event="onchange" action="#{bean.action }">
   <ajax:param isJsExpression="true" name="fieldValue" value="field.getValue()"></ajax:param>
   <ajax:param isJsExpression="true" name="fieldOldValue" value="arguments[2]"></ajax:param>
   <ajax:param isJsExpression="false" name="otherParam" value="#{testBean.otherParam}"></ajax:param>
  </ajax:action>
</w:textField>

LiteBean代码:

public String getOtherParam(){
      return "otherParam";
}

public void action(FieldChangeEvent event) {
      System.out.println(event.getParamsMap().get("fieldValue"));
      System.out.println(event.getParamsMap().get("fieldOldValue"));
      System.out.println(event.getParamsMap().get("otherParam"));
}