How to refresh image component JSP?

hi i am using Netbeans 6.01 and developing a web project.
I need to do some manipulation on an image according to input and save the image at address in the project/build/resources/image with the same name when user press a button but sometimes page refreshes the image and sometimes it does not refresh.I don't know what to do
thank you for your interesting and help if u need more details about the problem please just ask me.

I have just discovered something this is not about the code that i wrote
double x=0;
while(x<=1000000000)
x++;
super.init();
init();
i delete this code when i reload page once after that all of my requests works properly.I mean when i press reload button of the browser once then page works and image is resfreshes.
Now i can solve the issue if anybody can tell me how to reload a page when i press a button
i don't wanna use the javascript onclick() window.location.reload().
Edited by: maniacneron on Dec 24, 2008 2:34 PM

Similar Messages

  • 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 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

  • How to show images in jsp dynamic

    Hi all,
    I am beginner in web technology and am faced with some prob. I have a form in which user enters his unique id....n submits...then web server call ejb which fetches data for that unique id from DB and does some operation and also fetch photograph which i need to display in my response jsp along with data....this photograph is different for each ID and i want to know how to display this image , i dont want to use applet.....i need good response time..and i have lot of hits per second on my site....i was planning to have separate frame wherein image will be loaded and use AJAX for the same but i do believe their mite be some other simple method for the same please suggest.....
    Regards,
    beginner83.

    I am not great at UI, but see if this thread is of any help:
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=20&t=007725

  • How to read images in jsp from an absolute path not from the web app?

    hello there
    i want to read images from an absolute path on the hard disk not from the images folder in the web application
    how to do that?
    thank you

    Ok. You don't give the servlet the full path of an image. You just give an image id in query string. E.g.
    http://my.server.com/imageServlet?id=12Id can be whatever: number as well as name.
    Then, in your servlet You get this id, then read an image file that is mapped for this id and sends it to browser via servlet output stream.
    On the jsp page you write sth similar to:
    <img src="http://my.server.com/imageServlet?id=12"/>and your image will be displayed using your servlet. The image file path is needed only in the servlet code to open the stream to file (image file can be stored wherever you want in file system), read it and write to output stream. Read the tutorial accessible via link I provided in the previous post.

  • How to resize image in JSP using JAI ??!!

    Please help me how to resize an JPEG image from my JSP, could I use JAI lib ? how ?

    Hello,
    I had the same problem few months ago ( in that case i used Jimi instead of JAI).
    The answer to your question is: use the java class called "Image".
    Infact you can use JAI just for load or save to disk your image that you have to resize and then use the following code to resize the image :
    Image imgResized = img.getScaledInstance(100,1,Image.SCALE_AREA_AVERAGING);
    The object "img" is the image to resize and the object "imgResized" is the image resized with width equals to 100 and with a right height.
    I used Jimi just to save my image and i think that with JAI there is a method to do this.
    You can use JAI to load in memory your image too so you can avoid problem with MediaTraker class.
    I hope that this can help you.
    Cheers.
    Stefano

  • How to refresh image preview icons in Finder?

    I often browse through my photos directly in Finder. Many of my photos have been rotated from landscape to portrait format using Preview, but the preview icons I see in my Finder window remain in landscape format. How do I refresh the icons to make them reflect the new, modified image?
    Thanks.

    Hi Saigon Cinnamon, and a warm welcome to the forums!
    I'm not 100% positive, but I think the problem is that Preview & iPhoto only "tag" them as rotated & doesn't actually rotate them.
    I think Finder in 10.5 or 10.6 understand & respects that tag, but not in Tiger.
    I'd try really rotating one & re-saving it in say GraphicConverter...
    http://www.macupdate.com/info.php/id/263

  • How to upload image using JSP under Tomcat

    Hi,
    I want to write a piece of code, which can upload the local image files to the server, also, the user can view the image by click the image name. I use jakarta_tomcat_.1.xx. Can anyone give me some reference about image transfer?
    Thanks a lot!
    Junmin

    do a search for "JSP file upload" and you should find lots of information.

  • How to change image in jsp in a web application

    I had created a web application in which I have given the option to change the image in a jsp, and I am saving that image in a folder.
    The image is saved during the run time.But I am not getting that changed image.
    If I restart my server the image is retrieved . What is the solution for getting the changed image during the runtime itself?

    use javascript
    example:
    <img id='img' src="Img1.gif" border=0
         onMouseover="document.getElementById('img').src='Img2.gif'"
         onMouseout="document.getElementById('img').src='Img1.gif'">

  • How to display images in JSP

    Hi all,
    I created a Jsp page and I stored my images in the dist-->images folder and by using the following code
    <% String image = componentRequest.getWebResourcePath() + "/images/image.gif"; %>
    <img src="<%=image%>">
    I try to display the images in that page.
    Yes I am successful in displaying one image.
    But my problem here is to display more than two images which are present in that page.
    Can any body help me regarding this.
    Your help will be highly rewarded with points.
    Regards,
    Ramana.

    Hi Ramana,
    Set the image border to 1 and check atleast your borders get displayed. If it displays the border, then the problem may be with your image path.
    Before deploying for each modification in your JSP, check the preview of the page using "Preview" tab.
    Are you getting any exception?
    Check your whole JSP page once again (check all the scriplets).
    Regards,
    Uma
    Message was edited by: Uma Maheswari

  • Refreshing image in jsp

    I use cewolf which renders a chart using data from a DataProducer. Now, these datas changes frequently, and what I want is to have a chart where those changes are shown "live", meaning I need to refresh the image every so often.
    I need that just the image is refreshed. Nothing else... anyone here who can help?

    I think this can be done with thread which should be executed every certain interval.
    Also you should put image display logic in servlet
    You can create an Iframe and call eth above servelet inside the Iframe. By using this only Iframe will get updated.
    ~Aman

  • How to refresh images placed with XML?

    Hi folks!
    I placed some images and texts with XML to an InDesign (CS5) document. Unfortunately it's possible that the file is modified. In that case I want to start a script which updates the links. But that should happen later. First it's necessary to check if updating is possible.
    For that I modified the file and refreshed my linked file. But all that is replaced are my texts. The images vanished and I had to place them again by hand.
    What am I doing wrong? Could anybody help please?
    With kind regards,
    Steffi

    Ok, maybe somebody knows the problem when I'm posting some images. I made a screenshot of my InDesign XML and after you can see my XML-File.
    And here's my XML-File:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Lage>
        <wohnlage>Gute Wohnlage im Grenzbereich zu sehr guter Wohnlage</wohnlage>
        <Lagebeschreibung>Der Mornroe-Park liegt in einer guten Wohnlage. Die blauen Punktelinien zeigen die Grenzen der PLZ-Bereiche.Der Monroe Park liegt im Grenzbereich zwischen PLZ 14167 und 12205.</Lagebeschreibung>
        <Legende href="H:\05_1Produkte\2010\005_Riskanalyser2010\Karten\Lagelegende.png"/>
        <Lagekarte href="H:\05_1Produkte\2010\005_Riskanalyser2010\Karten\20012_Karte.jpg"/>
        <Kartenuntertitel>diese Karte beinhaltet blablabla</Kartenuntertitel>
    </Lage>

  • How to refresh a "SSWA jsp function" ?

    Dear all:
    I change sth in a package "HR_LOA_SS" (the package is "SSWA jsp function" ). What steps should I do to relink the package than make it available?
    Regards
    Edited by: Terry Chen on 2009/12/14 下午 11:06

    Hi,
    Submit "Compile Security" concurrent program from System Administrator responsibility and check then. Bouncing Apache is not required, but you may need to do so in case you cannot see the updated code.
    Regards,
    Hussein

  • How to refresh an Image component

    Hi,
    jdev 1.1.1.5
    I have a parent page with a table to show employees and a tab to show detail of employees
    Detail is in a Region and is sharing the same datacontrol with parent page and i don´t have any parameter in task flow.
    Sincronization Parent - Detail works fine using Partialtriggers.
    Detail Region has a button for upload an image and another button to process the image and an Image component(by servlet) to show it.
    Process button call an operation exposed in AM, This method do Insert or Update in IMAGE TABLE.
    The problem is than image is not refreshed until i do full refresh the page.(but only occurs when updating the image, for insert the Image component show the new image)
    I tried this code at end of process button logic but i can't achieve refresh the image.
      public void saveFileUploaded() {
          oper =
              bindings.getOperationBinding("myMethodInAM");
           Map args = operaImatge.getParamsMap();
           args.put("empId", empId);
           args.put("imatgeBlob", createBlobDomain(file));
          oper.execute();
    // try refresh entire region method 1
           AdfFacesContext.getCurrentInstance().addPartialTarget(JSFUtils.findComponentInRoot("r1"));
       // try refresh image component
           AdfFacesContext.getCurrentInstance().addPartialTarget(JSFUtils.findComponentInRoot("imageEmp"));
      //  try refresh region method 2    
           RichRegion region = (RichRegion)JSFUtils.findComponentInRoot("r1");
           region.refresh(JSFUtils.getFacesContext());
      }Any suggestion?
    Thanks in advance
    Edited by: DV on 03-sep-2011 17:36
    Edited by: DV on 04-sep-2011 11:33

    Hi,
    I have updated the use case at first message.
    you wrote
    you have a binding to the component that is holding the image.. and then refresh the container region..
    that would refresh the image inside.
    can you give two cents?
    i just created a binding for image component but
    what must i do?
    Remember
    the button for process image (operation exposed in my AM service) and Image component(by servlet) are in the same .jsff.
    Means the changes occurs in same jsff without interaction with parent page.
    Thanks,
    Edited by: DV on 04-sep-2011 11:43

  • How can  i set a image dinamically in a image component (ADF Mobile)?

    Hello everybody,
    I have to consume a rest service and get a url. This url is redirected to one image. After reading this image, how can i set he in a adf mobile image component?

    Hi,
    bind the mobile image component URL to a managed bean and have the managed bean. Then use the bean setter to set a new URL string and ensure (when creating the Java class for the managed bean) you have JDeveloper creating the property change event handlers.
    Frank

Maybe you are looking for

  • RAC on Windows Server 2008 R2 - which edition is necessary

    Hello, which Windows Server 2008 R2 edition is required to install RAC - standard or enterprise (NOT database edition - windows server 2008 edition)? If we want to implement RAC 11Gr2 Enterprise Edition does the operating system also has to be enterp

  • Pasting Attributes with Title 3D? - A follow up inquiry

    Hello All, The other day I asked whether it is possible to copy and paste attributes from a text 3D title to another. The answer/solution offered was to take a "master" format, and then change the specific names and titles in each clip. I keep thinki

  • How to Select multiple photos in photos

    Context: I use my ipad to import/backup photographs when on a shoot - so I'll use the camera connector to import RAW+jpg files - sometimes lots (maybe 1500 in a day). This is really useful - I can do picks in the evening and then import back to my co

  • HT204088 i am having a problem with my previous payment, its not excepting it?

    i am having a problem with my previous payment, its not excepting it?

  • Accessing bean properties in a jsp

    Hi, I am trying to access a bean in my jsp page like this, <c:out value="${clientSession.customerName}"/> I validate and then set the bean in my action class, I am using struts 1.1, package com.neo.five.ereports; import org.apache.struts.action.Actio