<%
var param = request.getParameter('code');
%>

<script>

       var editor = CodeMirror.fromTextArea(document.getElementById("codeinput"), {
        lineNumbers: true,
        matchBrackets: true,
        mode: "application/x-ejs",
        indentUnit: 4,
        indentWithTabs: true,
        enterMode: "keep",
        tabMode: "shift",
           extraKeys: {"Ctrl-Space": function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}}
      });

	  function htmlDecode(input){
      var e = document.createElement('div');
      e.innerHTML = input;
      return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
    }

    var dataset = '<%=escape(param)%>';
	editor.setValue(htmlDecode(unescape(dataset)));
		
	function populate() {
		var text = editor.getValue();
		alert(text);
		document.getElementById("cont").innerHTML = document.editor.getvalue();
	}

    </script>