Skip to content

Commit 72a8868

Browse files
committed
FreeMarker macros based on HTML output format (requires FreeMarker 2.3.24+)
Issue: SPR-14740
1 parent a0cea9a commit 72a8868

File tree

1 file changed

+13
-13
lines changed
  • spring-webmvc/src/main/resources/org/springframework/web/servlet/view/freemarker

1 file changed

+13
-13
lines changed

spring-webmvc/src/main/resources/org/springframework/web/servlet/view/freemarker/spring.ftl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#ftl strip_whitespace=true>
1+
<#ftl output_format="HTML" strip_whitespace=true>
22
<#--
33
* spring.ftl
44
*
@@ -157,7 +157,7 @@
157157
-->
158158
<#macro formInput path attributes="" fieldType="text">
159159
<@bind path/>
160-
<input type="${fieldType}" id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" value="<#if fieldType!="password">${stringStatusValue}</#if>" ${attributes}<@closeTag/>
160+
<input type="${fieldType}" id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" value="<#if fieldType!="password">${stringStatusValue}</#if>" ${attributes?no_esc}<@closeTag/>
161161
</#macro>
162162

163163
<#--
@@ -202,7 +202,7 @@
202202
-->
203203
<#macro formTextarea path attributes="">
204204
<@bind path/>
205-
<textarea id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" ${attributes}>
205+
<textarea id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" ${attributes?no_esc}>
206206
${stringStatusValue}</textarea>
207207
</#macro>
208208

@@ -219,14 +219,14 @@ ${stringStatusValue}</textarea>
219219
-->
220220
<#macro formSingleSelect path options attributes="">
221221
<@bind path/>
222-
<select id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" ${attributes}>
222+
<select id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" ${attributes?no_esc}>
223223
<#if options?is_hash>
224224
<#list options?keys as value>
225-
<option value="${value?html}"<@checkSelected value/>>${options[value]?html}</option>
225+
<option value="${value}"<@checkSelected value/>>${options[value]}</option>
226226
</#list>
227227
<#else>
228228
<#list options as value>
229-
<option value="${value?html}"<@checkSelected value/>>${value?html}</option>
229+
<option value="${value}"<@checkSelected value/>>${value}</option>
230230
</#list>
231231
</#if>
232232
</select>
@@ -245,10 +245,10 @@ ${stringStatusValue}</textarea>
245245
-->
246246
<#macro formMultiSelect path options attributes="">
247247
<@bind path/>
248-
<select multiple="multiple" id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" ${attributes}>
248+
<select multiple="multiple" id="${status.expression?replace('[','')?replace(']','')}" name="${status.expression}" ${attributes?no_esc}>
249249
<#list options?keys as value>
250250
<#assign isSelected = contains(status.actualValue?default([""]), value)>
251-
<option value="${value?html}"<#if isSelected> selected="selected"</#if>>${options[value]?html}</option>
251+
<option value="${value}"<#if isSelected> selected="selected"</#if>>${options[value]}</option>
252252
</#list>
253253
</select>
254254
</#macro>
@@ -269,8 +269,8 @@ ${stringStatusValue}</textarea>
269269
<@bind path/>
270270
<#list options?keys as value>
271271
<#assign id="${status.expression?replace('[','')?replace(']','')}${value_index}">
272-
<input type="radio" id="${id}" name="${status.expression}" value="${value?html}"<#if stringStatusValue == value> checked="checked"</#if> ${attributes}<@closeTag/>
273-
<label for="${id}">${options[value]?html}</label>${separator}
272+
<input type="radio" id="${id}" name="${status.expression}" value="${value}"<#if stringStatusValue == value> checked="checked"</#if> ${attributes?no_esc}<@closeTag/>
273+
<label for="${id}">${options[value]}</label>${separator}
274274
</#list>
275275
</#macro>
276276

@@ -291,8 +291,8 @@ ${stringStatusValue}</textarea>
291291
<#list options?keys as value>
292292
<#assign id="${status.expression?replace('[','')?replace(']','')}${value_index}">
293293
<#assign isSelected = contains(status.actualValue?default([""]), value)>
294-
<input type="checkbox" id="${id}" name="${status.expression}" value="${value?html}"<#if isSelected> checked="checked"</#if> ${attributes}<@closeTag/>
295-
<label for="${id}">${options[value]?html}</label>${separator}
294+
<input type="checkbox" id="${id}" name="${status.expression}" value="${value}"<#if isSelected> checked="checked"</#if> ${attributes?no_esc}<@closeTag/>
295+
<label for="${id}">${options[value]}</label>${separator}
296296
</#list>
297297
<input type="hidden" name="_${status.expression}" value="on"/>
298298
</#macro>
@@ -311,7 +311,7 @@ ${stringStatusValue}</textarea>
311311
<#assign id="${status.expression?replace('[','')?replace(']','')}">
312312
<#assign isSelected = status.value?? && status.value?string=="true">
313313
<input type="hidden" name="_${status.expression}" value="on"/>
314-
<input type="checkbox" id="${id}" name="${status.expression}"<#if isSelected> checked="checked"</#if> ${attributes}/>
314+
<input type="checkbox" id="${id}" name="${status.expression}"<#if isSelected> checked="checked"</#if> ${attributes?no_esc}/>
315315
</#macro>
316316

317317
<#--

0 commit comments

Comments
 (0)