protected String innerGetText(String key) {
    if (key == null) return "";
    Set<String> checked = new HashSet<String>(5);
    // search up class hierarchy
    String msg = findMessage(clazz, key, checked);
    if (msg != null) return msg;

    if (EntityDrivenAction.class.isAssignableFrom(clazz)) {
      ActionContext context = ActionContext.getContext();
      // search up model's class hierarchy
      ActionInvocation actionInvocation = context.getActionInvocation();
      // ActionInvocation may be null if we're being run from a Sitemesh filter
      if (actionInvocation != null) {
        Object action = actionInvocation.getAction();
        if (action instanceof EntityDrivenAction) {
          String entityName = ((EntityDrivenAction) action).getEntityName();
          if (entityName != null) {
            msg = findPackageMessage(entityName, key, checked);
            if (msg != null) return msg;
          }
        }
      }
    }

    // see if it's a child property
    int idx = key.indexOf(".");
    if (idx > 0) {
      String prop = key.substring(0, idx);
      Object obj = valueStack.findValue(prop);
      if (null != obj && !prop.equals("action")) {
        Class<?> aClass = obj.getClass();
        String newKey = key;
        while (null != aClass) {
          msg = findMessage(aClass, newKey, new HashSet<String>());
          if (null == msg) {
            int nextIdx = newKey.indexOf(".", idx + 1);
            if (nextIdx == -1) break;
            prop = newKey.substring(idx + 1, nextIdx);
            newKey = newKey.substring(idx + 1);
            idx = nextIdx;
            if (Strings.isNotEmpty(prop)) aClass = PropertyUtils.getPropertyType(aClass, prop);
            else aClass = null;
          } else {
            return msg;
          }
        }
      }
    }
    return registry.getDefaultText(key, locale);
  }
protected String innerGetText ( String key ) { if ( key == null ) return "" ; Set < String > checked = new HashSet < String > ( 5 ) ; String msg = findMessage ( clazz , key , checked ) ; if ( msg != null ) return msg ; if ( EntityDrivenAction . class . isAssignableFrom ( clazz ) ) { ActionContext context = ActionContext . getContext ( ) ; ActionInvocation actionInvocation = context . getActionInvocation ( ) ; if ( actionInvocation != null ) { Object action = actionInvocation . getAction ( ) ; if ( action instanceof EntityDrivenAction ) { String entityName = ( ( EntityDrivenAction ) action ) . getEntityName ( ) ; if ( entityName != null ) { msg = findPackageMessage ( entityName , key , checked ) ; if ( msg != null ) return msg ; } } } } int idx = key . indexOf ( "." ) ; if ( idx > 0 ) { String prop = key . substring ( 0 , idx ) ; Object obj = valueStack . findValue ( prop ) ; if ( null != obj && ! prop . equals ( "action" ) ) { Class < ? > aClass = obj . getClass ( ) ; String newKey = key ; while ( null != aClass ) { msg = findMessage ( aClass , newKey , new HashSet < String > ( ) ) ; if ( null == msg ) { int nextIdx = newKey . indexOf ( "." , idx + 1 ) ; if ( nextIdx == - 1 ) break ; prop = newKey . substring ( idx + 1 , nextIdx ) ; newKey = newKey . substring ( idx + 1 ) ; idx = nextIdx ; if ( Strings . isNotEmpty ( prop ) ) aClass = PropertyUtils . getPropertyType ( aClass , prop ) ; else aClass = null ; } else { return msg ; } } } } return registry . getDefaultText ( key , locale ) ; }
1 remove index key(user.roles[0].name etc.)
2 change ModelDriven to EntitySupport