Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Dynamic URLs in Background Images

    Hi

    I'm using latest smart-gwt-2010-10-10 Build. I'm trying to load background images from rest web service. But the background images are not appearing if I deploy the application in any web or application server. It's working in Eclipse-GWT plugin server.

    In the same place If I use some literal, then the code is working fine.

    Example:
    canvas.setBackgroundImage(images[0]); //not working in external web server server

    Here images array , is loaded from web services call.
    or

    setBackgroundImage("images/back.jpg"); //working

    or

    String image="['product/cube.jpg']";
    JSONArray r=new JSONArray(image);
    c.setBackgroundImage(images.getString(0)); //Not Working



    I'm not able to see the difference where I'm doing wrong. Please suggest me.

    -raghu
    Last edited by visumagic; 4 Nov 2010, 22:34.

    #2
    Final Simple Test case in tomcat and Glassfish servers:

    The following app is not loading the images on to browser. I'm really worried now :(. This code works perfectly in Eclipse+GWT Plugin Server.



    Code:
    public class TestWeb  implements EntryPoint{
    public void onModuleLoad(){
    		
    		try {
    			String image="['http://www.ishs.org/news/wp-content/uploads/2010/07/apple.jpg']";
    			
    			JSONArray r = new JSONArray(image);
    			String[] images=JSONUtil.toStringArray(r);
    			Img img=new Img();
    			img.setSize("100", "100");
    			img.setSrc(images[0]	);
    			RootPanel.get().add(img);
    		} catch (JSONException e) {
    			e.printStackTrace();
    		}
    		
    	}
    }
    Please help me :(

    -raghu

    Comment


      #3
      Issue fixed.

      This is because of custom json api. Work around is to use json api from gwt. This is very nasty issue. Took one complete day to find out root cause.

      -thanks
      rgahu

      Comment

      Working...
      X