6 Replies Latest reply on Jul 1, 2008 10:36 PM by irun5k

    problem using loadScript

    irun5k

      Hello all, I'm having a horrible time getting a4j:loadScript to work. I've tried many variants and also tried putting my javascript file just about everywhere I can think of.

      I'm assuming I should either see a reference to my functions.js file in the rendered page, or the content included inline? I'm not seeing either.

       <a4j:loadScript src="/civdef/scripts/functions.js"/>
      
       <f:view contentType="text/html">
       <rich:gmap oninit="configureMap(map)" gmapVar="map" zoom="5"
       style="width:800px;height:600px"
       gmapKey="xxx"
       id="gmap" />
       </f:view>


      and I've verified my script is available via a browser at
      http://localhost:8080/civdef/scripts/functions.js

      I've also tried many other variants, such as
      src="functions.js"
      src="scripts/functions.js"
      src="/scripts/functions.js"
      and versions using resource://, etc.
      ...in each case putting the files in the proper places. At this point I have a copy of my script file in every directory in my war.

      Which makes me think something else is up. I'm trying to call a function in functions.js to configure my google map, as you can see. Maybe this is the part that is broken, but like I say, I don't see any evidence that my script was included when I view the source. Let me also say this is running in a portlet, and I'm using a portlet bridge.

      Thanks.

        • 1. Re: problem using loadScript

          where is a "scripts" folder located?

          if it is on the top of the web root, it should be only like that:
          < a4j:loadScript src="/scripts/functions.js"/ >

          • 2. Re: problem using loadScript
            irun5k

            < a4j:loadScript src="/scripts/functions.js"/ > doesn't work. I have also tried

            <a4j:loadScript src="/civdef/scripts/functions.js"/>

            because this is how you access it via a browser (since I have a jboss-web.xml:

            <jboss-web>
             <context-root>civdef</context-root>
            </jboss-web>


            I've also tried every other iteration of relative and absolute paths. So somehow I need to troubleshoot this more. Is there something I can look for in the rendered page source? like,
            <script type='text/javascript' src='something'/>

            or something else?

            Thanks

            • 3. Re: problem using loadScript
              irun5k

              Late night session of grasping at straws here, but when I used the archetype to create my project, it gave me the following in web.xml.

              <context-param>
               <param-name>org.richfaces.LoadScriptStrategy</param-name>
               <param-value>NONE</param-value>
               </context-param>


              Does "NONE" affect loadScript calls? Below is the only docs google can find for this parameter, and it doesn't help me understand what the param does (in fact the sentence doesn't really make sense to me...)

              The third possible value is "NONE". You have no a special reason to use it unless you obtain the newest (or modified) version of the script and want to include it manually in a page header.


              • 4. Re: problem using loadScript
                irun5k

                I finally reverted to a non-portal implementation- just straight RichFaces/Sun RI/Facelets. Immediately, my loadScript started working, with zero further effort.

                Seems there is a bug somewhere (or at the least, an undocumented nuisance) between the many APIs at play here, but I haven't a clue which one or where.
                However it is definitely some combo of richfaces/Sun RI/facelets/portlet bridge/portlets.

                • 5. Re: problem using loadScript

                  Why you have never said that it was a portal environment? What the type of portal. What is the version of it?

                  • 6. Re: problem using loadScript
                    irun5k

                     

                    "SergeySmirnov" wrote:
                    Why you have never said that it was a portal environment? What the type of portal. What is the version of it?


                    Thanks for the reply... if you see my first message, I said,
                    Let me also say this is running in a portlet, and I'm using a portlet bridge.

                    However, no worries :) jboss-portal-2.6.5.SP1