I'm trying to return an html, page using out.print(); from a servlet, and I can do it successfully the thing is that this is a group project and this other guy send me an html response that I have to mount in the servlet, he used css, and images and I tried to put all of what he send me in a out.print(); but I dont get images or color or whatever. How should it be done?
-
Learn JSP/taglibs/EL. A servlet is the wrong tool for the job in this specific case. Use a servlet to control/preprocess/postprocess requests/responses.BalusC– BalusC2010-08-16 11:51:30 +00:00Commented Aug 16, 2010 at 11:51
Add a comment
|
1 Answer
The CSS and images are most likely intended to be separate resources, each with their own distinct URLs. If you are going to output the resource contents from your servlet as you are currently doing, your servlet code has to look at the details of the HttpServletRequest and output the appropriate resource depending on the requested URL. When the user's browser requests the HTML page, when it requests an image, you give it that image and so on.
There are probably better ways to do this ...
1 Comment
itsmedavid
thanks... gonna look 4 that, and believe me i do know there r millions of better ways, i just don't know them... yet. thanks!