Skip to Content
author's profile photo
Former Member

Calling images stored in the "images" folder of the PAR file

Hi all,

I want to show a .GIF file which i have stored in the "/images" folder of my PAR file. I am developing a JSP in which i am using <IMG SRC= ""> tag to display it.

But it does not show me the image if i use the following:-

/images/xyz.GIF

images/xyz.GIF

xyz.GIF

Please help me in this.

Regards,

Narahari

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • author's profile photo
    Former Member
    Sep 29, 2005 at 11:47 AM

    HI

    Try with this code

    String path = request.getResource(IResource.IMAGE,"images/ABC.gif").getResourceInformation().getURL(request);

    response.write("<img src = "path"/>");

    Regards

    Rajeev.

    Do award points for helpful answers.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 29, 2005 at 12:12 PM

    Hi Narahari,

    I prefer to avoid working with JSP and develop mainly with DynPages but perhaps the code that I use there will help you. I'll generaly use something like;

    String picPath = request.getWebResourcePath() + "/images/xyz.gif";

    where my image folder is in the dist folder of the par.

    I hope this helps,

    Patrick.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 29, 2005 at 02:15 PM

    Try this:

    Place myImage.gif in Images folder.

    JSP:

    <%@ taglib uri="tagLib" prefix="hbj" %>
    <% String image1 = componentRequest.getWebResourcePath() + "/images/myImage.gif"; %>
    
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
         
             <img src="<%=image1%>">
          
         </hbj:form>
      </hbj:page>
    </hbj:content>

    Regards,

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 30, 2005 at 03:14 AM

    Hi,

    Try this code:

    <i>

    <%@ taglib uri= "tagLib" prefix="hbj" %>

    <hbj:content

    id="myContext">

    <hbj:page

    title="PageTitle">

    <center>

    <hbj:form

    id="myFormId">

    <% String ImageURL = componentRequest.getWebResourcePath() + "/images/xyz.GIF"; %>

    <hbj:image

    id="Logo"

    width="608"

    height="89"

    src="<%=ImageURL%>"

    alt="xyz.GIF" />

    </hbj:form>

    </center>

    </hbj:page>

    </hbj:content></i>

    Rgds,

    Raj

    <b>PS: Please Consider rewarding points.</b>

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi All,

      I've similar application only difference being in the images folder, there is list of images say

      image0.jpg

      image1.jpg

      image2.jpg and so on.

      now I have used the following code:

      <% String ImageURL = componentRequest.getWebResourcePath() + "/images/xyz.GIF"; %>

      src="<%=ImageURL%>"

      Now I want to randomly pick any of the images. How to go about this.

      Thanks in advance.

      Srikant

  • author's profile photo
    Former Member
    Sep 30, 2005 at 07:05 AM

    1. You have to determine the path, as the prvious posters mentioned

    2. you must not place the images within the PAR-INF-directory, since these contents can not be read via normal urls. Place your images directory in the directory of your par-inf-dir

    Add comment
    10|10000 characters needed characters exceeded