Reputation: 10254
I'm building some HTML in JavaScript to be passed back to a JSP and I was doing this:
var html = "<td id='comment-" + comment.id + "'class='wrappable' style='width:400px;'>"
+ "<pre style='width: auto;'>" + comment.comment + "</pre></td>";
But I found some JSP tag to use as an alternative to using <pre>
to solve my newLine problem:
var html = "<td id='comment-" + comment.id + "'class='wrappable' style='width:400px;'>"
+ "<ctl:breakNewline target='" + comment.comment + "'/></td>";
But it doesn't seem to work. How is this caused and how can I solve this properly?
Upvotes: 1
Views: 1347
Reputation: 18034
Without ever having used JSP or JSTL I'm going to take a wild guess at this and say: No.
As far as i know, JSP is server-side only, and unless you're running this html generating code on the server (rather than in browser/client-side), with some javascript parser on the server before passing it to the JSP parser, this will not work.
Upvotes: 2
Reputation: 299048
JSP is evaluates on the server, JavaScript on the client. No, this can't work.
(Of course you can use JSTL to create your entire JavaScript code, but you can't call JSP code from javaScript)
Upvotes: 5