在JSP页面中显示图像 [英] Display image in JSP pages

查看:83
本文介绍了在JSP页面中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



我只是一个struts的新手,我想在JSP页面上显示一个图像,但是我无法让它显示出来图片。



我试图将文件夹中的图像包含在 Web Content 文件夹中,但它没有用,我试着把它放进去在 WEB-INF 文件夹中,但它仍然无法正常工作。



有人可以帮我吗?



这是我在JSP页面中放置的图片标签。

Hello Everyone,

I'm just a newbie with struts and I want to display an image onto JSP pages, but I can't make it display the image.

I tried to put the folder contain the images in "Web Content" folder but it didn't work and I tried to put it in "WEB-INF" folder, but it still didn't work.

Could anyone help me please?

This is the image tag i put in JSP page.

<img alt="logo" src="/resources/images/header.jpg"/>





感谢您的评论

CK



Thanks for any comment
CK

推荐答案

http://www.roseindia.net/answers/viewqa/JSP-Servlet/15266-Show-image-and-text-on-same-jsp-page.html [ ^ ]



http://www.roseindia.net/jsp/file_upload/employee_upload_profile_image。 shtml [ ^ ]



见上面的链接......还可以试试 http://www.roseindia.net 学习JAVA。
http://www.roseindia.net/answers/viewqa/JSP-Servlet/15266-Show-image-and-text-on-same-jsp-page.html[^]

http://www.roseindia.net/jsp/file_upload/employee_upload_profile_image.shtml[^]

See above links......and also try http://www.roseindia.net to learn JAVA.


非常感谢你的任何评论

我自己解决了

这是解决方案

在struts的jsp文件中我必须要使用 html 标签lib并在 img 标签中使用我应该使用的标签重写属性以链接到图像文件。你应该放在 Web内容路径中的图像



这是struts中的jsp文件br $> b $ b

Thank you so much for any comment
I solved it by myself
This is the solution
In the jsp file of struts i have to have this directive to use html tag lib and in the "img" tag i should use rewrite attribute to link to the image file. And the image you should put in the Web Content path

And this is the jsp file in struts

<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<img alt="logo" src="<html:rewrite page='/resources/images/header.jpg'/>" width="100%" height="20%"/>


这篇关于在JSP页面中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆