Skip to content

Instantly share code, notes, and snippets.

@zeal7s
Last active November 6, 2016 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeal7s/f1a265a437c3e9f58d37f9cfc3e51186 to your computer and use it in GitHub Desktop.
Save zeal7s/f1a265a437c3e9f58d37f9cfc3e51186 to your computer and use it in GitHub Desktop.
///////////////IndexController.java/////////////////
@RequestMapping("/index")
public String index(Map<String, Object> map){
String json = "{\"year\": 2016}";
map.put("json", json);
return "index";
}
/////////////////////index.jsp/////////////////////////
<script type="text/javascript">
window.json = <%=request.getAttribute("json")%>;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment