File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes How to display source code in browser? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to display source code in browser?" Watch "How to display source code in browser?" New topic
Author

How to display source code in browser?

Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Well this question is repeated here in forum a lot of times but I have never got satisfactory reply. may be because I did not frame it properly. Lets try one more time. So here goes my question:

I want to show java, xml or whatever; source code in my jsp pages to user, means in the browser. I have seen in many blogs, jForum and now in coderanch that whenever we make use of code tags the code taking a very good formatting and style. Is there any open source libraries available to achieve this?

Waiting for a positive response.


My Blog SCJP 5 SCWCD 5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41823
    
  63
There's no secret to it - JForum (and numerous other sites) use the http://code.google.com/p/syntaxhighlighter/ library, which uses a combination of JavaScript and CSS to achieve its magic. If you examine the source code of a page that has a CODE tag you'll see it in action.


Ping & DNS - my free Android networking tools app
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Thanks Ulf. Let me try this also. Really happy to get a prompt reply as expected here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display source code in browser?