I'm not sure if this can help, but some time ago, I played around SVG (only
with Firefox implementation) and was able, after my search homework to have
SVG content in a JSP file. If you are just mocking around and hasn't strict
requirements on using specifically servlet, then have a look at this post:
http://www.sitepoint.com/forums/showthread.php?t=368659&highlight=SVG

On 9/6/06, prad <[EMAIL PROTECTED]> wrote:


Hi ,
Am sorry...Actually i was wrong...While posting i made a mistake
Here it is...
public void doGet(HttpServletRequest  request,
                      HttpServletResponse response)
                             throws ServletException, IOException
                {
                    response.setContentType("image/svg+xml");
                    ServletOutputStream out = response.getOutputStream()
                    out.println("<?xml version=\"1.0\"?>\n" +
                                            "<svg width=\"100px\"
height=\"20px\" viewBox='0 0 400 400'>\n" +
                                         "  <text x=\"10\" y=\"20\" >SVG
serverside</text>\n" +
                                       "</svg>");

                                               out.close();

                 }
this is workin fine....Here am just writing out only one element as
response
.....I need to write whole svg file to browser...Any help

Thanks & Regards
Prad


Markus Schönhaber wrote:
>
> prad wrote:
>> Am processing some svg files on server side and after processing i need
>> to
>> send the svg as response...I set the mime type as "image/svg+xml"
>> and  tried the below code
>
> What has this servlet...
>>  public void doGet(HttpServletRequest request,
>>                       HttpServletResponse response)
>>                  throws ServletException, IOException{
>>
>>      response.setContentType("text/html");
>>      PrintWriter out = response.getWriter();
>>
>>      out.println("<html>");
>>      out.println("  <head>");
>>      out.println("    <title>SimpleServlet</title>");
>>      out.println("  </head>");
>>      out.println("  <body>");
>>      out.println("    Hello, World");
>>      out.println("  </body>");
>>      out.println("</html>");
>>     }
> ...to do with SVG?
>
>> when i invoke this servlet .....it's showing download dialog box and if
>> press ok .....servletName.svg file gets downloads
>
> The above servlet shows the behaviour you describe? I doubt that.
>
>> Why its not directly displaying the contents in the browser...Any help
>> plz..
>
> You should first of all clarify what you're doing. I don't see any
> connection
> between the servlet code above and SVG.
>
> Second: Is your browser capable of rendering SVG content / has a plugin
> installed for rendering SVG content?
> Does
> http://localhost:8080/jsp-examples/jsp2/jspx/textRotate.jspx?name=JSPX
> work with your browser (assuming your Tomcat is installed on your local
> machine and listening on port 8080)?
>
> Regards
>   mks
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context:
http://www.nabble.com/How-send-svg-content-to-browser-as-response-tf2219904.html#a6164671
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to