0

I am creating a Spring Boot 4 application and I would like to include the JqueryUI notification widget found here. The problem arises because the example HTML looks like this...

<div id="container">
    <div id="basic-template">
        <a class="ui-notify-cross ui-notify-close" href="#">x</a>
        <h1>#{title}</h1>
        <p id="textArea">#{text}</p>
    </div>
</div>

Of course Spring complains about the #{title} in the jsp

/WEB-INF/jsp/main.jsp (line: 10, column: 27) #{...} is not allowed in template text

I see this is a side effect of the old JSF stuff from this question here. Is there a way around this? Is it possible to include a file in src>main>resources>static>alert.html?

Community
  • 1
  • 1
Jackie
  • 21,969
  • 32
  • 147
  • 289
  • 2
    Try replacing the `#{title}` with `#{title}` and `#{text}` with `#{text}`. I don't think it's Spring that's causing it, BTW. – CodeChimp Jul 01 '14 at 20:03
  • Brilliant! Make a regular answer and you win :-) – Jackie Jul 01 '14 at 20:22
  • What do you think is causing it? I didn't think it was Spring per se but rather the version of the JSP library they use. – Jackie Jul 01 '14 at 20:23
  • 1
    I think it's the JSP compiler baulking because the `#{xxx}` syntax is a Facelets thing (I believe, could be wrong). So, the JSP compiler sees it and freaks out. At least, that is my theory. Escaping it makes it so the JSP compiler ignores it, or at least that was the theory. – CodeChimp Jul 01 '14 at 20:25
  • Yeah I kind of got that from the other posts. However, with such an easy answer I am surprised there isn't another question that I could find. Thanks for the very pragmatic answer! – Jackie Jul 01 '14 at 20:27

1 Answers1

0

Essentially (CodeChimp deserves credit) the answer to this one is to "trick" the JSP resolver. It doesn't see a # only the escaped "#" and allows for this widget to be embedded. However, when it is rendered by the browser (Client side no more JSP processing) it allows it to be rendered the way jquery needs it.

Jackie
  • 21,969
  • 32
  • 147
  • 289