ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | enhydra List | June 2004 Index

<--  Date Index  --> <--  Thread Index  -->

RE: [enhydra] insert a file(.pdf, .doc) somewhere in a web page


Hi Paul,

What you are trying to do will take some work..

One way to do this is to create a proxy class that will get the binary data 
from your database. 

On your web page you will put a tag such as <img 
src="ImageProxy.po?key="img0001", width=xxxx, height=xxxx>

You will need to create a presentation object ImageProxy.java that implements 
the interface -> com.lutris.appserver.server.httpPresentation.HttpPresentation

In the run method, you will need to do something like:

public class ImageProxy implements HttpPresentation {
public void run(HttpPresentationComms comms)
        throws Exception {
        //  read your parameters, and do your database lookup.
        // retrieve your image into a byte[] array...

        comms.response.setContentType(....); // set the MIME type for your 
image
      comms.response.setContentLength(.....);   // size of your image in 
octets 
        
        // write the data back to the browser...
        comms.response.getOutputStream().write(buf,0,len);
        comms.response.flush();
}
}

Have fun..

Mike.


-----Original Message-----
From: Paul Gutierrez [mailto:boxes_cu@xxxxxxxxx] 
Sent: Tuesday, June 22, 2004 7:04 AM
To: enhydra@xxxxxxxxxxxxx
Subject: Re: [enhydra] insert a file(.pdf, .doc) somewhere in a web page


--- Petr Stehlik <pstehlik@xxxxxxxxxx> escribió: > V
Út, 08. 06. 2004 v 05:31, boxes_cu@xxxxxxxxx pí¹e:
> > I'm trying to show some articles(in .pdf, .doc)
> which are in a
> > database into a web page. I know already how to
> retrieve them from the
> > database but I don't know which tag I could use in
> the HTML to say
> > that there(in some place on the page) it will be a
> .pdf or a .doc and
> > dynamically put it later. If somebody could help,
> I'll preciate it.
> 
> The tag you search for is named <span>.
> 
> Example HTML: <span id="article">here will be an
> article from
> database</span>.
> 
> It's up to you to convert the article either to
> plain text (then you can
> use good old 'page.setTextArticle(article);'), or to
> format it to HTML
> and then insert the HTML subtree into the <span>
> pair :)
> 
> Petr
> 
> 
> 
> > 
> --
> You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx 
> mailing list. To unsubscribe:
> mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
> For general help:
> mailto:sympa@xxxxxxxxxxxxx?subject=help
> ObjectWeb mailing lists service home page:
> http://www.objectweb.org/wws
>  


hi!

i'm asking me now what should i do if i need to
retrieve an image from the database and put it
somewhere in the web page dinamically. i'll preciate
if you could help me. i didn't put this on the list
because right now i only can see the mail.

regards

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com




<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.