Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dreamweaver + Grails

Has anybody tried doing GSP design with Adobe Dreamweaver CS4? It has support for JSPs, but it doesn't recognize the gsp extension, and even if it did I think there would be problems regarding the gsp tags that it would not recognize. I found a little cookbook here (http://www.bitwalker.nl/blog/using-groovyserver-pages-in-dreamweaver) for getting GSPs partially working with Dreamweaver CS3, but many of the files and directories it references no longer appear to exist in CS4.

like image 796
Chris King Avatar asked Jan 03 '09 00:01

Chris King


1 Answers

I think I got it working for CS5 after messing around for a while. Steps you need to do are similar to the article mentioned above, but with slight changes for Dreamweaver CS5. So five steps to go through and please make a test after each step to make sure you are on the right path.

  1. Add *.gsp file extension to Open Dialog. Edit %APPDATA%\Adobe\Dreamweaver CS5\en_US\Configuration\Extensions.txt to add "GSP:Groovy Server Pages" (no quotes) to the bottom of the file, as well as GSP extension to the first line just before :All Documents. Now restart Dreamweaver CS5 and test if File > Open... dialog has GSP extension in the list.
  2. Now we need to add correct document type so Dreamweaver CS5 knows about GSP. Edit %DreamweaverInstallationDirectory%\configuration\DocumentTypes\MMDocumentTypes.xml to add the following document type as the last node.

    <documenttype id="GSP" servermodel="JSP" internaltype="Dynamic" winfileextension="gsp" macfileextension="gsp" file="Default.gsp" writebyteordermark="false" mimetype="text/html"> <TITLE>GSP</TITLE> <description>Groovy Server Pages (GSP) document</description> <dtdcontext>html</dtdcontext> </documenttype>

If you want to provide Title and Description as localized strings refer to this article.

  1. Create template for new document. Copy %DreamweaverInstallationDirectory%\configuration\DocumentTypes\NewDocuments\Default.jsp to Default.gsp, edit it to remove first line. (You can edit this file as you like as it acts as a template for newly created file). Now restart Dreamweaver CS5 and test if File > New... dialog has GSP Page Type with your description in place. Test new file creation.
  2. Setup GSP tag library. Download and unpack GspTagLibrary for Dreamweaver. Copy GSP folder with lots of *.vtm files into %DreamweaverInstallationDirectory%\configuration\TagLibraries. Edit %APPDATA%\Adobe\Dreamweaver CS5\en_US\Configuration\TagLibraries\TagLibraries.vtm to add content of gspTagLibrary.vtm as a last node. Replace first line with the following:

    <taglibrary name="GSP tags" doctypes="GSP" id="DWTagLibrary_GSP" prefix="&lt;g:">

Also add GSP into doctypes of <taglibrary> with id="DWTagLibrary_html" (should be very first node). Do the same changes for %DreamweaverInstallationDirectory%\configuration\TagLibraries\TagLibraries.vtm just in case. Restart Dreamweaver CS5 and make sure you can see GSP tags library in Edit > Tag Libraries... with correct Tag prefix (g:). Check if the 'Used in: GSP' checkbox is ticked for 'GSP tags' and 'HTML tags'.

  1. And as the last step we have to enable code coloring. Edit %APPDATA%\Adobe\Dreamweaver CS5\en_US\Configuration\CodeColoring\CodeColoring.xml to search & replace ',JSP,' with ',JSP,GSP,' (no quotes and pay attention to commas). Also find the line <sampleText doctypes="JSP"> and add GSP doctype there, like <sampleText doctypes="JSP,GSP"> (if you really want to you can create your own GSP code sample the same way as the JSP's one). Do same changes in %DreamweaverInstallationDirectory%\configuration\CodeColoring\CodeColoring.xml just in case.

Restart Dreamweaver CS5 and test if Edit > Preferences... > Code Coloring has GSP document type. Click 'Edit Coloring Scheme' to test if Preview has the code sample with code coloring as well as GSP tags mentioned in 'Styles for' list. And finally open up any of GSP files and check if it has code coloring for HTML, CSS, JavaScript and GSP tags.

That's it! Hope this helps to someone! And thanks to Harald Walker for the article I based my research on.

like image 191
igor Avatar answered Sep 18 '22 21:09

igor