How do you display images relative to a Portlet JSP page?

For Welblogic Portal 7.0, I want to display a simple image (.gif) on a JSP page.
The problem is that I need to use a 'hard coded' url to the image such as the following:
<img src="portlets/test/images/test.gif" border="0" alt="Test 1">
- OR -
<img src="<webflow:createResourceURL resource="/portlets/test/images/test.gif" />"
border="0" alt="Test 2">
This makes the portlet less portable.
My goal is to display an image relative to the current JSP Portlet page (in the test
directory).
Does anyone know how to accomplish this?
In WL Portal 4.0 I used:
<img src="<%=fixupRelativeURL(pathFromRequest(request) + "images/test.gif", request)%>"
width=24 height=22 border=0 alt="test">
This does not work anymore as fixupRelativeURL does not seem to exist in the 7.0
API.
Your help would be greatly appreciated!
Thanks,
Matt

Exactly what I was looking for!
Thank you Subbu.
Subbu Allamaraju <subbuATBeaDOTCom> wrote:
Matt,
There is an indirect way to achieve this.
(a) In your portlet JSP, get the PortletState. There is an example in
/framework/portlet.jsp.
(b) Get the content URL for this portlet by calling
portletState.getUrl(Portlet.URL_CONTENT).
Depending on where your image is (with respect to the content URL), you
can construct a new URL to the image. For example if your content is at
at /portlets/myportlet/foo.jsp and your image is in at
/portlets/myportlet/images/myimage.gif, you can reconctruct the latter
from the first one.
Once you do this, prepend the constructed URL with the web app context
root (request.getContextPath()).
Hope this helps.
Subbu
matt wrote:
For Welblogic Portal 7.0, I want to display a simple image (.gif) on aJSP page.
The problem is that I need to use a 'hard coded' url to the image suchas the following:
<img src="portlets/test/images/test.gif" border="0" alt="Test 1">
- OR -
<img src="<webflow:createResourceURL resource="/portlets/test/images/test.gif"/>"
border="0" alt="Test 2">
This makes the portlet less portable.
My goal is to display an image relative to the current JSP Portlet page(in the test
directory).
Does anyone know how to accomplish this?
In WL Portal 4.0 I used:
<img src="<%=fixupRelativeURL(pathFromRequest(request) + "images/test.gif",request)%>"
width=24 height=22 border=0 alt="test">
This does not work anymore as fixupRelativeURL does not seem to existin the 7.0
API.
Your help would be greatly appreciated!
Thanks,
Matt

Similar Messages

  • How do i display every 10 Records in my JSP page??

    Hi..
    I have developed one web-page which shows ALL employee records fetched from a employee table and display them in my JSP page.
    It has contain more than 1000's of records. I need to display first 10 Records in my page. There should be some 4 links below the records display which get me to see next 10 records or previous 10 records or first 10 records or Last 10 records.
    IS it possible in JSP??
    This is my sample code for your ref:
    <jsp:useBean id="empOperation" class="com.venki.gen.EmployeeOperation" />
    <html>
    <head>
         <title>Stardeveloper : DataAccess JSP Tag</title>
         <style>
         p, td { font-family:Tahoma,Sans-Serif; font-size:8pt;
              padding-left:15; }
         </style>
    </head>
    <body>
    <p align="center"><u>DataAccess JSP Tag</u></p>
    <%
         EmployeeList empList[] = null;
         empList = empOperation.getEmployees(empName);
    %>
    <table align="center" border="0" width="90%" cellspacing="2" cellpadding="2">
    <tr bgcolor="#CCDDEE">
         <td>EMPNO</td>
         <td>EMP Name</td>
         <td>DESIGNATION</td>
    </tr>
    <%if(empList!=null)
         for(int i=0; i<empList.length; i++)
          EmployeeList emp = empList;%>
         <tr bgcolor="#F7F7F7">
         <td><%= emp.getEmpNo() %></td>
         <td><%= emp.getEmpName() %></td>
         <td><%= emp.getEmpDesignation()%></td>
         </tr>
         <% }%>
    </table>
    </body>
    </html>
    It would be extremely useful,if i know the technique how to display every 10 Records thru JSP.
    Waiting for You people valuable reply and code!
    Regards
    venki

    I do it by pages. i.e. http://example.com/page.jsp?page=1 would show records 1-10, ?page=2 would show records 11-20
    let's pretend each record is identified by one field in the database, `id`
    then the SQL query you'd use to grab the records could be..
    SELECT * FROM `your_table` WHERE `id` >= (page*10) and <= (page*10+10)or this might even work:
    SELECT * FROM `your_table` ORDER BY `id` ASC LIMIT (page*10),10(all examples untested as I'm at work :P)

  • How do you display a new image in  webdynpro view?

    How do you display a new image in  webdynpro view?
    Where is the image stored and how do we specify the image path?

    hi ,
    The UI element Image enables you to integrate graphics into the Web application in a format that is processed by the Web Server u2013 for example, GIF, JPG, and PNG format. Height and width of the graphic can be specified using the properties height and width. The graphic is displayed without borders.
    saveur image   as mime
    with Mime Objects u cn upload doc , jpeg, or giff files from our local system into the webdypnpro system .
    Right click on ur component->mime object->import
    In the transaction sicf/bc/webdynpro , u cn check your component name there you can view the mime objects created by you .
    also refer the SAP online help :
    http://help.sap.com/saphelp_crm50/helpdata/en/46/bb182fab4811d4968100a0c94260a5/content.htm
    to knw more abt mime repositories.
    http://help.sap.com/saphelp_nw04/helpdata/en/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm
    regards,
    amit

  • How can I display images that are not included in any collection?

    How can I display images that are not included in any collection (some filter or smart collection)? A smart collection with parameters "Collection - contains - empty field" does not work. Lightroom 5.

    Thank you! Good idea! I ordered letters of the alphabet (space separated), and it works.

  • How can I display images in drop down.

    Hi All,
    How can I display images in drop down.
    <select><option>image here</option></select>
    please reply soon.
    anser please
    Thanks

    I have not found html forum..That's just incredible.
    where can i find it ?Sorry, I'm still recovering from that remark.
    please reply soonEvery time you end a post with this, or "urgent" or other such keywords, the forum automatically introduces a 5 minute delay so that will actually make the whole process slower (not faster).

  • How can i display image in RTF template when Oracle Apps running in Windows

    Can any body help how can i display image in RTF template when oracle apps running in Windows Server.
    Thanks
    Ravi

    Hi Ravi,
    You can add images into your rtf template using MS Word Insert Picture feature.
    Did you try this method?
    Thanks
    Ravi
    [email protected]

  • How do you display a swf video / videos when you mouse over

    How do you display a swf video / videos when you mouse over, It'll be something like a pop up but just that it doesn't open in another windows but within the same window and will be like a pop up roll over image.

    Thank you for the reply.
    I've been putzing around with it and came across the 'SetEventHandler' object and thought I'd try and make that one work.
    Here's what I've got so far.
           <mx:SetEventHandler target="{turnAroundMovie}" name="handleMovieClip" handler="stopMovie()"/>
    And then my fuction.
       <mx:Script>
            <![CDATA[
                private function stopMovie():void{
                    turnAroundMovie.stop(); <!-- here's where I'm getting stuck -->
            ]]>
        </mx:Script>
    My first instinct was the simple stop(), but that didn't fly.  I even added a stopMovie frame in my .swf and tried a gotoAndStop('stopMovie'); but that didn't fly either.  And that's kind of where I'm stuck at.

  • How do you display a price in 2 decimal spaces? e.g.  $39.95000

    Does anyone know how do you display a price in 2 decimal spaces? e.g. $39.95000
    jsp code preferred please,
    thanks in advance!

    hi,
    this is jsp code just follow code
    <%@page language="java" import="java.text.*" %>
    <%
    double d=39.95000;
    NumberFormat fmt=new DecimalFormat("0.00");
    out.println(fmt.format(d));
    %>
    jpreddy

  • How do you make images transparent in inDesign?

    How do you make images transparent in Adobe InDesign CS5.5?

    Dittco wrote:
    It IS possible: Select the image. Open effects (Window > Effects). Switch from "normal" to "multiply". Viola! White background is gone.
    That only works with a white background. In addition, it introduces a transparency effect, with its associated problems.
    With a rather light background: Select the image. Open clipping path (Object > Clipping Path > Options). Select Type > Detect Edges; use Threshold and Tolerance to get as close as possible to the edge of your image. This may be difficult because of a too low resolution image, or too much fringe on the edge -- if all fails, use the Inset Frame value to force the mask "into" the image. Click OK, and the background is gone.
    But that's not the only way: you can always create a clipping path manually, and then you are in total control, not limited by transparency side effects, auto-edge detection, and busy backgrounds.

  • How do you display total time for playlist in Itunes 11

    how do you display total time for playlist in Itunes 11

    "I can see the total time in my playlist on the computer but not on my device??"
    I have just posted a question asking the same!
    Did you have any joy?

  • How do you display file type in PS Elements 10?

    How do you display file type in PS Elements 10 in the Organizer for each photo?
    I know you can right click and look at meta data.
    In PSE 7 it was displayed under each photo.

    Two things:
    1.  Set the View option to show file names:
    2.  Ensure your thumbnails are large enough to display the data:
    Ken

  • How do you display exact duplicates in Itunes 11. It is now missung under the file?

    How do you display exact duplicates in Itunes 11. It is now missung under the file?

    Right-click on this direct link to ExactDuplicates and "download" or "save link as..." to a location of your choice. Double-click to the file to run it. You should get something a bit like this:
    If your system will allow it my script will produce a progress bar so you can see what is going on, otherwise you will have to be patient, it will carry on working in the background.
    After scanning for duplicates it then adds them to a new playlist. For large libraries this process can be quite slow. (Very slow if you also have old hardware like me.)
    Finally you'll get a results window like this (from a different test run, as I didn't have time for the full one to finish when I was grabbing screenshots).
    You can use shift-delete to remove selected tracks from the library as well as the playlist. Leave at least one track behind from each repeated group and don't send anything to the recycle bin unless you are sure you have more than one physical copy.
    The DeDuper script has several advantages over cleaning by hand. Automating the process allows preservation & amalgamation of ratings, play counts, playlist membership, etc. See this thread for more detail.
    tt2

  • How do you display Movies only in iPhoto?

    How do you display Movies only in iPhoto?

    Create a Smart Album like this (depending on your iPhone model)
    You'll see your iPhone pictures and all movies in the library.
    OT

  • HT1386 HOW DO YOU DISPLAY DUPLICATES IN PLAYLISTS?

    How do you display duplicates on the playlist with the new itunes format?

    Note that, as with the iTunes feature, this lists make no distinction between "originals" and "dupes", you have to decide which is which.
    There is also my DeDuper script for automatically removing duplicates copies but keeping one remaining copy of each set. This can preserve ratings, play counts, playlist membership, etc. which are lost in a manual clean up. Please take note of the warning to backup your library before deduping. See this thread for background on deduping and the script.
    If you want to manually remove duplicate tracks use shift-delete to remove selected tracks from the library as well as the playlist. Keep one of each repeated group of files and don't send the others to the recycle bin unless you are sure that there are multiple files on the disc as opposed to multiple entries to the same file. Same advice to backup applies.
    tt2

  • How do you move images in one aperture library to a new aperture library

    how do you move images in one aperture library to a new aperture?

    Hello, Patricia,
    Do you want to create a new Aperture Library with the images you select or to import them into another existing library?
    To create a new library based on selected images use the main Aperture menu:
         File -> Export -> Project (Folder, album) as New Library.
    To import a part of an Aperture Library into another Library, export the Aperture items as new library, then import that library into the destination library. That way you will ensure, that all versions and metadata are exported.
    Regards
    Léonie

Maybe you are looking for

  • BIP and szending output to a printer

    Hi, I am perusing the BIP documentation looking for how to print my report directly to a printer. The only reference I am seeing is to IPP. I must be missing something, because all I need to do is send my output to printers already defined on my serv

  • Simple Table Displays OK in Mozilla But Not Showing in IE??

    I'm updating our company website and am looking to add sections to each page with bullet points.  (Note: I am using Dreamweaver CS4 version 10.0.) I tried using the Unordered List feature but for those bullet points that were extremely long, the 2nd

  • Restricting particular session variables being shared

    i am using weblogic 10.3. I have an EAR with has 2 WAR in it , with session sharing enabled in the weblogic-application.xml . I understand that this will make all the variables that are added in the session to be shared by both WAR, but i want a part

  • Configuring BI-java portal to BW backend

    Hello, We have an existing application portal which used to display BI reports and related iviews. Now I have installed a new BI-Java portal instance. I want to configure this new portal instance to connect to my BW backend. How do I go about it? Als

  • HUB issue on Z10

    Hi, I would like to seek for your assistance if you ever encounter issue below; On BB Z10 device, I have configured an IMAP account. The email has been working well for many months. However, since yesterday I was not able to read any email related to