Announcement

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

  • Setting/defining resource(css, image, etc) loacation

    Hi,
    I'm trying to separate location of the jsp file which includes compiled js from js itself into two different directories. It seams that after loading the location of the resources is some how hard coded and browser tries to load the css and images from the path of the jsp.

    Same problem might happened if i have 2 different modules and i want to share the resources between them.

    Any way to solve this ?
    Any workaround ?

    Thanks
    Alided

  • #2
    I believe this is a GWT issue which is targeted for the 1.6 release which should be out soon. I'll try digging up that issue in GWT tracker.

    Sanjiv

    Comment


    • #3
      Hi Sanjiv,
      I don't think it's GWT issue, i did the same thing in ext-gwt and it was working, I think the difference is that in ext-gwt i could manually include css either into jsp file with arbitrary location or put it inside *.gwt.xml with different location, so question is can i do the same for smartGWT ?

      Thanks

      Comment


      • #4
        I think that you should set isomorphicDir. Also, inherit your module from SmartGWTNoScript:
        Code:
            <!-- If you decide to declare the js files in the html use SmartGwtNoScript -->
            <!-- Only includes SmartGWT API's without JS and skins.
            User will need will need to separately inherit SmartClient and skin modules as desired,
            or add the JS and skin includes in their host html.
            -->
            <inherits name="com.smartgwt.SmartGwtNoScript"/>
        And in your html / jsp:

        Code:
        <SCRIPT>
        window.isomorphicDir='<%=myBase%>/static/gwt/smartgwt/js/sc/';
        </SCRIPT>
        
        <!--include the SC Core API-->
        <script src=static/gwt/smartgwt/js/sc/modules/ISC_Core.js?isc_version=7.0beta.js></script>
        
        <!--include SmartClient: only include the js files you need -->
        <script src=static/gwt/smartgwt/js/sc/modules/ISC_Foundation.js?isc_version=7.0beta.js></script>
        <script src=static/gwt/smartgwt/js/sc/modules/ISC_Containers.js?isc_version=7.0beta.js></script>
        <script src=static/gwt/smartgwt/js/sc/modules/ISC_Grids.js?isc_version=7.0beta.js></script>
        <script src=static/gwt/smartgwt/js/sc/modules/ISC_Forms.js?isc_version=7.0beta.js></script>

        Comment


        • #5
          Thanks la123. I think that what i'm looking for!!!! I'll try it today.

          Comment


          • #6
            Any updates on this? Were you able to try it out?

            Comment


            • #7
              It's not working for me. I used
              Code:
              <inherits name="com.smartgwt.SmartGwtNoScript"/>
              and
              Code:
              <script>var isomorphicDir = "/company/secure/net.company.ui.TestView/jsXXXXX/sc/"</script>
              
              <script type="text/javascript">
                document.write("<"+"script src=net.company.ui.TestView/jsXXXXXXX/sc/skins/" + currentSkin + "/load_skin.js?isc_version=7.0beta.js><"+"/script>");
              </script>
              when the app loads and i view an image properties, i get this url:
              Code:
              http://localhost:8880/company/secure/js/sc/skins/standard/images/TreeGrid/opener_opened.gif
              XXXXX is completely ignored. The url is being picked up from somewhere else.

              Comment


              • #8
                I traced it down to the "sc" value not being initialized properly. It
                looks like the
                default sc dir is specified under WEBAPP. Where GWT1.6 created sc is under
                WEBAPP/MODULE_NAME/sc/.

                WORKAROUND:
                =============
                All I had to do to make this work was:

                Add the following to your host html file before the nocache.js script tag.
                <script>
                var isomorphicDir = "[MODULE_NAME]/sc/";
                </script>

                Where MODULE_NAME is the module you are building.


                SEE
                http://code.google.com/p/smartgwt/issues/detail?id=36
                http://code.google.com/p/smartgwt/issues/detail?id=139
                Last edited by atifkhan; 2nd Mar 2009, 17:05.

                Comment


                • #9
                  I'm using GWT 1.5.3 and SmartClient 7.0b2. When adding
                  <script>
                  var isomorphicDir = "[MODULE_NAME]/sc";
                  </script>

                  I found that it needed a trailing slash like {MODULE_NAME]/sc/ and this worked when I deployed the application but I could not get it to work in hosted mode.

                  I was able to use the Enterprise skin by adding the following to my module file.

                  <inherits name='com.smartclient.theme.enterprise.Enterprise' />

                  It looks similar to the standard skin but indeed more enterprise like.

                  Thanks,
                  Eric

                  Comment


                  • #10
                    Thanks erickr!

                    I have corrected the post. Also there is a link to a zip file that has the sample helloworld working for both GET 1.6 and GWT 1.5 with SMARTGET 1.0b2 fo both hosted and compiled mode. The ant script can launch the hosted mode (Please remember to update the ant properties (at the top of the build.xml file) before running the ant scripts.

                    http://smartgwt.googlecode.com/issues/attachment?aid=-1767778415466536332&name=gwt.zip

                    Comment

                    Working...
                    X