jreijn / spring-comparing-template-engines

Demo project to show different Java templating engines in combination with Spring MVC
Apache License 2.0
422 stars 116 forks source link

JSP context path with c:url #17

Closed eleumik closed 5 years ago

eleumik commented 8 years ago

Hi, I saw that context path has been added to all engines, great work !

one thing: I believe the standard way to provide context path in JSP is using c:url tag while now the template uses strings concatenation. So for example instead of

   <link rel="stylesheet" href="${root}/webjars/bootstrap/3.0.1/css/bootstrap.min.css" media="screen">

the code would be:

   <link rel="stylesheet" href="<c:url value='/webjars/bootstrap/3.0.1/css/bootstrap.min.css'/>" media="screen">

or, if HTML escaping is needed (normally should be done, but not sure what happens in other templates/tests):

  <c:url var='linkUrl' value='/webjars/bootstrap/3.0.1/css/bootstrap.min.css'/>
  <link rel="stylesheet" href="<c:out value='${linkUrl}'/>" media="screen">

BTW any change in performance after the "context path" change ? Thanks, Bye

Vest commented 5 years ago

I have resolved the issue with PR #39 I measured performance, but didn't find any significant difference. The test results vary between restarts. Second more, second less.