Announcement

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

    HTMLFlow usage

    I am trying to use SmartGWT with an existing Struts application. I was experimenting by putting a existing page into an HTMLFlow widget. It loads the page okay. I have one web app context for the existing app and one for the new SmartGWT app.

    Code:
    HTMLFlow loginHtml = new HTMLFlow();
    loginHtml.setWidth100();
    loginHtml.setContentsURL("/oca/");
    loginHtml.setLoadingMessage("Loading...");
    //loginHtml.setContentsType(ContentsType.PAGE); // default is fragment
    loginTab.setPane(loginHtml);
    This loads the page from the "oca" context but all the relative resources such as css and images then try to get loaded like the following.

    [gwt app context]/[Module]/[Relative path in page]

    example:
    http://localhost:8888/oca-gwt/com.ray.oca.gwt.OcaApplication/images/rtn_logo.gif

    I tried both treating it like a page and a fragment with the same results.

    I'm really trying to come up with a strategy. I would like to just have one page and somehow try to consume the struts pages but I also could use the existing tiles to replicate the outside of the page and just insert the struts content. Sort of mind bending mixing Web 2 with Web 1.

    Any suggestions welcome, Thanks.

    #2
    Shouldn't relative URLs be relative to the HTML file loaded, not to the module loaded?

    Comment


      #3
      They would be with contentsType:"page", which is an IFrame. If you thought otherwise, re-test. However it's hard to recommend that as a strategy for real production use, it will work for only limited use cases (see some of the issues listed in the docs).

      Comment


        #4
        I do realize the short comings of this method. I tried setting contentType to "page" as in the commented out code and the Loading message didn't show as advertised and the referenced images and CSS are now pulled relative to the requested page.

        The HTMLFlow component does not load content from different ports or base URIs either and at least in hosted mode outputs a message about the same origin policy and refuses to load. I did not try in deployed mode.

        Thanks.
        Last edited by erickr; 3 Mar 2009, 14:41.

        Comment


          #5
          Hello Smart Client experts,

          I have still been looking at how to integrate a new SmartGWT app with a older struts application. I have read the documents and the threads (containing warnings) about contentsType: "page" using iframes with the HTMLFlow. It seems that to use "fragment" the HTML should be well formed but without html/head/body but my current app has scripts, css etc in head. Also, I would have to merge the two web applications so that relative paths would work using "fragment". If I use a relative url to load the struts content using "fragment", it uses the gwt app context to try and load the reference images etc from the content url. The two are in separate web apps currently.

          Using Tabs I am able to isolate the Struts flows within the tabs with good results. Of course all the content is controlled and all the navigation is contained in the pages. The only problem I see now is that with the html.setAllowCaching(true); set, the page reloads with each resize of the browser. Perhaps this is caused by the following in each JSP page.

          <% //This line is added to stop the Page Expired error when using POST
          response.setHeader("Cache-Control", "no-cache"); %>

          I have no idea if this is really necessary - I inherited this app and it works so I didn't think much about this setting until now.

          I really need a preferred solution. The current approach seems to work fine as everything loads quickly and renders great but I don't want this app to just crash or not work either. I can't really rewrite the whole application at this time but I really want to take advantage of Smart GWT. It really is nice.

          Questions.

          What is the difference between the iframe approach and just having a bunch of browser tabs or windows open relative to memory usage, stability etc?

          If the current application is relative basic with no other JavaScript frameworks messing with the zindex etc. does this help?

          Thanks for your suggestions,
          Eric

          Comment

          Working...
          X