File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Static content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Static content" Watch "Static content" New topic

Static content

Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 114

for performance reasons, I would like some of my images, flashes etc to be served by Apache which is fronting my JBoss. The problem is, that those images are uploaded to web site by operators, so I can not make static link in JSP. So I made an approach:

I upload file to apache static content directory, save the file name and it's target page in database. Then in JSP page I use <hutputText escape="false"... which is generating html code for > with correct source (URL to static files + filename from database). Is it the best solution? I was wondering how to eliminate database between.

The reasons I am changing this are: the resources are not cached because now I am reading them from database using <input type="image" and servlet, and to reduce number of requests to JBoss (Tomcat).

Any tips or links much appreciated.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

I got a little confused towards the end of that, but no, I don't really recommend using "escape=true" in outputText except in very rare cases. I believe there's a JSF h:outputLink tag or something like that that would be more what you want. Note that this is NOT the h:commandLink tag, which is designed to submit requests to JSF.

You could always jam in a raw HTML "a" tag, but that's also not something I recommend doing if you have any choice in the matter.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Static content
It's not a secret anymore!