简体   繁体   中英

Pass Html code from Controller to JSP

I want to pass html data from Controller to JSP.

I am using Spring MVC and 'Spring Validator' populates messages on the JSP:

@Override
    public void validate(Object target, Errors errors) {
//Some processing     
errors.rejectValue("fileData", "errors.csi.invalidurl", new Object[] { url }, null);
}

message.properties

errors.csi.invalidurl=File contained invalid URLs. Please find list of invalid URLs <a href="{0}"> here</a>.

Corresponding JSP is:

<div class="row">
<label for="upload-file"><spring:message code="csi.label.uploadfile"/></label><form:input path="fileData" type="file"/>
<form:errors path="fileData" cssClass="error"/>
</div>

I am able to pass text data but unable to pass href links. How could it be done?

I tried

String url = "javascript:getImageValidationPresignedURLForDownload('8162')"; to be passed as text data but it is displayed as text.

URLs <a href="javascript:getImageValidationPresignedURLForDownload('8162')"> here</a>.

What am I doing wrong? How could it be done?

Thanks,

试试看

<form:errors path="fileData" cssClass="error" htmlEscape="false" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM