如何使用stuts2在jsp中显示保存在耳朵外部的上传图像 [英] How show an uploaded image saved outside ear in a jsp using stuts2
问题描述
在我的项目中,用户上传保存在驱动器中上下文根之外的图像文件。我需要在jsp中显示这些图像。我用struts2。任何帮助将不胜感激。
看看这个教程。我认为这正是您所寻找的。 p>
编辑:
想法是告诉行动你想要什么样的形象。这样就完成了在请求中添加参数。例如,在示例中,它使用参数 imageId
但您可以更改此策略并使用其他内容,例如图像名称。然后你应该以这种方式调用动作(根据教程):
http:// localhost:8080 / myAppContext / ImageAction?imageId = darksouls.jpg
另外,请记住@Dave Newton的评论非常好替代。请参阅此其他示例。
In my project users upload image files which are saved outside the context root in the drives. I need to show these images in a jsp. I use struts2. Any help will be appreciated.
Take a look to this tutorial. I think that is exactly what you are looking for.
Edit:
The idea is to tell the action what image you want. That is done adding a parameter in the request. In the example, for instance, it is use the parameter imageId
but you can change this strategy and use a different thing, like the image name. Then you should call the action in this way (according to the tutorial):
http://localhost:8080/myAppContext/ImageAction?imageId=darksouls.jpg
Also, take in mind the @Dave Newton's comment as a very good alternative. See this other example for that.
这篇关于如何使用stuts2在jsp中显示保存在耳朵外部的上传图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!