OWASP O2 Platform Blog

Simple Viewer to see JSP files (example using Spring MVC SPetStore)

Here is a simple script that creates a simple viewer for JSP files (note that this version doesn’t support the mapping of internal includes (the next version will))

This tool is available as the Util – View JSPs (simple mode).h2 script and looks like this:

and (note the need to map the include files)

Here is the source code:

//var topPanel = panel.clear().add_Panel();
var topPanel = "Util - View JSPs (simple mode)".popupWindow(1000,300);
var sourceCodeEditor = topPanel.add_SourceCodeEditor();
var treeView = sourceCodeEditor.insert_Left<Panel>(400).add_TreeView().sort();
treeView.afterSelect<string>((file)=>sourceCodeEditor.open(file).setDocumentHighlightingStrategy(".html"));
Action<string,string> loadFilesFromFolder =
    (folder,extension)=>{
                            treeView.clear();
                            foreach(var file in folder.files(extension,true))
                                treeView.add_Node(file.remove(folder),file);
                            treeView.selectFirst();    
                        };</pre>
 

var testFolderWithJsps = @"C:\O2\Demos\jPetStore - O2 Demo Pack\sourceCode\war";                        
topPanel.insert_Above(20)
        .add_TextBox("Path to JSPs",testFolderWithJsps)
        .onEnter((text)=> loadFilesFromFolder(text , "*.jsp"));
                       
loadFilesFromFolder(testFolderWithJsps , "*.jsp");

 

 

July 18, 2011 - Posted by | JPetStore, Spring MVC

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: