Moved logic around

Added error messaging logic to JS
Moved Render header to JSP from JS