留言板

[Solved][Question] how loading images in config,jsp?

Paolo Pilitti,修改在10 年前。

[Solved][Question] how loading images in config,jsp?

Junior Member 帖子: 51 加入日期: 11-4-13 最近的帖子
hi all

i'm trying to load and show an image file in the config.jsp page of my portlet.
The image is located in MyPortlet-portlet\docroot\img

In the view.jsp page i can load successfully the image with the line
<img src="<%= request.getContextPath()%>/img/view/my_image.png"/>

but in config it doesnt work.

In config he request.getContextPath() is empty


So, what is the correct way to load the image in config.jsp?

I dont want to put the image in template.

regards

Paolo Politti
thumbnail
vipin bardia,修改在10 年前。

RE: [Question] how loading images in config,jsp?

Regular Member 帖子: 162 加入日期: 11-2-28 最近的帖子
Hi Paolo,

When we use configuration mode, it's a different portlet "Portlet Configuration - 86" . For the same reason your are not able to find request.getContextPath().

If you want to load your images you ca pass static path -

<img src="/MyPortlet-portlet/img/view/my_image.png"/>
Paolo Pilitti,修改在10 年前。

RE: [Question] how loading images in config,jsp?

Junior Member 帖子: 51 加入日期: 11-4-13 最近的帖子
it works !
thanks