java - Struts 2 display image -


i looking simpler solution display image inside jsp page, within struts2 application. solution found far (and working) one: struts 2 dynamic image example.

however, writing image stream of bytes seems me overkill. there other simpler solution? or absolutely necessary use stream of bytes?

simply, writing <img src="#image_location_on_disk">is not acceptable solution, because want struts responsible bringing image (in business logic decide whether image should displayed or not)

if want stream image location not publicly visible browser, standard way it.


in case use fileinputstream read image, assign inputsream , use stream result action.


in struts2 can perform task of serving image stream result instead of writing directly response. can configure result corresponding content type.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -