cancel
Showing results for 
Search instead for 
Did you mean: 

Include image in JSPDynPage

Former Member
0 Kudos

Hi,

Iam creating an portal application (NWDS)in which i need to include a image/.bmp file into it, please let me known where exactly(folder) I should keep the image file.

I tried keeping it in the dist/images folder, even though i cannot see the image file in the ouput.

Please let me know.

Thanks,

Sri.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Done.

Former Member
0 Kudos

Hi,

Try out this....

<%

String values = componentRequest.getWebResourcePath() + "/images/color.bmp";

out.println("<tr><td width = 20 height=18 background = "values">");

out.println("<strong><samp> 1 </samp></strong></td>");

%>

Regards,

Uma

Former Member
0 Kudos

Hi,

Try out this code inside your jsp page...

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

<img src="<%=ImageURL%>">

Regards,

Uma

Former Member
0 Kudos

Hi,

This is my code

<% String values = componentRequest.getWebResourcePath() + "/images/color.bmp"; %>

out.println("<tr><td width = 20 height=18 background = <%=values%>");

out.println("<strong><samp> 1 </samp></strong></td>");

It throws an error as below :

Portal Runtime Error

An exception occurred while processing a request for :

iView : N/A

Component Name : N/A

Error in executing a process for compilation, D:/usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/web-inf/portal/portalapps/myprtproject/work/pagelet/_sapportalsjsp_testjsp.java:122: illegal start of expression out.println("

1 "); ^ 3 errors .

Exception id: 06:45_14/06/06_0181_1009250

See the details for the exception ID in the log file

Former Member
0 Kudos

Hi,

you have to add the file to dist/images.

If you now want to use the image you can get the link to it with the following code:


IResource rs = request.getResource(IResource.IMAGE, "images/image.gif");

String url = rs.getResourceInformation().getURL(request);

By the way, I would recommend that you convert the BMP to a JPG or GIF. Otherwise you have much more traffic than needed.

Regards,

Dennis

Message was edited by: Dennis Junker

Former Member
0 Kudos

Hi Dennis,

I am uisng the JSPDynPage, please let me know how to include this file.

Thanks,

Sri

Former Member
0 Kudos

Do you want to know how to display it on the JSP or how to include it into your project?

For including it into your project, open the folder dist and click right on the images folder.

Then you can choose import and there you choose filesystem.

From that point you can just browse for the image and add it to your project.

I hope this helps.

Regards,

Dennis

Former Member
0 Kudos

Hi,

I included the images files in the folder, even though when i run my jsp application, i could not see the image in the output.

Please let me know how to get the output of the image in my jsp.

Please give me example.

Thanks,

Sri.

Former Member
0 Kudos

you have to have a dataBean which is refered in the JSP.

Try it like that:

JAVA part(doInitialization for example):


...
IResource rs = request.getResource(IResource.IMAGE, "images/icon_search.gif");
		dataBean.setImage(rs.getResourceInformation().getURL(request));

...

In the JSP use that:


<jsp:useBean id="dataBean" scope="session" class="com.test.DataBean" />
...

...
<IMG src="<%=dataBean.getImageSearch()%>">
...

Regards,

Dennis