가 host.machine == 1 다음 조치 = 설정 다른 조치 = I는 다음과 같은 출력을 원하는I가 통합 할리스트의
을 만들면 IF-다른리스트 (범위) 프리 마커 Type:Machine;Action:Set;Attributes[Name:machine1~NodeManager.ListenAddress:10.104.17.70~NodeManager.ListenPort:5558]<BR> Type:Machine;Action:Create;Attributes[Name:machine2~NodeManager.ListenAddress:10.104.17.71~NodeManager.ListenPort:5558]<BR>
내 데이터
hosts:[{"name": "trfuoemlpa004v", "node": 0, "server": 1, "Machine": 1, "ManagedPort": "7002", "SSLPort": 1081}, {"name": "trfuoemlpa007v", "node": 1, "server": 2, "Machine": 2, "ManagedPort": "7002", "SSLPort": 1081}]
내가 다른 템플릿을 만든 모든 실패
1) <#list hosts as host><#assign machine=${host.machine}><#if machine == 1><#assign action="Set"><#else><#assign action="Create"></#if>Type:Machine;Action:${action};Attributes[Name:${host.machine}~NodeManager.ListenAddress:${host.name}~NodeManager.ListenPort:${nodeManagerPort}]<BR></#list>
**freemarker.core.ParseException: Encountered "}" at line 8, column 40 in J2EE.properties. Was expecting one of:">" ... "." ... "[" ... "(" ... "?" ... "!" ... <TERMINATING_EXCLAM> ... "??" ... "+" ...**
2) <#list hosts as host><#if host.machine == 1><#assign action="Set"><#else><#assign action="Create"></#if>Type:Machine;Action:${action};Attributes[Name:${host.machine}~NodeManager.ListenAddress:${host.name}~NodeManager.ListenPort:${nodeManagerPort}]<BR></#list>
**freemarker.core.InvalidReferenceException: Expression host.machine is undefined**
3) <#list hosts as host><#if $host.machine} == 1 > ...
**freemarker.core.ParseException: Encountered "}" at line 8, column 40 in J2EE.properties. Was expecting one of:">" ... "." ... "[" ... "(" ... "?" ... "!" ... <TERMINATING_EXCLAM> ... "??" ... "+" ...**
오른쪽. 잘못된 경우 (기계/기계) 때문이었습니다. 유형 : 기계; 작업 : <# if host.Machine == 1> 집합 <#else>#if>을 작성하십시오. – ReneHH