我正在jsp中构建一个web应用程序。我有一个textarea程序员编写他的java代码,我想在textarea中突出显示Java代码。
到目前为止,我已经完成了:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="scripts/Javascript Libraries/jquery.snippet.js"></script>
<link rel="stylesheet" type="text/css" href="scripts/Javascript Libraries/jquery.snippet.css" />
<script>
$(document).ready(function(){
$("pre.javacode").snippet("java",{style:"blue"});
});
</script>
</head>
<form id="mypage" action="NewAction.jsp" method="GET">
<p>Please write in your main class name </p>
<input type="text" ng-model="codename" name="filename" value="Example" required>
<p><i>Please write your code here :</i></p>
<pre class="javacode">
<textarea id="codearea" name="jcode" rows="20" cols="100" spellcheck="false" autofocuts>
import java.io.*;
import java.util.*;
class {{codename}}
{
public static void main(String[]args)
{
}
}
</textarea>
</pre>
<br />
<b>stdin:</b>
<br />
<input type="text" name="arg" value="" >
<input type="submit" name="Submit" value="Submit" id="submitter" >
<input type="button" name="reset" value="Reset" onclick="location.reload(true);">
</form>
我得到的输出是:
需要一些关于语法高亮的指导。