4 Replies Latest reply on Dec 8, 2004 6:22 PM by chrismalan

    Very weird Windows problem

    chrismalan

      Hi All,

      I posted this to the Sun JSP forum but got no replies. My web-application runs on JBoss-3.2.0/Jetty - I must first get comfortable with the latest JBoss/Tomcat offering before I run something in it.

      As this is a sticky problem there were no replies on the Sun JSP forum. Anybody on this forum has the faintest idea what is going on?

      This is a tricky one. There are vehicle objects in the database. Some are cars, some 4wd's, some trucks, some motorcycles etc. The first objective is to get all the makes of a certain category - cars, 4wd's etc.
      This is done with the following code in a cmp ejb:

      public String ejbHomeListMakes(String category){
      try{
      Collection collection = this.ejbSelectMakes(category);
      //To get them in alpahbetical order
      List s = new LinkedList(collection);
      Collections.sort(s);
      Iterator iter = s.iterator();
      if(iter.hasNext()){
      StringBuffer make = new StringBuffer(256);
      while(iter.hasNext()){
      make = make.append("\"" +(String)iter.next() + "\",");
      }
      // Remove the trailing comma
      make = make.deleteCharAt((make.length() - 1));
      return make.toString();
      }
      else
      return new String("");
      }

      This string (in the format "Audi","BMW","Chevrolet", etc) is returned to a JSP by the following code:
      Note that it is a mixture of JavaScript and Java

      function loadMakesAndModels(toLoad){
      if(document.getElementById){
      /* First to create all the JavaScript array objects
      * The car makes and models */
      <% String cmakes = makesAndModelsBean.getMakes("car");
      if(cmakes.length() > 2){%>
      var carMakes = new Array("Choose","Any",<%= cmakes %>);

      Now, in every browser on my Linux side this works perfectly. Also, for MSIE 6.x on my Windows 98 SE side it works perfectly. The returned code in the page returned from the server looks like this:

      var carMakes = new Array("Choose","Any","Audi","BMW","Daewoo","Daihatsu","Ford","Holden","Honda"," Hyundai","Kia","Mazda","Mercedes Benz","Mitsubishi","Nissan","Proton","Saab","Seat","Subaru","Suzuki","Toyota","Volkswagen");

      This also works in Windows 2000 with MSIE 6.x Unfortunately it does not work with either MSIE 6.x or FireFox in Windows XP (I do not know what patches or updates have been applied) or with MSIE 6.x in Windows 98 - I suspect not Second Edition, on another machine. This other machine is pretty neglected most likely in need of disk defragmentation and clean-up. But that should not make any difference to what is returned to the browser from the server.

      Some cars makes are always consistently missing, namely the Audi, BMW, Daewoo, Subaru and a few others. I have looked at the code, these makes are indeed missing - the same ones every time.

      Now, as we all know the browser never sees a Java Server Page. Only pure HTML (with JavaScript) is returned to it from the server.

      So how is it possible that different pages are returned to browsers on different operating systems? Truly, this beats me.

      You can go and have a look at this site at here The code is in the top frame. It is loaded only once when this page is first requested. Search only for NSW (state) and Newcastle and Hunter (regions).

      Is it the server? How does the server (JBoss-3.2.0/Jetty) know to send crooked code to certain Windows machines? I don't check for the OS in my code. Maybe it doesn't like Windows or has somthing personal against Bill Gates.

      What the devil is going on here and how do I fix it? I don't think the answer is simple.

      Thanks very much for scratching your heads on this one.

      Chris

        • 1. Re: Very weird Windows problem
          raist_majere

          Using Windows XP and MSIE 6.x (with SP2) and everything worked ok on the page you've given...

          • 2. 3857667
            chrismalan

            Thanks Raist_Majere,

            It is most likely the (with SP2) that makes the difference.

            I just installed Windows 98 SE Updates on the offending Windows 98 machine which solved all problems.

            Any idea what is behind this strange behaviour?

            Chris

            • 3. Re: Very weird Windows problem
              raist_majere

              No idea, but I would bet for Javascript issues in the browser... Because the server for sure sends always the same, so... ;-)

              • 4. Re: Very weird Windows problem
                chrismalan

                I thought the same, but there are a few things against that:
                1)I've looked at the returned JavaScript array when there are values missing. They are indeed missing from the returned array - always the same ones.
                2)Just updating Windows98 to Windows98 Second Edition fixed the problem. This machine already had a MSIE 6.x to start with which is post Second Edition - so the browser was not touched.
                3)The offending WindowsXP machine has the browser that came with Windows XP, a late one.
                4)For testing purposes FireFox was installed on the Windows XP machine. It produced exactly the same mistakes. FireFox on my son's Windows 98 SE machine works fine.

                Maybe I should go to the root of all evil - Microsoft ;)
                They should have developer forums.

                Please let me know if a flash of inspiration reveals all to you. On this one I am very uninspired.

                Regards,

                Chris