Java
  Home arrow Java arrow Page 4 - 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 
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 - Embedding into a JSP page


    (Page 4 of 4 )

    Embedding SVG files works in the same way as embedding in an HTML page. The next paragraph shows the source code of the AddSvg.jsp page with embedded circles.svg.

    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:jsp="http://java.sun.com/JSP/Page" 
    xmlns:ui=
    "http://www.sun.com/web/ui"><jsp:directive.pagecontentType=
    "text/html;charset=UTF-8" pageEncoding="UTF-8"/> <f:view> <ui:page binding="#{AddSvg.page1}" id="page1"> <ui:html binding="#{AddSvg.html1}" id="html1"> <ui:head binding="#{AddSvg.head1}" id="head1"> <ui:link binding="#{AddSvg.link1}" id="link1" url="/resources/stylesheet.css"/> </ui:head> <ui:body binding="#{AddSvg.body1}" id="body1" focus="" style="-rave-layout: grid"> <ui:form binding="#{AddSvg.form1}" id="form1"/> </ui:body> </ui:html> </ui:page> </f:view> <embed src="resources/circles.svg" width="400" height="400" type="image/svg+xml"/> </jsp:root>

    The page which gets rendered appears as follows:

    Embedding into HTML

    The source code for this page, DSvg.html, is as follows;

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title></title>
    </head>
    <body> <embed src="resourcesUnicode.svg" 
    width="400" height="400" 
    type="image/svg+xml"/> </body>
    </html>
    

    The page which gets rendered appears as follows:

    Summary

    Sun Java Studio Creator supports embedding of SVG files in both HTML and JSP pages. It would have been quite simple to arrange adding files with arbitrary extensions to the resources folder. The present workaround is one way of getting the SVG files into a project. There could be other ways of doing this as well. Unicode.svg displays differently in IE 6.0 and IE 7.0 for some of the South Indian characters, which is probably due to the differences in the viewers. Readers who may be interested in the original SVG files may write to the author, as the files in the article may get changed as they pass through transformation during article editing.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · 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-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT