0

I am looking some good Sql Syntax highlighter which will easily integrated with Component based(JSF,ZK ) framework. Any idea which will be best for me i tried Codeirror but binding is not working. Any one suggest some other which will easily integrated. I do not want to open output in JFrame or Applet its should be in Browser

Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202
  • 1
    This is what stackoverflow uses. http://google-code-prettify.googlecode.com/svn/trunk/README.html – Sorter Oct 29 '13 at 06:16
  • @Deepak how you will do Binding here? – Subodh Joshi Oct 29 '13 at 06:33
  • Include the script in your html and use pre tags. Here's the sql example.http://google-code-prettify.googlecode.com/svn/trunk/tests/prettify_test.html#sql_lang – Sorter Oct 29 '13 at 06:36
  • I got it but how would we bind the values? Mean which we would written in betwwen those tag i have t save into Database – Subodh Joshi Oct 29 '13 at 06:37
  • you can print the value inside the pre tag with jsp or servlet or whatever serverside language you are using. Jquery is another alternative to append inside the pre tag. – Sorter Oct 29 '13 at 06:39

1 Answers1

1

Using prettify is a good solution, but this is a JavaScript library working client-side in the browser.

If you want to send your source code (java, sql, python, bash, html, xml, css, javascript...) prepared server-side as HTML code with span tags to color the text (i.e. syntax highligthing) in pure Java, you can use java-prettify. This is a port of the Javascript lib in java.

I have explained how you can use the parser to produce highligthed HTML code here: use the parser to create HTML. Have a look at the code in the java class PrettifyToHtml and at the example.

Jmini
  • 9,189
  • 2
  • 55
  • 77
  • @Jmni Ok let us suppose i will go with this so i have to write Java classes as well or Just put jar and call some method it will work? – Subodh Joshi Nov 13 '13 at 04:33
  • You need the JavaPrettify-1.2.1.jar and the methods I have written in the attached PrettifyToHtml.java – Jmini Nov 14 '13 at 09:15