Announcement

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

    struts redirect on tab selection

    Hello Isomorphic,

    We are using Smart Client 8.3. We currently use struts in our application and have a Smart Client page (abc.do) that will have different SmartClient tabs using TabSet. Is there a way to call a different struts action (basically redirect to a different URL) based on the tab that is clicked and selected? abc.do can be the default first tab, then the second tab would be xyz.do, for example.

    Thanks.

    #2
    Are you doing this for some kind of legacy reason? It's completely the wrong architecture.

    Your code for the TabSet and it's pane should be a plain .js file that can be cached. It should load any necessary data when the pane is shown, using DataSource. The actual data loading requests *could* go through Struts, but there's little point to doing this.

    See the SmartClient Architecture topic for more background information.

    Comment


      #3
      We have this working like you explain below where our Tab pane is a JS component and data is loaded in our SmartClient components within that canvas using fetchData().

      However, we are thinking of changing that since we want to be able to remember bookmarks and so that we can load data using initialData set in the request. initialData could be different in different data sources within the tabs.

      I took a look at the History component too but that doesn't provide exactly what we need described above.

      Comment


        #4
        History is the right way to do this. If you think it's not solving this problem, you should take a second look.

        Calling a Struts action on every tab transition is an architectural misstep that will be compounded into more and more problems if you start down this path. The tip of the iceberg is that the tabs are going to reload every time they are shown, which is a waste of resources and makes the user wait, and also means that every bit of state they have is going to need to be saved or it will be lost.

        Comment


          #5
          Using History, is there a way to use query parameters in the URL (tab=tab1) versus anchors (#tab1)?

          Comment


            #6
            You don't need to use History to do that, you just go to the new URL in the normal fashion (typically window.location.replace()).

            But doing this is a page transition, so all JavaScript state is lost. That's why you should use History instead.

            Comment

            Working...
            X