Is there anyway to add resources to a web application using JSF programmatically? This would involve adding files in the resource folder (or any of it subfolders). I want to add a picture that can be treated as a resource so I display it with
<h:graphicImage name="name of the resource 开发者_如何学运维i create" library="subfolder under resources" />
You don't want to write to web content programmatically. It will all get lost whenever you redeploy the webapp.
Just save it to disk or DB using FileOutputStream or PreparedStatement#setBinaryStream() and then have a servlet which gets an InputStream of it from disk or DB using FileInputStream or ResultSet#getBinaryStream() respectively and then writes it to the OutputStream of the response along a proper set of HTTP response headers. Finally just call that servlet by its URL, along with the unique resource identifier or filename as request parameter or pathinfo.
加载中,请稍侯......
精彩评论