How to embed image in jsp(j2ee application)

Hi ,
I have created a simple jsp application and deployed on portal.
in the first jsp i need to show a jpeg image
I am referencing the image wth a simple HTML SRC="image.jpg" tag
image is placed in same folder as jsp.
However this does not work. when i deploy on portal and access the jsp using following url
http://hostname:port/applicationname/index.jsp
the image is not shown..?
What is the reason..?
Please help.
Thanks
rocky

Hi Rocky,
Are you using the DC?
if yes then you need to put the image inside the component folder. after that close the application
& reopen. You will get the image.
In case this does not work then try refreshing the portal through server side. Once the cache is cleared, it will be up to view.
Also check the Activity list you have created. It should be added to the dtr properly or else it wont be reflected once reimported the configurations.
Regards
Chander Kararia

Similar Messages

  • How to embed images in long text of PM Notifications/Orders

    Dear Sir,
    How to embed images in long text of PM Notifications/Orders? Kindly help.
    Thanks & Regards
    PM Team.

    Hi,
      Unfortunately, You will not be able to view the graphics within the Long text editor screen.Only Limited word functionality is available on these editors.
      You will have to store these pictures separately as an attachment, through generic object services and then view them through that.
    Regards
    Narasimhan

  • How to embed flash video in HTA Application

    How to embed flash video in HTA Application?

    How to embed flash video in HTA Application?
    It is exactly the same as embedding in a normal HTML page.  Check with flash forum on how to use flash.
    ¯\_(ツ)_/¯

  • How to add images into a java application (not applet)

    Hello,
    I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
    Thank you,
    Oscar

    Your' better off looking in the java 2d forum.
    package images;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.FileInputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    /** * LogoImage is a class that is used to load images into the program */
    public class LogoImage extends JPanel {
         private BufferedImage image;
         private int factor = 1; /** Creates a new instance of ImagePanel */
         public LogoImage() {
              this(new Dimension(600, 50));
         public LogoImage(Dimension sz) {
              //setBackground(Color.green);      
              setPreferredSize(sz);
         public void setImage(BufferedImage im) {
              image = im;
              if (im != null) {
                   setPreferredSize(
                        new Dimension(image.getWidth(), image.getHeight()));
              } else {
                   setPreferredSize(new Dimension(200, 200));
         public void setImageSizeFactor(int factor) {
              this.factor = factor;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              //paint background 
              Graphics2D g2D = (Graphics2D) g;
              //Draw image at its natural size first. 
              if (image != null) {
                   g2D.drawImage(image, null, 0, 0);
         public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
              LogoImage logoImage = new LogoImage();
              BufferedImage image;
              try {
                   FileInputStream fileInput =
                        new FileInputStream("images/" + filename);
                   image = ImageIO.read(fileInput);
                   logoImage =
                        new LogoImage(
                             new Dimension(image.getWidth(), image.getHeight()));
                   fileInput.close();
                   logoImage.setImage(image);
              } catch (Exception e) {
                   System.err.println(e);
              return logoImage;
         public static void main(String[] args) {
              JFrame jf = new JFrame("testImage");
              Container cp = jf.getContentPane();
              cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
              jf.setVisible(true);
              jf.pack();
    }Now you can use this class anywhere in your pgram to add a JPanel

  • Best way to manage images on jsp web application

    Hi,
    Am developing a jsp web application, in that project, the user will upload the image files, now I created an image directory in the context root and when the image is uploaded by the user it is saved in the /images directory and the image path is saved in the database. I can display this image using the <img src="images/a.jsp" > tag.
    but when I rebuild the project all the images in the /images directory get deleated but the image path is remained in the database, is there any method that I make /image dir outside my project context root so that when I rebuild the project the /images dir can get changed and my project will save images outside the context root that is in the /images dir which is now outside the project context root. and is it possible to display those images using <img src""> tag. because this time my /images dir is at D:/images . what could be the best method or way to handle images with the web application.
    any suggestion will be helpfull

    Well my friend as per your given case there are to two ways of approaching your problem.
    Case 1:
    How to save the relevant data ??
    .Create a backup folder Workstation on which you are hosting your application where you can store all the uploaded files which is outside the scope of webserver(However we can write a dedicated servlet which can access that file) and make sure we pickup from any the folder path from a specfic MessageResource bundle or an context/servlet init parameter in web.xml.
    .Write a Upload servlet/Backing Bean which saves all the files in the discussed folder using utility packages like Commons FileUpload,Oreilly MultipartRequest & etc and then register saved fileName in the database user specfic table specific to user.
    How to display the Image ??
    .Write a dedicated servlet which can pickup user related fileName specfic information from the database and the read the file from backup folder by constructing the path from the entry made as a init param in web.xml or any other custom MessageResource bundle and then stream the Image data using the ServletOutputStream.
    NOTE: do not forget to pickup & setImage file ContentType & Set the content length.
    .Just try to render the JSP view file where we are displaying the displaying the images by calling the dedicated ImageServlet.
    <img src="ImageServlet?userid=2345" align="center"/>Try to refer below posts to get a better understading.
    Dedicated Image Servlet:
    http://forum.java.sun.com/thread.jspa?threadID=5208858&messageID=9840042#9840042
    Uploading Files Using Servlet:
    http://muimi.com/j/jakarta/commons/fileupload/
    Case 2
    The second method would more or less the same but here we would save the uploaded file
    content is saved in the Database as a Blob and we would retrive it back using a dedicated image servlet again.
    However,in terms of performance the second case implementation is very costly.
    Try to refer below posts to get a better understading on the second case.
    http://forum.java.sun.com/thread.jspa?threadID=5193481&tstart=50
    http://forum.java.sun.com/thread.jspa?threadID=5211649&messageID=9853670#9853670
    Hope this might help :)
    REGARDS,
    RaHuL

  • How to Call Image Viewer from Form application

    Hi,
    how to call Image viewer using host command on oracle form 6i.
    i trying using host command on local/client application .. and it is working ...
    but when i try on server application (EBS - UNIX) it does not working ...
    thanks ..
    regards,
    safar

    Are you using Forms 6i in client/server mode or web deployed? I'm not sure what you mean by 'try on server application"
    Remember that when using a web deployed architecture, a host command will execute the command on the Forms application server, NOT on the client.
    To execute host commands on the client you would have to use WebUtil, but that's not available for Forms 6i. Perhaps there are PJC's out there that can do it for you, but I don't want to get in all those details without me knowing if it is relevant for you.

  • How to embed image in email, not as an attachment?

    I need to know how to embed an image into Mail without making it an attachment. Any ideas?
    Thanks in advance.
    Hana

    drag the image to the email. that's all. how it will show on the other end depends on the email client configuration of your email recipients, not on you.

  • How to embed images in e-mail?

    How do you embed images in an e-mail?

    You can either place the cursor where you ant the image, go to the image on the screen, slect it and copy, change back to mail and paste. _OR_
    when composing, place the cursor wher you would like the image and Attach the file to the email.

  • How to manually completely remove a J2EE application from the server?

    Hello,
    I have created and deployed a certain test J2EE application.
    After I finished with it I wanted to remove it, yet I cannot do it: Any removal attempt, either by the SDM or Admin Tool, encounters exceptions and errors I cannot handle. I tried restarting the server, stopping the application yet nothing works. on telnet the application has always STOPPING ststus...
    Desperately, I have decided to manually remove this application from the server yet I don't know the steps.
    Can someone please give me a step-by-step guidance on how to completely remove this application from the server, so it won't appear anyome both at the SDM and at the deploy service of the WAS?
    Thank you in advance,
    Roy

    Hi Peter,
    I've reproduced the problem and created a thread dump. I believe these lines are the important ones:
    "SAPEngine_Application_Thread[impl:3]_10" prio=5 tid=0x080cc9d8 nid=0x18e0 in Object.wait() [8a8f000..8a8fdb8]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x14450d88> (a java.lang.Object)
         at java.lang.Object.wait(Object.java:429)
         at com.sap.engine.services.ejb.EJBAdmin.destroyContainers(EJBAdmin.java:1145)
         - locked <0x14450d88> (a java.lang.Object)
         at com.sap.engine.services.ejb.EJBAdmin.commitStop(EJBAdmin.java:2529)
         at com.sap.engine.services.deploy.server.application.StopTransaction.commonCommitFinished(StopTransaction.java:262)
         at com.sap.engine.services.deploy.server.application.StopTransaction.commitCommon(StopTransaction.java:305)
         at com.sap.engine.services.deploy.server.application.StopTransaction.commit(StopTransaction.java:291)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:310)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesImpl(ParallelAdapter.java:327)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:111)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:230)
         at com.sap.engine.services.deploy.server.application.RemoveTransaction.begin(RemoveTransaction.java:133)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:292)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:326)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3139)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.remove(DeployServiceImpl.java:903)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.remove(DeployServiceImpl.java:5056)
         at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:885)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Could you please advise how to proceed from here?
    Thank you in advance,
    Roy

  • How to access OBIEE report in J2EE application?

    Hi All,
    I need to integrate OBIEE with my J2ee application. The scenario is something like
    i need to access the reports(that were created by BI Answers) via my j2ee application. I will provide a simple screen and the user will enter a value and i need to pass the value to OBIEE .Then it will filter out the data based on that value and shows to the user.
    I have tried it by using GO URL and i am able to access the OBIEE environment but when i tried to pass the value it doesn't navigate.Even i am not able to search a particular report.
    How could i proceed? Should i use some variable to store the data that is passed for search in OBIEE?
    Pls help me t solve out this. Any idea is highly appreciated.
    Thanks
    Ashok

    STEP 1: Like any other add-on project, refer SBO UI and DI COM to your project. Initialize SBO APPLICATION object and SBO COMPANY object and listen to events. (This is standard add-on project steps)
    STEP 2: Add a Dataset to the project. This is used as a data source to your Crystal Reports. (For more information on this search for Push Technique Crystal Reports)
    STEP 3: Add a Windows Form to your Project.
    STEP 4: Add a Crystal Report Control to it.
    STEP 5: Design report based on dataset added above.
    STEP 6: Launch this Form with required parameters and selection criteria when any even happens.
    Remember there is lot stuff available on net if you search with PUSH TECHNIQUE CRYSTAL REPORT. SAP SDN has lot answers for adding Crystal Reports integration to SAP Business One Add-On.
    HTH
    B Ravi Shankar

  • How to embed images dynamically?

    HI all , I'm new to flex.
    Here is what I've already done, I use
    [Bindable]   
    [Embed(source="images/xxx.jpg")]
    private var img:Class;
    to embed several images in an application.
    But the source of these images can not be determined until the run time, I got image's url dynamically, and used some variables to store them. For example, an url may refers to an url
    var url:String = "images/xxx.jpg";
    Then I think it's possible to give its value to an image source by using
    [Bindable]   
    [Embed(source=url)]
    private var img:Class;
    However,it doesn't work. there is a compile error, the description is:
    "url" does not have a recognized extension, and a mime type was not provided
    Unable to transcode url
    So what's the problem here, and could any one give me some advice to embed images dynamically?
    Thanks!

    HI
    I don't think you can embed an image dynamically as you need to know the path of the image when you use the embed tag.  The embedding takes place at compile time, and you app would need to be compiled into a swf before your code loads.
    If you need dynamc images in an application then its usually done by loading them when the app is running.  You do this by using for example a HTTP service to load in the image paths.  You can then view them by assigning them to an image tag through Actionscript.
    I hope that helps and I got the idea of what you were trying to do.
    Heres a quick example I used for someone else on swapping images from an arrayCollection.  You could do something like this and populate the arrayCollection using a HTTP service.  Or just access the xml from the HTTP directly for the image paths
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()" xmlns:local="*">
         <mx:Script>
              <![CDATA[
              import mx.controls.Button;
              import mx.collections.ArrayCollection;
    [Bindable]
    private var ac:ArrayCollection = new ArrayCollection([
    {imageTitle : 'Car 1', imageUrl : 'http://www.geekologie.com/2007/12/07/future-car-1.jpg'},
    {imageTitle : 'Car 2', imageUrl :'http://www.speedace.info/solar_cars/solar_car_images/Solar_Wing_front_Japanese_e lectric_powered_car.jpg'},
    {imageTitle : 'Car 3', imageUrl : 'http://www.dezeen.com/wp-content/uploads/2008/09/gem-peapod-car-by-chrysler-llc- et008_027evsqu.jpg'}
    private function showCar(num:int):void {
    img.source = ac.getItemAt(num).imageUrl;
    imgTitle.text = ac.getItemAt(num).imageTitle;
    ]]>
         </mx:Script>
         <mx:Image id="img" source="{ac.getItemAt(0).imageUrl}" width="426" height="243"/>
         <mx:Label id="imgTitle" text="{ac.getItemAt(0).imageTitle}"/>
         <mx:Button label="Button" click="showCar(0)"/>
         <mx:Button label="Button" click="showCar(1)"/>
         <mx:Button label="Button" click="showCar(2)"/>
    </mx:Application>
    Good luck
    Andrew

  • How to embed video player in iPhone application?

    Hello Everybody,
    I want to embed video player in my application. I have one sample code provided by the iPhone developer documentation. But it is not running properly , it is just showing one rounded progress indicator and it is rotating n rotating and never coming to an end. Can any one here , tell me how do I proceed to embed video player in my application?
    Any information regarding this is highly appreciable.
    Thanks,
    Pandit Pakhurde

    Hi Roger,
    Actually, Code is running fine and not giving any error. When I am clicking on "Play Movie" button then iPhone is getting flipped with one window having black screen and round progress indicator is rotating in middle of the screen. But no picture. I also debug the code , all the necessory paths of the video files are same. I think there are two possibilities in this issue, either video is not getting loaded properly or iPhone simulator is not providing the necessary requirement to run video file.
    Is there anything I am missing then please let me know.
    Thanks,
    Pandit Pakhurde

  • How to upload image using JSP

    hi,
    i am confronting a problem how to upload image from local PC to web server . I am using Tomcat 4.0
    please help me by sending code
    thanks

    Hi,
    Here is the solution for uploading images and displaying images. I am using struts with JSP, so this code has a Action and ActionForm class. You can put the same code in Java Beans or Servlet class to run it. This code has two JSP files - one for Upload (upload.jsp)and other for Image(image.jsp) display. It has a Servlet also to display the image. Here is the code file wise.
    Upload.jsp **********************************************************
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html>
    <head>
    <title>New Page 1</title>
    </head>
    <body>
    <html:form action="uploadAction.do" enctype="multipart/form-data" method="POST">
    <p>File to upload   
    <html:file property="fileUpload" size="20"/></p>
    <p><html:submit value="Upload" property="upload"/></p>
    <p> </p>
    <p><html:img src="image.jsp"/></p>
    <p> </p>
    </html:form>
    </body>
    </html:html>
    Image.jsp*****************************************************************
    <jsp:useBean id="upload" class="uploadtest.uploadActionForm" scope="session">
    </jsp:useBean>
    <%
         byte[] rgb=(byte[])session.getAttribute("byte");
         request.setAttribute("byArr", rgb);
    %>
    <!--
    The image data is now on the request object.
    Forward the user to the showImage servlet.
    That servlet will process and display the image data contained on the request object.
    -->
    Image is<p>
    <jsp:forward page="/showimage" />
    Struts Action Class - UploadAction.java **************************************************
    import javax.servlet.http.*;
    import java.io.*;
    import org.apache.struts.upload.FormFile;
    import org.apache.struts.action.*;
    public class uploadAction extends Action {
    public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    uploadActionForm upload = (uploadActionForm) actionForm;
    try {
    int size=upload.getFileUpload().getFileSize();
    //if (image != null) {
    byte[] byteArr = new byte[size];
    //Create an input stream to read the uploaded file.
    ByteArrayInputStream bytein = new ByteArrayInputStream(upload.getFileUpload().getFileData());
    // Load the input stream into the byte Array.
    bytein.read(byteArr);
    // Close the input stream.
    bytein.close();
    // Load the byte[] into the content field.
    upload.setContent(byteArr);
    HttpSession ses=httpServletRequest.getSession();
    ses.setAttribute("byte",byteArr);
    return actionMapping.findForward("success");
    } catch (Exception ex) {
    ex.printStackTrace();
    return actionMapping.findForward("success");
    Struts ActionForm class ---uploadActionForm.java***************************************************
    package uploadtest;
    import org.apache.struts.action.*;
    import org.apache.struts.upload.*;
    import javax.servlet.http.*;
    public class uploadActionForm extends ActionForm {
    private FormFile fileUpload;
    private byte[] content;
    public FormFile getFileUpload() {
    return fileUpload;
    public void setFileUpload(FormFile fileUpload) {
    this.fileUpload = fileUpload;
    public byte[] getContent()
    return content;
    public void setContent(byte[] theFile)
    this.content = theFile;
    public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    /**@todo: finish this method, this is just the skeleton.*/
    return null;
    public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    Servlet to display image --- ShowImage.java ********************************************************
    import java.io.*;
    import java.util.*;
    public class ShowImage extends HttpServlet {
    //Initialize global variables
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    byte[] rgb = (byte[]) request.getAttribute("byArr");
    if (rgb != null)
    response.setContentType("image/gif");
    OutputStream stream = response.getOutputStream();
    stream.write(rgb);
    else
    response.setContentType("text");
    response.getWriter().write("attribute byArr not found");
    This code will enable to to upload and display the image. If you know Struts, then you can write the Struts-Config.xml file by yourself. Other wise write to me, I will send you that. If you want to save the image in database, then you have to keep it as BLOB datatype is database. For database you need to send the byte array in the uploadAction.java file to database. Database will keep the image as binary.
    Thanks
    Amit

  • How to import image for display in APPLICATION

    1.how to import the image by using java APPLICATION and display it on the textarea that you have been created.
    2.how to store the image into the file.
    3. what class should i used?
    4. how to create an object to keep track the image in java application.
    * important : not java applet.
    plzzzzzzz.
    regards fenny

    You can use Graphics package for importing images in Java applications. But I am afraid you cannot display it on Text area, you can display it on JPanel, or JLabel or some container like this.
    Check this example.
    http://www.javaalmanac.com/egs/java.awt/DrawImage.html

  • How to embed images in an INX file using script

    Hi All,
    Kindly help me in embedding images in INX file using Indesign Javascript.
    I have used the following code to embed images in an indd document and exporting that document to inx. But the images in inx are not embedded by default.
    var linksCount = myDocument.links.count();
    var linksOnPage = myDocument.links;
    for(var x=0;x<linksCount;x++){
        var linkedItem = linksOnPage.item(0);
        linkedItem.unlink();
    myDocument.save(new File("filename.indd"));
    myDocument.exportFile(ExportFormat.INDESIGN_INTERCHANGE, File("filename.inx"), app.pdfExportPresets.item("[Press Quality]"));
    Thanks in advance,
    Anitha

    Hi
    I think your script has two mistakes
    you embed only first link image in for loop => set x for linksOnPage
    exporting to inx isnot need PDF export preset => remove app.pdfExportPresets.item("[Press Quality]") from exportFile()
    this work for me.
    myDocument = app.documents[0];
    var linksCount = myDocument.links.count();
    var linksOnPage = myDocument.links;
    for(var x=0;x < linksCount;x++){
        var linkedItem = linksOnPage.item(x);
        linkedItem.unlink();
    myDocument.save(new File("filename.indd"));
    myDocument.exportFile(ExportFormat.INDESIGN_INTERCHANGE, File("filename.inx"));
    thank you

Maybe you are looking for

  • To replace values of one of the field in the database table

    How to replace values of one of the field in the database table with a new values? Pls help to solve

  • Problem with increasing page width

    Hi, When I try to increase iWeb page width from 684px to 900px, there is an unexpected redundant white area at the bottom right corner of the page. Please see the screenshot here: http://img223.imageshack.us/img223/7244/screenshot20090713at600.png I

  • Need Windows 7 Driver for 6920AB1 Monitor

    Hello, My computer was running great until I decided to install windows 7. Same graphics card NVIDIA GeForce 6100, same L192 Wide TFT monitor but now the picture is distorded and I can't find the default resolution setting of 1440x900 on the option b

  • The way streaming is better for all performers, if they work at it [All Platforms][Other]

    I'm no trying to be your PR or law firm but, from my perspective, being new to Spotify, I think some of the performer and recording industry comments about your not paying enough could be offset by this simple idea that, few in music seem to understa

  • Alarm settings for 'to do' in Mail

    When I make a 'to do' in Mail, the alarm function has the wrong email address for me but I can't see how to change it to my current email address so I can receive alarm notifications. Any ideas anyone? Many thanks.