3 Replies Latest reply on Apr 29, 2005 6:22 PM by Roland Brown

    JSP Java Script problem setting java script variables dynami

    Roland Brown Newbie

      I am writing a product that is using a tab menu for navigation. I am using some third party software that combines java script and cascading style sheets to create the tab menus with. Each tab can have one or more tabs.

      I am also using struts and strut tiles in the tool.

      I need to figure out a way of contolling which tab and subtab should be marked as the currently active ones. The java script that is used to create the tab strip menu has two variables that are used to determine the currently active tab and subtab. I can default the values so that when I go to the first page the selected tab and subtab match the current page I am on.



      I need to come up with a way to softcode those two java script variables within each jsp so that the jsp will determine which tab and subtab is currently active.



      My code has the following include.









      The tab-menu-mac.js script includes the two hard coded variables.

      var bselectedItem = 0;

      var bselectedSmItem = 1;



      I tried commenting the above two variables out of the tab-menu-mac.js file and including them as part of the script as follows so the the jsp could determine what the current tab and subtab is.



      <script type="text/javascript" language="JavaScript1.2"

      var bselectedItem = 0

      var bselectedSmItem = 1

      src="/webquotes10/jsp/users/admin/js/tab-menu-mac.js">



      IntelliJ didn?t have any errors but when I tried to use it in a web page I got the message that bselectedItem was undefinded. It is like the two variables I defined outside of the tab-menu-mac.js file are isolated in their own unit that cannot be seen by the code in the tab-menu-mac.js file.


      Does anyone have any ideas how to do this. I received an email from the third party vendor and this is what they had to say.

      About selected tabs.
      You should use

      var bselectedItem = >= 0;
      var bselectedSmItem = >= -1;

      parameter to set default selected item and subitem.
      You can use any server-side script, for example, php, to assign these parameters each time when a new page is loading.

      I am assuming in my case I can use JSP to set the parameters but I just haven't figured it out yet.

      Thanks for any help.



        • 1. Correction to my question.
          Roland Brown Newbie

          I am writing a product that is using a tab menu for navigation. I am using some third party software that combines java script and cascading style sheets to create the tab menus with. Each tab can have one or more tabs.

          I am also using struts and strut tiles in the tool.

          I need to figure out a way of contolling which tab and subtab should be marked as the currently active ones. The java script that is used to create the tab strip menu has two variables that are used to determine the currently active tab and subtab. I can default the values so that when I go to the first page the selected tab and subtab match the current page I am on.



          I need to come up with a way to softcode those two java script variables within each jsp so that the jsp will determine which tab and subtab is currently active.



          My code has the following include.

          <script type="text/javascript" language="JavaScript1.2"
          src="/webquotes10/jsp/users/admin/js/tab-menu-mac.js"


          The tab-menu-mac.js script includes the two hard coded variables.

          var bselectedItem = 0;
          var bselectedSmItem = 1;

          I tried commenting the above two variables out of the tab-menu-mac.js file and including them as part of the script as follows so the the jsp could determine what the current tab and subtab is.

          <script type="text/javascript" language="JavaScript1.2"
          var bselectedItem = 0
          var bselectedSmItem = 1
          src="/webquotes10/jsp/users/admin/js/tab-menu-mac.js">


          IntelliJ didn?t have any errors but when I tried to use it in a web page I got the message that bselectedItem was undefinded. It is like the two variables I defined outside of the tab-menu-mac.js file are isolated in their own unit that cannot be seen by the code in the tab-menu-mac.js file.


          Does anyone have any ideas how to do this. I received an email from the third party vendor and this is what they had to say.

          About selected tabs.
          You should use

          var bselectedItem = >= 0;
          var bselectedSmItem = >= -1;

          parameter to set default selected item and subitem.
          You can use any server-side script, for example, php, to assign these parameters each time when a new page is loading.

          I am assuming in my case I can use JSP to set the parameters but I just haven't figured it out yet.

          Thanks for any help.

          • 2. <script> tags
            Roland Brown Newbie

            Sorry I don't know why they didn't show in the previous post. I have ended all of the tags with the closing tag.

            • 3. I will get this right yet.
              Roland Brown Newbie

              I did end all of the

              <script>
              


              tags with

              </script>
              


              tags.