Java
  Home arrow Java arrow Page 2 - Using Sun Java Studio Creator with SVG
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Using Sun Java Studio Creator with SVG
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2007-03-05

    Table of Contents:
  • Using Sun Java Studio Creator with SVG
  • Adding a JSP or HTML page
  • SVG files used in this tutorial
  • Embedding into a JSP page

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Sun Java Studio Creator with SVG - Adding a JSP or HTML page


    (Page 2 of 4 )

    Highlight the Web Pages folder of the project, in this case DisplaySvg. From the File menu drop-down, choose New Item.... The New item window opens where you can add a Page, an Html file, a PageFragment, and so on.

    You may also right click the Project and the drop-down and create the same items. Click next and you will provide a name for the file. In this case an AddSvg.jsp was added as shown. Similarly an HTML file named DSvg.html was also added (see the fourth picture down from here for the directory structure). Now we need to embed a SVG file in this JSP, for which we need to add a SVG file to the project.

    Adding SVG content to the project

    The SVG content can be added to a JSP page or an HTML file. In either case you need to bring the SVG file into your project.

    For lack of documentation it is assumed that the SVG file is a resource file. Highlight the resources folder, which is a sub-folder of Web Pages, and right click. From the drop-down click on New as shown in the next picture.

    This opens a menu where you can choose several items, but you cannot recognize any which could be an SVG file. Trying to add an Empty File..., then trying to fill it up with the SVG file contents, and then trying to save it with an SVG extension will not work because the Empty file does not allow renaming of the extension. Choose the File/Folder... hyperlink and click. This opens up the next window, New File, again. When you click on Resources you do not see an SVG option either, as you can see here.

    The work around to bring the file into the project is as follows:

    Highlight the resources folder, and from the File menu item click on Add Existing Item, which shows a drop-down. Here choose Other (all files)... and click. 

    This  opens up the My Documents folder on your C: drive. Here you can locate your SVG file and click on Add. This adds the file to the Source Packages folder as shown in the next picture.

    However, you cannot point a src reference to this folder when you embed the file in either HTML or a JSP page (the program throws an exception). You can however drag this file from the Sources Packages-->dispalySVG package to the resources folder. Two SVG files, circles.svg and Unicode.svg, which were added in this manner, are shown in the next picture.

    More Java Articles
    More By Jayaram Krishnaswamy


       · SVG is really cool when it comes to web graphics. You may want to check out this...
       · I was looking for such a component to be able to embed SVG graphics in afaces page...
       · Thanks for the article. I am quite excited about it. I use inkscape which saves...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT