You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Sascha <dg...@fishtown-team.de> on 2005/06/16 18:27:50 UTC

integrating SVG in a portlet

Hello.

I want to integrate a svg-graphic in a portlet. Problem is that it isn't
displayed the right way. It is diplayed 'above' all other HTML. (And
there is no content in the svg-graphic. It is just a box of the width
and height written in the doView-method).

Thats the java-code:

public void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
        response.setContentType("text/html");
        PrintWriter writer = response.getWriter();
        writer
                .println("<html>"
                        + "<body>"                        
                        + "<embed src=\"Test.svg\"
type=\"image/svg-xml\" width=\"100px\" height=\"100px\"/>"
                        + "</body>" + "</html>");
}


And thats the svg-code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg width="100" height="100">
  <text x="0" y="0">
    Just a simple test...
  </text>
</svg>

Anyone any ideas why it is not diplayed the right way?


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: integrating SVG in a portlet

Posted by perry law <pr...@gmail.com>.
Hi Jetspeed Gurus,

I am a new Jetspeed user. I find it a very interesting portal. But,
learning it seems to be very cumbersome.

I have a simple task. I have few jsp pages and servlets which I would
like to deploy in the first phase, inside some portlets in Jetspeed 2
portal.
I need a step by step guideline to attempt this. I like to know if
someone can help me.


regards,

-Perry

On 6/20/05, Sascha <dg...@fishtown-team.de> wrote:
> Thank you for the hint James.
> 
> Now the portlet displays "Test Text
> <%=response.encodeURL(request.getContextPath())+\"/svg/Test.svg\" %>"
> and an empty box. I'm not really knowledgeable about HTML so I do write
> the code here:
> 
> public void doView(RenderRequest request, RenderResponse response)
>             throws PortletException, IOException {
>         response.setContentType("text/html");
>         PrintWriter writer = response.getWriter();
>         writer.println("Test Text" +
> "<%=response.encodeURL(request.getContextPath())+\"/svg/Test.svg\" %>" +
> "<embed src=\"Test.svg\" type=\"image/svg-xml\" width=\"70px\"
> height=\"70px\"/>");
> }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


RE: integrating SVG in a portlet

Posted by David Pankros <dp...@miragy.com>.
Try this (James was assuming you were inserting it into a JSP page):

public void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
  response.setContentType("text/html");
  PrintWriter writer = response.getWriter();
  String svgUrl = response.encodeURL(request.getContextPath())+
"/svg/Test.svg";
  writer.println("Test Text" + "<embed src=\"" + svgUrl + "\"
type=\"image/svg-xml\" width=\"70px\"
height=\"70px\"/>");
} 

Hopefully I didn't make any syntax errors!  :-)  

Dave

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.9/23 - Release Date: 6/20/2005
 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


AW: integrating SVG in a portlet

Posted by Sascha <dg...@fishtown-team.de>.
Thank you for the hint James.

Now the portlet displays "Test Text
<%=response.encodeURL(request.getContextPath())+\"/svg/Test.svg\" %>"
and an empty box. I'm not really knowledgeable about HTML so I do write
the code here:

public void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
        response.setContentType("text/html");
        PrintWriter writer = response.getWriter();        
        writer.println("Test Text" +
"<%=response.encodeURL(request.getContextPath())+\"/svg/Test.svg\" %>" +
"<embed src=\"Test.svg\" type=\"image/svg-xml\" width=\"70px\"
height=\"70px\"/>");
}

-----Ursprüngliche Nachricht-----
Von: James Liao [mailto:jian.liao@gmail.com] 
Gesendet: Sonntag, 19. Juni 2005 04:35
An: Jetspeed Users List
Betreff: Re: integrating SVG in a portlet

Hi Sascha,
I think the reason for  an empty box is that jetspeed portlet
container can not locate and load your Test.svg. Try this:
"<%=
renderResponse.encodeURL(renderRequest.getContextPath())+"/svg/Test.svg"
 %>"
put your test.svg into portlet web application related path.

- James Liao



On 6/19/05, Sascha <dg...@fishtown-team.de> wrote:
> Thank you, David and Sven.
> 
> The SVG is now displayed in the portlet. But again only an empty box.
I
> packed up the .war archive with 'jar -cf dummy.war WEB-INF' and later
> with  'jar -cf dummy.war WEB-INF Test.svg'.
> 
> Here is the svg code...
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN"
> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
> <svg width="100" height="100">
>   <rect x="10" y="10" width="70" height="70" rx="0" ry="0"
> style="fill:green">
>   </rect>
> </svg>
> 
> 
> ...and here the java method
> 
> public void doView(RenderRequest request, RenderResponse response)
>     throws PortletException, IOException {
> response.setContentType("text/html");
> PrintWriter writer = response.getWriter();
> writer
>         .println("Hello World 3"
>                 + "<embed src=\"Test.svg\" type=\"image/svg-xml\"
> width=\"70px\" height=\"70px\"/>");
> }
> }
> 
> -----Ursprüngliche Nachricht-----
> Von: David Pankros [mailto:dpankros@miragy.com]
> Gesendet: Freitag, 17. Juni 2005 14:22
> An: 'Jetspeed Users List'
> Betreff: RE: integrating SVG in a portlet
> 
> > By viewing at the source you may as well get a
> > clue, why the SVG is displayed on top of the page
> 
> While you're viewing the source output, check to make sure any tables
> you have are properly constructed (matching tags, all td's inside of
> tr's, etc..).  Malconstructed tables often put content in strange
> places.
> 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date:
6/14/2005
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: integrating SVG in a portlet

Posted by James Liao <ji...@gmail.com>.
Hi Sascha,
I think the reason for  an empty box is that jetspeed portlet
container can not locate and load your Test.svg. Try this:
"<%=  renderResponse.encodeURL(renderRequest.getContextPath())+"/svg/Test.svg"
 %>"
put your test.svg into portlet web application related path.

- James Liao



On 6/19/05, Sascha <dg...@fishtown-team.de> wrote:
> Thank you, David and Sven.
> 
> The SVG is now displayed in the portlet. But again only an empty box. I
> packed up the .war archive with 'jar -cf dummy.war WEB-INF' and later
> with  'jar -cf dummy.war WEB-INF Test.svg'.
> 
> Here is the svg code...
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN"
> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
> <svg width="100" height="100">
>   <rect x="10" y="10" width="70" height="70" rx="0" ry="0"
> style="fill:green">
>   </rect>
> </svg>
> 
> 
> ...and here the java method
> 
> public void doView(RenderRequest request, RenderResponse response)
>     throws PortletException, IOException {
> response.setContentType("text/html");
> PrintWriter writer = response.getWriter();
> writer
>         .println("Hello World 3"
>                 + "<embed src=\"Test.svg\" type=\"image/svg-xml\"
> width=\"70px\" height=\"70px\"/>");
> }
> }
> 
> -----Ursprüngliche Nachricht-----
> Von: David Pankros [mailto:dpankros@miragy.com]
> Gesendet: Freitag, 17. Juni 2005 14:22
> An: 'Jetspeed Users List'
> Betreff: RE: integrating SVG in a portlet
> 
> > By viewing at the source you may as well get a
> > clue, why the SVG is displayed on top of the page
> 
> While you're viewing the source output, check to make sure any tables
> you have are properly constructed (matching tags, all td's inside of
> tr's, etc..).  Malconstructed tables often put content in strange
> places.
> 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date: 6/14/2005
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


AW: integrating SVG in a portlet

Posted by Sascha <dg...@fishtown-team.de>.
Thank you, David and Sven.

The SVG is now displayed in the portlet. But again only an empty box. I
packed up the .war archive with 'jar -cf dummy.war WEB-INF' and later
with  'jar -cf dummy.war WEB-INF Test.svg'.

Here is the svg code...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg width="100" height="100">
  <rect x="10" y="10" width="70" height="70" rx="0" ry="0"
style="fill:green">
  </rect>
</svg>


...and here the java method

public void doView(RenderRequest request, RenderResponse response)
    throws PortletException, IOException {
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
writer
        .println("Hello World 3"
                + "<embed src=\"Test.svg\" type=\"image/svg-xml\"
width=\"70px\" height=\"70px\"/>");
}
}

-----Ursprüngliche Nachricht-----
Von: David Pankros [mailto:dpankros@miragy.com] 
Gesendet: Freitag, 17. Juni 2005 14:22
An: 'Jetspeed Users List'
Betreff: RE: integrating SVG in a portlet

> By viewing at the source you may as well get a 
> clue, why the SVG is displayed on top of the page

While you're viewing the source output, check to make sure any tables
you have are properly constructed (matching tags, all td's inside of
tr's, etc..).  Malconstructed tables often put content in strange
places.


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date: 6/14/2005
 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


RE: integrating SVG in a portlet

Posted by David Pankros <dp...@miragy.com>.
> By viewing at the source you may as well get a 
> clue, why the SVG is displayed on top of the page

While you're viewing the source output, check to make sure any tables
you have are properly constructed (matching tags, all td's inside of
tr's, etc..).  Malconstructed tables often put content in strange
places.


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date: 6/14/2005
 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


AW: integrating SVG in a portlet

Posted by Sven Thiergen <s....@itcampus.de>.
> Hello.
>
> I want to integrate a svg-graphic in a portlet. Problem is that it isn't
> displayed the right way. It is diplayed 'above' all other HTML. (And
> there is no content in the svg-graphic. It is just a box of the width
> and height written in the doView-method).
>
> Thats the java-code:
>
> public void doView(RenderRequest request, RenderResponse response)
>            throws PortletException, IOException {
>        response.setContentType("text/html");
>        PrintWriter writer = response.getWriter();
>        writer
>                .println("<html>"
>                        + "<body>"
>                        + "<embed src=\"Test.svg\"
> type=\"image/svg-xml\" width=\"100px\" height=\"100px\"/>"
>                       + "</body>" + "</html>");
> }

Hi,

first of all - there is no need to include a Header in your portlet render
method ("<html><body>..."). Your portlet renders only a part of the whole
page and Jetspeed itself already writes the header parts. Just "view source"
of a delivered page.

By viewing at the source you may as well get a clue, why the SVG is
displayed on top of the page. I am certain that SVG should work just as well
as any other delivered content. For the browser it's just HTML (+ CSS, +
JavaScript), no matter whether there is Jetspeed behind it or not.

Sven.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org