How to get resource from spring mvc controller to java script html?

I have got controller like this (Spring 5 mvc):

package com.hellokoding.springboot;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class HelloController {
    @RequestMapping("/hello")
    public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
        model.addAttribute("name", name);
        return "hello";
    }
}

And hello.jsp like this:

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hello</title>
</head>
<body>
    Hello ${name}
</body>
</html>

Everything is fine, but right now I would like to have this "${name}" not in HTML, but in Java Script. Something like:

<script language="javascript" type="text/javascript">
    var nameInJavaScript = ${name};
</script>

Generally the question is very simple is it possible to handle attribute from java spring controller in this case "name" into Java Script? I think that there is some possibility. Could someone tell me how to code it? This code resources has been taken from: https://hellokoding.com/spring-boot-hello-world-example-with-jsp/