My web application is written in Java (backend). It uses the Spring Framework.
Now when my Controller returns the model to frontend jsp, I want to obtain some values from it's Hashmap.
For this I use the libraries of JSTL and Expression Language.
<c:if test="${not empty model.ladungstraegerNummer}">
yadcf.exFilterColumn(oTable, [[3, ['
<c:out value="${model.ladungstraegerNummer}"/>
']]]);
</c:if>
First I check if the variable is empty (sometimes it is) and after that it is written into Javascript code (yadcf is a Filter extension on top of jQuery and Datatables).
The result of the c:out should look like this:
yadcf.exFilterColumn(oTable, [[3, ['WNC402']]]);
The apostrophes are important. My code output is:
yadcf.exFilterColumn(oTable, [[3, ['
WNC402
']]]);
Somehow Javascript doesn't accept this String.
I edited my question, because it was faulty. The c:out worked and the apostrophes we're at the right place. I think I had some whitspace in my String, so that the JS function could not use it.