[plt-scheme] Images in servlets
On 1/25/06, Glenn Ambrose <glennambrose at hotmail.com> wrote:
> Hello, I have just started experimenting with writing servlets and am having
> difficulties with getting the servlet to display images.
>
> The following file "first.ss" sits in the path: /servlets/experiments along
> with the photograph NakseongdaePark.JPG .
All files in /servlets MUST be servlets. Static files should be put in htdocs.
>
> Displayed on the screen is all the text with an empty frame 5 pixils wide,
> 300 by 160.
>
> (require (lib "unitsig.ss")
> (lib "servlet-sig.ss" "web-server"))
>
> (unit/sig () (import servlet^)
>
> (define glissade "glissade. n slide, usually on feet down a slope of ice.")
>
> `(html (head (title "First Attempt"))
> (body ([bgcolor "black"]
> [text "green"])
> (h1 "Nakseongdae Park")
> (h2 "First Attempt.")
> (p "So this it, we are going to" (b " die!"))
> (p (b "A second line added to the page."))
> (p ,glissade)
> (img [(src "NakseongdaePark.JPG")
So this would be (src "/static/NakseongdaePark.JPG") and the file
would be in htdocs/static/
> (width "300") (height "160") (border "5")
> (alt "Nakseongdae Park.")]))))
>
> Is there any source of information out there that will help me learn. In a
> nutshell, is there an introductary 'How to' out there. The img form I am
> copying from a document I found on the web "page.ss" but I am yet to find
> any documentation that explicitly states how to handle this sort of thing or
> linking, page set out, what tags are covered, what aren't.
There is no How to. You may be interested in the Scheme Cookbook.
I'm not sure what this sentence means "I am yet to find any
documentation that explicitly states how to handle this sort of thing
or linking, page set out, what tags are covered, what aren't."
The web-server does not care what XML tags you use in your xexpr. You
could write `(foo (bar ([zog "nog"])) bog "frog") and it would
generate:
<foo><bar zog="nog" /> &bog; "frog"</foo>
So, you can use any HTML tags you care to.
> If you can steer me in the right direction that will be great.
>
> Also I am wondering, is this the correct forum for beginner questions. I am
> trying to teach myself to program and at times I find I am stuck.
I think this is a fine forum.
Jay
--
Jay McCarthy <jay at cs.brown.edu>
http://jay.makeoutcity.com/