IndexOf problem

Hi guys I did use this code to read the html file and it work fine but when i try to add the restriction to it
(indexOf) i do get problem as it gives "String index out of range: -1" error
i am trying to return the string between any ">" and "<" in the html file ,which exists in the html file,
tanks in advance
public String  viewpageBody(String newURLStr)
      try {
         URL example = new URL (newURLStr);
      BufferedReader in = new BufferedReader(
                              new InputStreamReader(
                              example.openStream()));
      String Nexthtml="";
      String inputLine="";
      int sstar=1;
      while ( ( inputLine != null ) && ( aborted == false ))
                    inputLine = in.readLine().toLowerCase();
                   if ( inputLine != null )
                                  {      System.out.println(inputLine);
                                       int star=      inputLine.indexOf( ">",sstar);
                                System.out.println(star);
                                int ref=       inputLine.indexOf("<",star);
                                 System.out.println(ref);
                                sstar=ref;
             String Bodyweb =      inputLine.substring( star,ref);
                         //     inputLine = stopWord( Bodyweb ); // do some manipulation
                         //      System.out.println(inputLine);
                                   Nexthtml += Bodyweb; // add up string
      in.close();
  return Nexthtml;   
       catch (Exception e) {
            System.out.println("File error: "+e);
     return "";                     
}

what are the results of your System.out.println's? If one of your index is -1 then a failure could happen...

Similar Messages

  • If argument with a tiny indexOf problem

    These values get through the argument:
    may
    may/jun
    and get separated
    This does not:
    may/jun/jul
    What am I doing wrong here?
    function Blomstring(ar){
    var newAr = [];
    var newData = [];
    var findEl = false;
    var el = "";
    for(var i=0; i<ar.length; i++){
    findEl = false;
    el = ar[i]['Blomstring'];
    if(el == '' || el.indexOf('/')!=-1){
              continue;
              for(var j=0; j<newAr.length; j++){
                        if(newAr[j]==el){
                        findEl = true;
    if(findEl==false){
    newAr.push(el);

    To make it short:
    I have list1 that is populated with plant names.
    Then I have list2 which is connected to the function shown above, that will filter plants that that bloom in specific months.
    My large xml file has however plants that bloom not only in may, but may/jun, may/jun/jul etc.
    The if argument in the code shown above makes may/june, show up correctly as both may and jun in filter list2, and it filters list1 correctly. But may/jun/jul, or jul, or jul/aug doesn't show in the filter list2
    The problem arises when i have 2  "/" like in jun/jul/aug
    if(el == '' || el.indexOf('/')!=-1){
              continue;
    Here is the full function:
    function Blomstring(ar){
    var newAr = [];
    var newData = [];
    var findEl = false;
    var el = "";
    for(var i=0; i<ar.length; i++){
    findEl = false;
    el = ar[i]['Blomstring'];
    if(el == '' || el.indexOf('/')!=-1){
              continue;
              for(var j=0; j<newAr.length; j++){
                        if(newAr[j]==el){
                        findEl = true;
    if(findEl==false){
    newAr.push(el);
    newAr.sort();
              for(var k=0; k<newAr.length; k++){
              newData.push({'label':newAr[k]});
    list2.dataProvider = new DataProvider(newData);
    Blomstring(a);
    list2.addEventListener(Event.CHANGE, change4);
    function change4(event:Event):void {
    searchInput.text = "";
    filterBlomstring(list2.selectedItem.label,a);
    //Deselects the other filter lists
    list3.selectedIndex = -1;
    list4.selectedIndex = -1;
    function filterBlomstring(filter,ar){
    var newData = [];
    var newAr = [];
    var el = "";
    var findEl = false;
              for(var j=0; j<ar.length; j++){
                        el = ar[j]['Blomstring'];
                        if(el.indexOf(filter) != -1){
                                  newAr.push(ar[j]['Botanisk_navn']+'\n'+"-" + ar[j]['Norsk_navn']);
    newAr.sort();
              for(var k=0; k<newAr.length; k++){
              newData.push({'label':newAr[k]});
    //listAr is what is being populated in "list"
    listAr = newAr;
    list.dataProvider = new DataProvider(newData);
    firstRow();

  • IndexOf problems

    i have tried to implement indexOf and it doesnt seem to be displaying the results as i would like them too. i HAVE looked thru the tutorials and such, but it only gives one example, which does not suffice. i just want to do a simple swap with the first and last name. its in method stringKey(). its giving me a blank output.
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Prog4 {
        private String name;
        private String lastName;
        private String firstName;
        private String address;
        private String city;
        private String state;
        private String zip;
        private String old;
        private String income;
        private String trek;
        private String timeStamp;
        private int zipCode;
        private int age;
        private int annIncome;
        private int tracker = 0;
        private int trackNum = 0;
        private long stamp;
        public void Info1 ( )
            name = " ";
            lastName = " ";
            firstName = " ";
            address = " ";
            city = " ";
            state = " ";
            zipCode = 00000;
            age = 0;
            annIncome = 0;
            trek = " ";
            stamp = 1;
            tracker = 0;
            trackNum = 0;
            this.Info( );
        public void showInfo( String lastName, String firstName, String address, String city, String state, String trek, long stamp, int zipCode, int age, int annIncome )
            String  output = "NAME : " + lastName + ", " + firstName +
            "\nADDRESS : " + address +
            "\nCITY : " + city +
            "\nSTATE : " + state +
            "\nZIP : " + zipCode +
            "\nAGE : " + age +
            "\nINCOME : $" + annIncome +
            "\nSTAR TREK MEMBER : " + trek +
            "\nTIME STAMP : " + stamp;
            JOptionPane.showMessageDialog(null, output.toString( ), "MEMBER INFO", JOptionPane.INFORMATION_MESSAGE);
            showNumberOfMembers( trackNum );
        public void showNumberOfMembers( int trackNum )
            String output = "the number of members is : " + trackNum;
            JOptionPane.showMessageDialog(null, output, "# of members", JOptionPane.INFORMATION_MESSAGE);
        //this is the method to switch the names from first name last name, to last name first
        public void stringKey( String name )
            int whitespace;
            whitespace = name.indexOf(" ");
            firstName = name.substring( 0, whitespace);
            lastName = name.substring( whitespace = 1);
        /*public void timeStampKey ( Long stamp )
            int */
        //equals method that isn't to be used
        /*public boolean equals( String name )
             if( this.name == getProg4.name)
                     return true;
             else
                     return false;
        public void Info ( )
            String choice = JOptionPane.showInputDialog("Type '1' to input new member.\nType '0' to exit.");
            int input = Integer.parseInt( choice );
            if ( input == 1 )
                name = JOptionPane.showInputDialog("Enter member name.");
                address = JOptionPane.showInputDialog("Enter member street address.");
                city = JOptionPane.showInputDialog("Enter city member is residing in.");
                state = JOptionPane.showInputDialog("Enter state member is residing in.");
                zip = JOptionPane.showInputDialog("Enter member zip code.");
                zipCode = Integer.parseInt( zip );
                old = JOptionPane.showInputDialog("Enter member age.");
                age = Integer.parseInt( old );
                income = JOptionPane.showInputDialog("Enter member's annual income.\nNO commas please.");
                annIncome = Integer.parseInt( income );
                trek = JOptionPane.showInputDialog("Enter member's favorite Star Trekkee.");
               /* timeStamp = JOptionPane.showInputDialog("Enter today's date and time. (i.e. jan 12 2002 00:00.00)");
                stamp = Long.parseLong( timeStamp );*/
                tracker++;
                trackNum += tracker;
                this.showInfo( lastName, firstName, address, city, state, trek, stamp, zipCode, age, annIncome);
            else
                System.exit( 0 );
        public static void main (String args [ ] )
            String   name, lastName, firstName, address, city, state, zip, old, income, trek, timeStamp;
            int   zipCode, age, annIncome, tracker = 0, trackNum = 0;
            long  stamp;
            Prog4 program = new Prog4( );
            program.Info1( );
    }

    Because you have an '=' instead of '+'. Try this for lastName:
    lastName = name.substring( whitespace + 1);

  • Problem with indexOf ()

    Hi, I have a strange problem with this method.
    I have a some String like this:
    ":8547:Yog.Mora 200g:5123:0.4:0.5:123456789"
    ":8548:Yog.Mora 220g:5123:0.8:0.9:123456789"
    ":8549:Yog.Mora 250g:5123:1.0:1.2:123456789"
    ok now I use indexOf to find when other Strings like this ones has a certaing substring on it. for example the substring "Yog." and works, but the problem is:
    Searching for: "8547" works perfectly.
    Searching for: "547" doesnt works.
    how can this be posible if it finds 8547 it should find 547 but it doesnt, any clue?

    how can this be posible if it finds 8547 it should find 547 but it doesnt, any clue? Your code is wrong, maybe you aren't searching from the start of the String. Anyway, we are wasting time guessing.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.

  • Vector.indexOf(object) problem?

    Hi,
    I'm looping thru a sql resultset with three rows and trying to match values in a column with values in a vector. Even tho the values appear to be perfect matches, I keep getting -1 on all the values.
    <%= vectorRank.indexOf(crsSkill.getobject("Score")) %>
    The vector looks like this.
    [3.4, 1.6, 1.6]
    And the three values of Score in my resultset are 1.6, 3.4 and 1.6 in that order.
    I would have expected to get a result of 1,0,1 yet all three are returning -1.
    Any suggestions?
    Thanks,
    Chris

    I would have expected to get a result of 1,0,1 yet all
    three are returning -1.
    Firstly, i assume you mean 1,0,2 ?
    Aynway a value of -1 returned means that the Object that you are looking for, is not there. Therefore, you have one of two problems. Either the value of the vector cells do not contain what u think they do, or the result set value doesnt.
    Perhaps try testing it by outputting the value each time to see if it is what you think it is.

  • Problems with indexOf reading from an updating string

    String[][] shapeArray = new String[5][2];
    int isCol;
    int isCom;
    String outputsub1 = finoutput;  // finoutput is holding text imported from a file
    String outputsub2;
    for (int y = 0; y < 2; y++)
         for (int x = 0; x < 5; x++)
              isCol = outputsub1.indexOf(":");
                   isCom = outputsub1.indexOf(",");
                  if (x == 4 && y == 1)
                   shapeArray[x][y] = outputsub1.substring((isCol+2));
              else
                       shapeArray[x][y] = outputsub1.substring((isCol+2),isCom);
                  outputsub2 = outputsub1.substring(isCom+2);
                  outputsub1 = (outputsub2);
    }the text imported looks like this...
    Shape: Circle, Position: 100, 250, Size: 130, 130, Colour: Blue, Fill: yes
    Shape: Rectangle, Position: 300, 250, Size: 110, 110, Colour: Red, Fill: no
    i would use a string tokeniser, but i need to use this method. im trying to shorten the string each time so that the indexOf will find the next ":" each time. However when i try and update the string holding the updated data (outputsub1) i get the following error:
    java.lang.StringindexOutOfBoundsException: String index out of range: -8
    at java.lang.String.substring(String.java:144)
    at ReadFile.init(ReadFile.java:52)
    at sun.applet.AppletPanel.run(AppletPanel.java:353)
    at java.lang.Thread.run(Thread.java:534)
    i hope that makes sense to someone, it only occurs when i add the line..
    outputsub1 = (outputsub2);
    and works fine when i comment it out (although doesnt give the right response obviously.)
    thankyou for any help you can offer

    String index out of range: -8 simply means that you try to access the String at position "-8", which obviously makes no sense. There must be some mistake either in your code or your algorithm. Keep in mind that indexOf returns -1 in case the argument wasn't found - maybe that's the reason for that error.

  • Imsadmin user purge problem ??

    "Hi,
    I am having a prob with purging users of one particular domain .....
    Though I can purge users of all other domains fine !!!
    I am running ims5.2 hf 2.07
    The errors I get are :
    admin-serv/logs/error
    ====================
    [22/Sep/2005:10:23:54] failure: for host host.abc.com trying to GET /msg-ms/Tasks/operation/cgi_enduser, send-cgi reports: error occurred while sending script output (IO error)
    debug of imadmin purge
    =======================
    hostA # /iplanet/ims52/ndacli/bin/imadmin user purge -D ServiceAdmin -w PASSWORD -n domainAA.com -g 0 -d DOMAINBB.com.com -l userAA -v
    [Debug]: Object = user ; task = purge
    [Debug]: default domain from Properties: domainAA.com
    [Debug]: NDAhost from Properties: hostA.domainAA.com
    [Debug]: NDAport from Properties: 8080
    [Debug]: Login: ServiceAdmin ; PASSWORD ; domainAA.com
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/auth
    [Debug]: To servlet: domain=domainAA.com&username=ServiceAdmin&password=PASSWORD&charsetenc=UTF-8
    [Debug]: cookie => JSESSIONID=hostA.domainAA.com-8%253A43322881%253A77a742bb2315863;path=/
    [Debug]: cookie => ssogrp1-nda45=hostA.domainAA.com-8%253A43322881%253A77a742bb2315863;domain=.domainAA.com;path=/
    [Debug]: In getObjTaskArgs for: user; purge
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/climap
    [Debug]: Sending to servlet: task=purge&object=user
    [Debug]: getObjTaskArgs Status: 0
    [Debug]: Number of servlets: 2
    [Debug]: Servlet Name: TaskManager
    [Debug]: Servlet args: task=PurgeUser
    [Debug]: Servlet args: objecttype=User
    [Debug]: Valid Options Array: 4
    l, true, *, true, true, user's uid, userkey,
    d, true, , false, true, DNS domain name, domainname,
    g, true, 10, false, true, grace period (days), purgegrace,
    P, false, , false, true, preview only, don't purge, preview=yes,
    [Debug]: Servlet Name: TaskManager
    [Debug]: Servlet args: task=PurgeUser
    [Debug]: Servlet args: objecttype=MailUser
    [Debug]: Servlet args: strip=yes
    [Debug]: Valid Options Array: 4
    l, true, *, true, true, user's uid, userkey,
    d, true, , false, true, DNS domain name, domainname,
    g, true, 10, false, true, grace period (days), purgegrace,
    P, false, , false, true, preview only, don't purge, preview=yes,
    [Debug]: argVal =userAA
    [Debug]: MyURLEncoder: input data = userAA
    [Debug]: servCommand =task=PurgeUser&objecttype=User&userkey=userAA
    [Debug]: argVal =DOMAINBB.com.com
    [Debug]: MyURLEncoder: input data = DOMAINBB.com.com
    [Debug]: servCommand =task=PurgeUser&objecttype=User&userkey=userAA&domainname=DOMAINBB.com%2Ecom
    [Debug]: argVal =0
    [Debug]: MyURLEncoder: input data = 0
    [Debug]: servCommand =task=PurgeUser&objecttype=User&userkey=userAA&domainname=DOMAINBB.com%2Ecom&purgegrace=0
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/TaskManager
    [Debug]: To servlet: task=PurgeUser&objecttype=User&userkey=userAA&domainname=DOMAINBB.com%2Ecom&purgegrace=0
    [Debug]: RECV: 1
    [Debug]: RECV: [email protected]: purging user...
    [Debug]: RECV: [email protected]: purge user failed:
    [Debug]: RECV: Failed: unable to parse CGI response: {<HTML><HEAD><TITLE>OK</TITLE></HEAD>
    [Debug]: RECV: <BODY><H1>OK</H1>
    [Debug]: RECV: An error has occurred.
    [Debug]: RECV: </BODY></HTML>
    [email protected]: purging user...
    [email protected]: purge user failed:
    Failed: unable to parse CGI response: {<HTML><HEAD><TITLE>OK</TITLE></HEAD>
    <BODY><H1>OK</H1>
    An error has occurred.
    </BODY></HTML>
    [Debug]: Contacting : http://hostA.domainAA.com:8080/servlet/logout
    [Debug]: Logout ...
    [Debug]: RECV: <html>
    [Debug]: RECV: <head>
    [Debug]: RECV: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    [Debug]: RECV: <META HTTP-EQUIV="Content-Language" CONTENT="en">
    [Debug]: RECV: <script>
    [Debug]: RECV: if(navigator.appName.indexOf("Microsoft") != -1) {
    [Debug]: RECV: document.write('<META HTTP-EQUIV="Expires" CONTENT="Tue, 20 Jul 1971 00:00:00 GMT">');
    [Debug]: RECV: }
    [Debug]: RECV: </script>
    [Debug]: RECV: <title>iPlanet Delegated Administrator</title>
    [Debug]: RECV:
    [Debug]: RECV: <script language="JavaScript">
    [Debug]: RECV: function closeWindow() {
    [Debug]: RECV: if (window.name != "") {
    [Debug]: RECV: window.name = "";
    [Debug]: RECV: }
    [Debug]: RECV: window.close();
    [Debug]: RECV: }
    [Debug]: RECV: function backToStart() {
    [Debug]: RECV: window.top.location = "/nda/default/en/start.htm";
    [Debug]: RECV: }
    [Debug]: RECV: </script>
    [Debug]: RECV: </head>
    [Debug]: RECV:
    [Debug]: RECV: <body bgcolor="#cccccc" link="#666699" vlink="#666699" alink="#333399">
    [Debug]: RECV: <table border="0" width="100%" cellspacing="0" cellpadding="0">
    [Debug]: RECV: <tr><td align="center"><p> </p><table border="0" width="300" cellspacing="0" cellpadding="1" bgcolor="black">
    [Debug]: RECV: <tr><td><table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="white">
    [Debug]: RECV: <tr><td><table border="0" width="400" cellspacing="10" cellpadding="0">
    [Debug]: RECV: <tr><td valign="top"><img src="/nda/default/en/images/messagel.gif" width="32" height="32"></td>
    [Debug]: RECV: <td valign="top"><font face="PrimaSans BT, Verdana, sans-serif" size="-1">
    [Debug]: RECV: You are now logged out.<p>
    [Debug]: RECV: Please close your web browser now!<p>
    [Debug]: RECV: The information you have just seen remains in your Web
    [Debug]: RECV: browser's memory until you close the browser.
    [Debug]: RECV: <form>
    [Debug]: RECV: <input type=button value="Close Browser" onClick="closeWindow()">
    [Debug]: RECV: <input type=button value="Back To Start Page" onClick="backToStart()">
    [Debug]: RECV: </font></td></tr>
    [Debug]: RECV: </form>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </td></tr></table>
    [Debug]: RECV: </form>
    [Debug]: RECV: </body>
    [Debug]: RECV: </html>
    access log
    ===============
    hostA.DOMAINAA.com - - [22/Sep/2005:11:49:02 +0800] "GET /msg-ms/Tasks/operation/cgi_enduser?cmd=deleteuserfolder&object=|enduser&userdn=uid%3DServiceAdmin%2Cou%3DPeople%2Co%3DDOMAINAA.com%2Co%3Disp&userpwd=PASSWD&user=uid%3DuserAA%2Cou%3Dpeople%2Co%3DDOMAINBB.com%2Co%3Disp HTTP/1.0" 200 92 - { - }
    Any body having any clue ....."

    hi,
    I found no restriction of Internal on the mentione page so this is the buglist I found :
    List of bugs verified in iDA1.2p2
    4742853 - unable to edit mailists with name containing single quote
    4613879 - Selected focus when sorting mesage filters.
    4621763 - Domain Organization Users Cannot be Deleted/purged by CLI.
    4733829 - My Account "Set Mail Filter" clicking causes JavaScript Error
    4760708 - RFE: Prevent users from creating filters with same name
    4768794 - RFE: iDA UI should not allow customer to set Gbytes
    4800717 - "OK" and "apply" button does not function any more in particular scenario
    4806086 - RFE: iDA UI should not allow customer to set more than 2147483637 bytes
    4821819 - error when maximazing "Create a user" window
    4907306 - iDA should not display the change password page when the password is already exp
    4911038 - problem in the language of password expiration page
    4940927 - SSO: iDA shows previous user's session when invoked from Webmail
    4949005 - SSO fails between webmail and iDA depends on characters of SessionID
    4968403 - iDA causing web server to consume more CPU
    4986070 - Clicking on 'About' link shows wrong version of delegated administrator
    What is the idacli tar file for?
    With iDA 1.2p2 you will see a file called idacli-1.0-withJRE-us.sparc-sun-solaris2.6.tar which is for the 6.0 customers who never had a imadmin binary. It is not intended as an upgrade for 5.2 customers. So they should not try to install it at all.
    What it is not?
    It is not a version which will work with Web Server 6.1.
    It is tested and supported with Web Server 6.0x (6.0.1, 6.0sp5)
    It is not a version which should be used without Direct LDAP setup in the Messaging Server. (2 negatives, ok, I mean they really should be using Direct LDAP)
    It will not work with Identity Server or schema 2.
    It is not part of Messaging 6.0 (although we tested it for EXISTING customers who are going from Messaging 5.2 to 6.0 and using schema 1, we telll customers they can use the iDA they got from 5.2, and this is the one we mean.)
    Regarding the install, you should use the release notes of the iDA1.2p1
    I'm however, not sure it would solve your problem. I have not found any reference to the described issue which matchess it completely.
    And if the upgrade would solve it it's probably because something is rewritten, not fixed ... but you do not know what caused it. I don't like this myself.
    I suggest you better open a support case so it is determined what the real problem is.
    Cheers, Ben.

  • ArrayList problem ....i can remove my object from my arrayList

    hi all, i am going to remove a object from my array by using arrayList.However, it can`t work properly and did nth for me..i don`t know why...could anyone give me some suggestion and show me what i did wrong on my code ....i stated more detail next to my code...plesae help...
    public class MusicCd
         private String musicCdsTitle;
            private int yearOfRelease;
         public MusicCd()
              musicCdsTitle = "";
              yearOfRelease = 1900;
         public MusicCd(String newMusicCdsTitle)
              musicCdsTitle = newMusicCdsTitle;
              //yearOfRelease = newYearOfRelease;
         public MusicCd(String newMusicCdsTitle, int newYearOfRelease)
              musicCdsTitle = newMusicCdsTitle;
              yearOfRelease = newYearOfRelease;
         public String getTitle()
              return musicCdsTitle;
         public int getYearOfRelease()
              return yearOfRelease;
         public void setTitle(String newMusicCdsTitle)
              musicCdsTitle = newMusicCdsTitle;
         public void setYearOfRelease(int newYearOfRelease)
              yearOfRelease = newYearOfRelease;
         public boolean equalsName(MusicCd otherCd)
              if(otherCd == null)
                   return false;
              else
                   return (musicCdsTitle.equals(otherCd.musicCdsTitle));
         public String toString()
              return("Music Cd`s Title: " + musicCdsTitle + "\t"
                     + "Year of release: " + yearOfRelease + "\t");
    import java.util.ArrayList;
    import java.io.*;
    public class MusicCdStore
       ArrayList<MusicCd> MusicCdList;
       public void insertCd()
            MusicCdList = new ArrayList<MusicCd>( ); 
            readOperation theRo = new readOperation();
            MusicCd theCd;
            int muiseCdsYearOfRelease;
            String muiseCdsTitle;
              while(true)
                    String continueInsertCd = "Y";
                   do
                        muiseCdsTitle = theRo.readString("Please enter your CD`s title : ");
                        muiseCdsYearOfRelease = theRo.readInt("Please enter your CD`s year of release : ");
                        MusicCdList.add(new MusicCd(muiseCdsTitle, muiseCdsYearOfRelease));
                        MusicCdList.trimToSize();
                        continueInsertCd = theRo.readString("Do you have another Cd ? (Y/N) : ");
                   }while(continueInsertCd.equals("Y") || continueInsertCd.equals("y") );
                   if(continueInsertCd.equals("N") || continueInsertCd.equals("n"));
                                                    //MusicCdList.add(new MusicCd(muiseCdsTitle, muiseCdsYearOfRelease));                              
                                  break;
                      //System.out.println("You `ve an invalid input " + continueInsertCd + " Please enter (Y/N) only!!");
       public void displayAllCd()
                    System.out.println("\nOur CD collection is: \n" );
              System.out.println(toString());
       public String toString( )
            String result= " ";
            for( MusicCd tempCd : MusicCdList)
                 result += tempCd.toString() + "\n";
            return result;
       public void searchingMusicCd()
            readOperation theRo = new readOperation();
            String keyword = theRo.readString("Enter a CD `s Title you are going to search : ") ;
            ArrayList<MusicCd> results = searchForTitle(keyword );
              System.out.println("The search results for " + keyword + " are:" );
              for(MusicCd tempCd : results)
                   System.out.println( tempCd.toString() );
       //encapsulate the A
       public void removeCd()
            readOperation theRo = new readOperation();
            String keyword = theRo.readString("Please enter CD `s title you are going to remove : ") ;
            ArrayList<MusicCd> removeMusicCdResult = new ArrayList<MusicCd>();
                  System.out.println("The CD that you just removed  is " + keyword );
              for(MusicCd tempCd : removeMusicCdResult)
                   System.out.println( tempCd.toString() );
       //problem occurs here : i am so confused of how to remove the exactly stuff from my arrayList
       //pls help
       private ArrayList<MusicCd> removeCdForTitle(String removeCdsTitle)
             MusicCd tempMusicCd = new MusicCd();
             tempMusicCd.setTitle(removeCdsTitle);
            // tempMusicCd.setTitle(removeCdsTitle);
            //tempMusicCd.getTitle() = removeCdsTitle;
            ArrayList<MusicCd> removeMusicCdResult = new ArrayList<MusicCd>();
            for(MusicCd currentMusicCd : MusicCdList)
                 if((currentMusicCd.getTitle()).equals(tempMusicCd.getTitle()))
                     // removeMusicCdResult.remove(currentMusicCd);
                         MusicCdList.remove(currentMusicCd);
            removeMusicCdResult.trimToSize();
            return removeMusicCdResult;
       private ArrayList<MusicCd> searchForTitle(String searchString)
            ArrayList<MusicCd> searchResult = new ArrayList<MusicCd>();
            for(MusicCd currentMusicCd : MusicCdList)
                 if((currentMusicCd.getTitle()).indexOf(searchString) != -1)
                      searchResult.add(currentMusicCd);
            searchResult.trimToSize();
            return searchResult;
    import java.util.*;
    public class MusicCdStoreEngine{
         public static void main(String[] args)
              MusicCdStore mcs = new MusicCdStore( );
              mcs.insertCd();
              //display the Cd that you just insert
              mcs.displayAllCd();
              mcs.removeCd();
              mcs.displayAllCd();
              mcs.searchingMusicCd();
    //Acutally result
    //Please enter your CD`s title : ivan
    //Please enter your CD`s year of release : 1992
    //Do you have another Cd ? (Y/N) : y
    //Please enter your CD`s title : hero
    //Please enter your CD`s year of release : 1992
    //Do you have another Cd ? (Y/N) : n
    //Our CD collection is:
    // Music Cd`s Title: ivan     Year of release: 1992
    //Music Cd`s Title: hero     Year of release: 1992     
    //Please enter CD `s title you are going to remove : hero
    //The CD that you just removed  is hero
    //Our CD collection is:
    // Music Cd`s Title: ivan     Year of release: 1992
    //Music Cd`s Title: hero     Year of release: 1992     
    //Enter a CD `s Title you are going to search : hero
    //The search results for hero are:
    //Music Cd`s Title: hero     Year of release: 1992
    //>Exit code: 0
    //Expected result
    //Please enter your CD`s title : ivan
    //Please enter your CD`s year of release : 1992
    //Do you have another Cd ? (Y/N) : y
    //Please enter your CD`s title : hero
    //Please enter your CD`s year of release : 1992
    //Do you have another Cd ? (Y/N) : n
    //Our CD collection is:
    // Music Cd`s Title: ivan     Year of release: 1992
    //Music Cd`s Title: hero     Year of release: 1992     
    //Please enter CD `s title you are going to remove : hero
    //The CD that you just removed  is hero
    //Our CD collection is:
    // Music Cd`s Title: ivan     Year of release: 1992
    //Music Cd`s Title: hero     Year of release: 1992<<-- it is not supposed to display cos i have deleted it from from array     
    //Enter a CD `s Title you are going to search : hero
    //The search results for hero are:
    //Music Cd`s Title: hero     Year of release: 1992<<-- i should have get this reuslt...cos it is already delete from my array
    //>Exit code: 0
    import java.util.*;
    public class readOperation{
         public String readString(String userInstruction)
              String aString = null;
              try
                         Scanner scan = new Scanner(System.in);
                   System.out.print(userInstruction);
                   aString = scan.nextLine();
              catch (NoSuchElementException e)
                   //if no line was found
                   System.out.println("\nNoSuchElementException error occurred (no line was found) " + e);
              catch (IllegalStateException e)
                   // if this scanner is closed
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return aString;
         public char readTheFirstChar(String userInstruction)
              char aChar = ' ';
              String strSelection = null;
              try
                   //char charSelection;
                         Scanner scan = new Scanner(System.in);
                   System.out.print(userInstruction);
                   strSelection = scan.next();
                   aChar =  strSelection.charAt(0);
              catch (NoSuchElementException e)
                   //if no line was found
                   System.out.println("\nNoSuchElementException error occurred (no line was found) " + e);
              catch (IllegalStateException e)
                   // if this scanner is closed
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return aChar;
         public int readInt(String userInstruction) {
              int aInt = 0;
              try {
                   Scanner scan = new Scanner(System.in);
                   System.out.print(userInstruction);
                   aInt = scan.nextInt();
              } catch (InputMismatchException e) {
                   System.out.println("\nInputMismatchException error occurred (the next token does not match the Integer regular expression, or is out of range) " + e);
              } catch (NoSuchElementException e) {
                   System.out.println("\nNoSuchElementException error occurred (input is exhausted)" + e);
              } catch (IllegalStateException e) {
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return aInt;
    }

    //problem occurs hereI'm not sure that the problem does occur within the
    removeCdForTitle() method.
    Your main() method calls removeCd() which obtains the title of
    the CD to be removed (keyword). But remoceCd() never
    calls removeCdForTitle(), so nothing is ever removed.

  • Unknown problem with JSP, JavaScript - Pls help

    Hi Friends,
    I am facing a strange problem. Explained it below. Kindly help me as it is really affecting my work. Thanks in advance.
    I am working on building a web application using jsp, servlet, ejb. the IDE used is WSAD 5.1.2.
    I have the below :
    1 JSP - Input page - for user input entry
    2. Java script1 - For all client side validations
    Java script2 - For handling the data submission to servlet (as selected by user)
    Javascript3 - Header & Menu Bar
    3 Servlet - This actually retrieves the values from the hidden parameters, sets them in session and redirects the control back to the jsp.
    Logic for one small iteration : Two drop downs are there. On selecting the first drop down the second drop down should be populated and the first drop down should display the user selected value.
    1. When the user selects the first drop down onchange() event gets fired which calls a method in the javascript.
    2. In the javascript I set the value of a hidden form field to the selected combo index and submit the form to the servlet
    3. In the servlet, I retrieve the hidden request parameter (Index),
    set the index in session. Do my business logic based on the value of the index. Set the collection (to be displayed) in second drop down in session.
    4. Send the response back to the JSP.
    5. In the JSP, we have a method which is called during the onload() event of the body
    6. This method sets the user selected values in appropriate controls(by taking from session)
    Problem faced: I have a javascript which creates the menu bar for my application and this i've included it in my jsp. I dont know whats wrong with this javascript, when it is commented out the page works perfectly fine. Both the user selected value and the collection are loaded exactly as expected. But when it is included the collection is loaded in the second drop down but the selected index of the first drop down is not set - the drop down gets reset to the default value.
    Also on body load of my jsp, I call a javascript method which sets the current date in one text field of my form. Even this is not working fine when I include this javascript. I don't see any script error in this javascript in my browser though. Strange but guess something basic :(
    I'm sure there is nothing to do with session. I've tried printing the entire flow. The Servlet sets the values correctly in session and they are also correctly available in the JSP page. The JSP also gets loaded with the user selected values but something happens on page load which clears the values to default.
    Am also confused in what way javascript is related to this, coz when I remove it things are working fine.
    Am really helpless here pls do the needful. any help is appreciated.
    Header.js [which includes the menu bar code]
    document.write("<!-- COMMON HEADER CODE -->")
    document.write("     <table id='mplPageHeader' cellspacing='0' cellpadding='2' border='0'>")
    document.write("          <tr> ")
    document.write("               <td rowspan='2' bgcolor='#FFFFFF' width='1%'>")
    document.write("                    <a href='http://www.web.com' target='_top'>")
    document.write("                         <img src='./images/ford.gif' alt='BLogistics' border='0'>")
    document.write("                    </a>     ")
    document.write("               </td>")
    document.write("               <td rowspan='2' class='appTitle' title='Mp' width='1%'>MP&L</td>")
    document.write("               <td class='appTitle' title='M R'>M R</td>")
    document.write("               <td class='pageIdentifier'>"+' '+"</td>");
    document.write("          </tr>")
    document.write("          <tr>")
    document.write("               <td class='pageTitle' nowrap></td>");
    document.write("               <td class='dateInfo' nowrap>Thu Jan 22 2004 12:24 PM</td>")
    document.write("          </tr>")
    document.write("     </table>")
    document.write("<!-- Display Menu Items -->")
    document.write("<div id='navigationMenu'>")
    document.write("     <script type='text/javascript' src='./javascript/MRmenuItem.js'></script>")
    document.write("     <script type='text/javascript' src='./javascript/menuScript.js'></script>")
    document.write("</div>")-------------------------------------------------------
    Menu Bar Code
    var AgntUsr=navigator.userAgent.toLowerCase();
    var AppVer=navigator.appVersion.toLowerCase();
    var DomYes=document.getElementById?1:0,NavYes=AgntUsr.indexOf("mozilla")!=-1&&AgntUsr.indexOf("compatible")==-1?1:0,ExpYes=AgntUsr.indexOf("msie")!=-1?1:0,Opr=AgntUsr.indexOf("opera")!=-1?1:0;
    var DomNav=DomYes&&NavYes?1:0,DomExp=DomYes&&ExpYes?1:0;
    var Nav4=NavYes&&!DomYes&&document.layers?1:0,Exp4=ExpYes&&!DomYes&&document.all?1:0;
    var MacCom=(AppVer.indexOf("mac")!= -1)?1:0,MacExp4=(MacCom&&AppVer.indexOf("msie 4")!= -1)?1:0,Mac4=(MacCom&&(Nav4||Exp4))?1:0;
    var Exp5=AppVer.indexOf("msie 5")!= -1?1:0,Fltr=(AppVer.indexOf("msie 6")!= -1||AppVer.indexOf("msie 7")!= -1)?1:0,MacExp5=(MacCom&&Exp5)?1:0,PosStrt=(NavYes||ExpYes)&&!Opr?1:0;
    var RmbrNow=null,FLoc,ScLoc,DcLoc,SWinW,SWinH,FWinW,FWinH,SLdAgnWin,FColW,SColW,DColW,RLvl=0,FrstCreat=1,Ldd=0,Crtd=0,IniFlg,AcrssFrms=1,FrstCntnr=null,CurOvr=null,CloseTmr=null,CntrTxt,TxtClose,ImgStr,ShwFlg=0,M_StrtTp=StartTop,M_StrtLft=StartLeft,StaticPos=0,LftXtra=DomNav?LeftPaddng:0,TpXtra=DomNav?TopPaddng:0,FStr="",M_Hide=Nav4?"hide":"hidden",M_Show=Nav4?"show":"visible",Par=MenuUsesFrames?parent:window,Doc=Par.document,Bod=Doc.body,Trigger=NavYes?Par:Bod;
    var Ztop=100,InitLdd=0,P_X=DomYes?"px":"";
    var OpnTmr=null;
    if(PosStrt){if(MacExp4||MacExp5)LdTmr=setInterval("ChckInitLd()",100);
              else{if(Trigger.onload)Dummy=Trigger.onload;
                   if(DomNav)Trigger.addEventListener("load",Go,false);
                   else Trigger.onload=Go}}
    function ChckInitLd(){
         InitLdd=(MenuUsesFrames)?(Par.document.readyState=="complete"&&Par.frames[FirstLineFrame].document.readyState=="complete"&&Par.frames[SecLineFrame].document.readyState=="complete")?1:0:(Par.document.readyState=="complete")?1:0;
         if(InitLdd){clearInterval(LdTmr);Go()}}
    function Dummy(){return}
    function CnclSlct(){return false}
    function RePos(){
         FWinW=ExpYes?FLoc.document.body.clientWidth:FLoc.innerWidth;
         FWinH=ExpYes?FLoc.document.body.clientHeight:FLoc.innerHeight;
         SWinW=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth;
         SWinH=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight;
         if(MenuCentered.indexOf("justify")!=-1&&FirstLineHorizontal){
              ClcJus();
              var P=FrstCntnr.FrstMbr,W=Menu1[5],a=BorderBtwnMain?NoOffFirstLineMenus+1:2,i;
              FrstCntnr.style.width=NoOffFirstLineMenus*W+a*BorderWidthMain+P_X;
              for(i=0;i<NoOffFirstLineMenus;i++){
                   P.style.width=W-(P.value.indexOf("<")==-1?LftXtra:0)+P_X;               
                   if(P.ai&&!RightToLeft)
                        P.ai.style.left=BottomUp?W-BorderColor-2+P_X:W-Arrws[4]-2+P_X;
                        P=P.PrvMbr
         StaticPos=-1;
         ClcRl();
         if(TargetLoc)ClcTrgt();ClcLft();ClcTp();
         PosMenu(FrstCntnr,StartTop,StartLeft);
         if(RememberStatus)StMnu()}
    function NavUnLdd(){Ldd=0;Crtd=0;SetMenu="0"}
    function UnLdd(){
         NavUnLdd();
         if(ExpYes){var M=FrstCntnr?FrstCntnr.FrstMbr:null;
              while(M!=null){if(M.CCn){MakeNull(M.CCn);M.CCn=null}
                   M=M.PrvMbr}}
         if(!Nav4){LdTmr=setInterval("ChckLdd()",100)}}
    function UnLddTotal(){MakeNull(FrstCntnr);FrstCntnr=RmbrNow=FLoc=ScLoc=DcLoc=SLdAgnWin=CurOvr=CloseTmr=Doc=Bod=Trigger=null}
    function MakeNull(P){
         var M=P.FrstMbr,Mi;
         while(M!=null){Mi=M;
              if(M.CCn){MakeNull(M.CCn);M.CCn=null}
              M.Cntnr=null;M=M.PrvMbr;Mi.PrvMbr=null;Mi=null}
         P.FrstMbr=null}
    function ChckLdd(){
         if(!ExpYes){if(ScLoc.document.body){clearInterval(LdTmr);Go()}}
         else if(ScLoc.document.readyState=="complete"){if(LdTmr)clearInterval(LdTmr);Go()}}
    function NavLdd(e){if(e.target!=self)routeEvent(e);if(e.target==ScLoc)Go()}
    function ReDoWhole(){if(AppVer.indexOf("4.0")==-1)Doc.location.reload();else if(SWinW!=ScLoc.innerWidth||SWinH!=ScLoc.innerHeight||FWinW!=FLoc.innerWidth||FWinH!=FLoc.innerHeight)Doc.location.reload()}
    function Go(){
         if(!Ldd&&PosStrt){
              BeforeStart();
              Crtd=0;Ldd=1;
              FLoc=MenuUsesFrames?parent.frames[FirstLineFrame]:window;
              ScLoc=MenuUsesFrames?parent.frames[SecLineFrame]:window;
              DcLoc=MenuUsesFrames?parent.frames[DocTargetFrame]:window;
              if(MenuUsesFrames){
                   if(!FLoc){FLoc=ScLoc;if(!FLoc){FLoc=ScLoc=DcLoc;if(!FLoc)FLoc=ScLoc=DcLoc=window}}
                   if(!ScLoc){ScLoc=DcLoc;if(!ScLoc)ScLoc=DcLoc=FLoc}
                   if(!DcLoc)DcLoc=ScLoc}
              if(FLoc==ScLoc)AcrssFrms=0;
              if(AcrssFrms)FirstLineHorizontal=MenuFramesVertical?0:1;
              FWinW=ExpYes?FLoc.document.body.clientWidth:FLoc.innerWidth;
              FWinH=ExpYes?FLoc.document.body.clientHeight:FLoc.innerHeight;
              SWinW=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth;
              SWinH=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight;
              FColW=Nav4?FLoc.document:FLoc.document.body;
              SColW=Nav4?ScLoc.document:ScLoc.document.body;
              DColW=Nav4?DcLoc.document:ScLoc.document.body;
              if(TakeOverBgColor){
                   if(ExpYes&&MacCom)FColW.style.backgroundColor=AcrssFrms?SColW.bgColor:DColW.bgColor;
                   else FColW.bgColor=AcrssFrms?SColW.bgColor:DColW.bgColor}
              if(MenuCentered.indexOf("justify")!=-1&&FirstLineHorizontal)ClcJus();
              if(FrstCreat||FLoc==ScLoc)FrstCntnr=CreateMenuStructure("Menu",NoOffFirstLineMenus,null);
              else CreateMenuStructureAgain("Menu",NoOffFirstLineMenus);
              ClcRl();
              if(TargetLoc)ClcTrgt();ClcLft();ClcTp();
              PosMenu(FrstCntnr,StartTop,StartLeft);
              IniFlg=1;Initiate();Crtd=1;
              SLdAgnWin=ExpYes?ScLoc.document.body:ScLoc;SLdAgnWin.onunload=Nav4?NavUnLdd:UnLdd;
              if(ExpYes)Trigger.onunload=UnLddTotal;
              Trigger.onresize=Nav4?ReDoWhole:RePos;
              AfterBuild();
              if(RememberStatus)StMnu();
              if(Nav4&&FrstCreat){Trigger.captureEvents(Event.LOAD);Trigger.onload=NavLdd}
              if(FrstCreat)Dummy();FrstCreat=0;
              if(MenuVerticalCentered=="static"&&!AcrssFrms)setInterval("KeepPos()",250)     }}
    function KeepPos(){
         var TS=ExpYes?FLoc.document.body.scrollTop:FLoc.pageYOffset;
         if(TS!=StaticPos){var FCSt=Nav4?FrstCntnr:FrstCntnr.style;
              FrstCntnr.OrgTop=StartTop+TS;FCSt.top=FrstCntnr.OrgTop+P_X;StaticPos=TS}}
    function ClcRl(){
         StartTop=M_StrtTp<1&&M_StrtTp>0?M_StrtTp*FWinH:M_StrtTp;
         StartLeft=M_StrtLft<1&&M_StrtLft>0?M_StrtLft*FWinW:M_StrtLft}
    function ClcJus(){
         var a=BorderBtwnMain?NoOffFirstLineMenus+1:2,Sz=Math.round((PartOfWindow*FWinW-a*BorderWidthMain)/NoOffFirstLineMenus),i,j;
         for(i=1;i<NoOffFirstLineMenus+1;i++){j=eval("Menu"+i);j[5]=Sz}
         StartLeft=0}
    function ClcTrgt(){
         var TLoc=Nav4?FLoc.document.layers[TargetLoc]:DomYes?FLoc.document.getElementById(TargetLoc):FLoc.document.all[TargetLoc];
         if(DomYes){while(TLoc){StartTop+=TLoc.offsetTop;StartLeft+=TLoc.offsetLeft;TLoc=TLoc.offsetParent}}
         else{StartTop+=Nav4?TLoc.pageY:TLoc.offsetTop;StartLeft+=Nav4?TLoc.pageX:TLoc.offsetLeft}}
    function ClcLft(){
         if(MenuCentered.indexOf("left")==-1){
              var Sz=FWinW-(!Nav4?parseInt(FrstCntnr.style.width):FrstCntnr.clip.width);
              StartLeft+=MenuCentered.indexOf("right")!=-1?Sz:Sz/2;
              if(StartLeft<0)StartLeft=0}}
    function ClcTp(){
         if(MenuVerticalCentered!="top"&&MenuVerticalCentered!="static"){
              var Sz=FWinH-(!Nav4?parseInt(FrstCntnr.style.height):FrstCntnr.clip.height);
              StartTop+=MenuVerticalCentered=="bottom"?Sz:Sz/2;
              if(StartTop<0)StartTop=0}}
    function PosMenu(Ct,Tp,Lt){
         RLvl++;
         var Ti,Li,Hi,Mb=Ct.FrstMbr,CStl=!Nav4?Ct.style:Ct,MStl=!Nav4?Mb.style:Mb,PadL=Mb.value.indexOf("<")==-1?LftXtra:0,PadT=Mb.value.indexOf("<")==-1?TpXtra:0,MWt=!Nav4?parseInt(MStl.width)+PadL:MStl.clip.width,MHt=!Nav4?parseInt(MStl.height)+PadT:MStl.clip.height,CWt=!Nav4?parseInt(CStl.width):CStl.clip.width,CHt=!Nav4?parseInt(CStl.height):CStl.clip.height,CCw,CCh,STp,SLt;
         var BRW=RLvl==1?BorderWidthMain:BorderWidthSub,BTWn=RLvl==1?BorderBtwnMain:BorderBtwnSub;
         if(RLvl==1&&AcrssFrms)!MenuFramesVertical?Tp=BottomUp?0:FWinH-CHt+(Nav4?MacCom?-2:4:0):Lt=RightToLeft?0:FWinW-CWt+(Nav4?MacCom?-2:4:0);
         if(RLvl==2&&AcrssFrms)!MenuFramesVertical?Tp=BottomUp?SWinH-CHt+(Nav4?MacCom?-2:4:0):0:Lt=RightToLeft?SWinW-CWt:0;
         if(RLvl==2){Tp+=VerCorrect;Lt+=HorCorrect}
         CStl.top=RLvl==1?Tp+P_X:0;Ct.OrgTop=Tp;
         CStl.left=RLvl==1?Lt+P_X:0;Ct.OrgLeft=Lt;
         if(RLvl==1&&FirstLineHorizontal){Hi=1;Li=CWt-MWt-2*BRW;Ti=0}
         else{Hi=Li=0;Ti=CHt-MHt-2*BRW}
         while(Mb!=null){
              MStl.left=Li+BRW+P_X;
              MStl.top=Ti+BRW+P_X;
              if(Nav4)Mb.CLyr.moveTo(Li+BRW,Ti+BRW);
              if(Mb.CCn){if(RightToLeft)CCw=Nav4?Mb.CCn.clip.width:parseInt(Mb.CCn.style.width);
                   if(BottomUp)CCh=Nav4?Mb.CCn.clip.height:parseInt(Mb.CCn.style.height);
                   if(Hi){STp=BottomUp?Ti-CCh:Ti+MHt+2*BRW;SLt=RightToLeft?Li+MWt-CCw:Li}
                   else{SLt=RightToLeft?Li-CCw+ChildOverlap*MWt+BRW:Li+(1-ChildOverlap)*MWt;
                        STp=RLvl==1&&AcrssFrms?BottomUp?Ti-CCh+MHt:Ti:BottomUp?Ti-CCh+(1-ChildVerticalOverlap)*MHt+2*BRW:Ti+ChildVerticalOverlap*MHt+BRW}
                   PosMenu(Mb.CCn,STp,SLt)}
              Mb=Mb.PrvMbr;
              if(Mb){     MStl=!Nav4?Mb.style:Mb;PadL=Mb.value.indexOf("<")==-1?LftXtra:0;
                   PadT=Mb.value.indexOf("<")==-1?TpXtra:0;
                   MWt=!Nav4?parseInt(MStl.width)+PadL:MStl.clip.width;
                   MHt=!Nav4?parseInt(MStl.height)+PadT:MStl.clip.height;
                   Hi?Li-=BTWn?(MWt+BRW):(MWt):Ti-=BTWn?(MHt+BRW):MHt}}
         status="Ready";RLvl--}
    function StMnu(){
         if(!Crtd)return;
         var i,Pntr=FrstCntnr,Str=ScLoc.SetMenu?ScLoc.SetMenu:"0";
         while(Str.indexOf("_")!=-1&&RememberStatus==1){
              i=Pntr.NrItms-parseInt(Str.substring(0,Str.indexOf("_")));
              Str=Str.slice(Str.indexOf("_")+1);
              Pntr=Pntr.FrstMbr;
              for(i;i;i--)Pntr=Pntr.PrvMbr;
              if(Nav4)Pntr.CLyr.OM();
              else Pntr.OM();
              Pntr=Pntr.CCn}
         i=Pntr.NrItms-parseInt(Str);
         Pntr=Pntr.FrstMbr;
         for(i;i;i--)Pntr=Pntr.PrvMbr;
         if(RmbrNow!=null){SetItem(RmbrNow,0);RmbrNow.Clckd=0}
         if(Pntr!=null){SetItem(Pntr,1);Pntr.Clckd=1;
         if(RememberStatus==1){if(Nav4)Pntr.CLyr.OM();else Pntr.OM()}}
         RmbrNow=Pntr;
         ClrAllChlds(FrstCntnr.FrstMbr);
         Rmbr(FrstCntnr)}
    function Initiate(){
         if(IniFlg&&Ldd){Init(FrstCntnr);IniFlg=0;if(RememberStatus)Rmbr(FrstCntnr);if(ShwFlg)AfterCloseAll();ShwFlg=0}}
    function Rmbr(CntPtr){
         var Mbr=CntPtr.FrstMbr,St;
         while(Mbr!=null){
              if(Mbr.DoRmbr){
                   HiliteItem(Mbr);
                   if(Mbr.CCn&&RememberStatus==1){St=Nav4?Mbr.CCn:Mbr.CCn.style;St.visibility=M_Show;Rmbr(Mbr.CCn)}
                   break}
              else Mbr=Mbr.PrvMbr}}
    function Init(CPt){
         var Mb=CPt.FrstMbr,MCSt=Nav4?CPt:CPt.style;
         RLvl++;MCSt.visibility=RLvl==1?M_Show:M_Hide;CPt.Shw=RLvl==1?1:0;
         while(Mb!=null){if(Mb.Hilite)LowItem(Mb);if(Mb.CCn)Init(Mb.CCn);Mb=Mb.PrvMbr}
         RLvl--}
    function ClrAllChlds(Pt){
         var PSt,Pc;
         while(Pt){if(Pt.Hilite){Pc=Nav4?Pt.CLyr:Pt;if(Pc!=CurOvr){LowItem(Pt)}
              if(Pt.CCn){PSt=Nav4?Pt.CCn:Pt.CCn.style;if(Pc!=CurOvr){PSt.visibility=M_Hide;Pt.CCn.Shw=0}ClrAllChlds(Pt.CCn.FrstMbr)}
              break}
         Pt=Pt.PrvMbr}}
    function SetItem(Pntr,x){while(Pntr!=null){Pntr.DoRmbr=x;Pntr=Nav4?Pntr.CLyr.Ctnr.Cllr:Pntr.Ctnr.Cllr}}
    function GoTo(){
         var HP=Nav4?this.LLyr:this;
         if(HP.Arr[1]){status="";LowItem(HP);IniFlg=1;Initiate();
              HP.Arr[1].indexOf("javascript:")!=-1?eval(HP.Arr[1]):DcLoc.location.href=BaseHref+HP.Arr[1]}}
    function HiliteItem(P){
         if(Nav4){     if(P.ro)P.document.images[P.rid].src=P.ri2;
              else{     
                    P.bgColor = HighBgColor;
                   if(P.value.indexOf("<img")==-1){P.document.write(P.Ovalue);P.document.close()}}}
                   else{     
                        if(P.ro){var Lc=P.Lvl==1?FLoc:ScLoc;Lc.document.images[P.rid].src=P.ri2}
                        else{               
                             P.style.backgroundColor=HighBgColor;
                             P.style.color=FontHighColor;
         P.Hilite=1
    function LowItem(P){
         P.Hilite=0;
         if(P.ro){if(Nav4)P.document.images[P.rid].src=P.ri1;
              else{var Lc=P.Lvl==1?FLoc:ScLoc;Lc.document.images[P.rid].src=P.ri1}}
         else{
              if(Nav4){
                        P.bgColor=LowBgColor;
              if(P.value.indexOf("<img")==-1){P.document.write(P.value);P.document.close()}}
              else{
                        P.style.backgroundColor=LowBgColor;
                        P.style.color=FontLowColor;
    function OpenMenu(){
         if(!Ldd||!Crtd)return;
         if(OpnTmr)clearTimeout(OpnTmr);
         var P=Nav4?this.LLyr:this;
         if(P.NofChlds&&!P.CCn){
              RLvl=this.Lvl;
              P.CCn=CreateMenuStructure(P.MN+"_",P.NofChlds,P);
              var Ti,Li,Hi;
              var MStl=!Nav4?P.style:P;
              var PadL=P.value.indexOf("<")==-1?LftXtra:0;
              var PadT=P.value.indexOf("<")==-1?TpXtra:0;
              var MWt=!Nav4?parseInt(MStl.width)+PadL:MStl.clip.width;
              var MHt=!Nav4?parseInt(MStl.height)+PadT:MStl.clip.height;
              var CCw,CCh,STp,SLt;
              var BRW=RLvl==1?BorderWidthMain:BorderWidthSub;
              if(RightToLeft)CCw=Nav4?P.CCn.clip.width:parseInt(P.CCn.style.width);
              if(BottomUp)CCh=Nav4?P.CCn.clip.height:parseInt(P.CCn.style.height);
              if(RLvl==1&&FirstLineHorizontal){Hi=1;Li=(Nav4?P.left:parseInt(P.style.left))-BRW;Ti=0}
              else{Hi=Li=0;Ti=(Nav4?P.top:parseInt(P.style.top))-BRW}
              if(Hi){STp=BottomUp?Ti-CCh:Ti+MHt+2*BRW;SLt=RightToLeft?Li+MWt-CCw:Li}
              else{SLt=RightToLeft?Li-CCw+ChildOverlap*MWt+BRW:Li+(1-ChildOverlap)*MWt;
              STp=RLvl==1&&AcrssFrms?BottomUp?Ti-CCh+MHt:Ti:BottomUp?Ti-CCh+(1-ChildVerticalOverlap)*MHt+2*BRW:Ti+ChildVerticalOverlap*MHt+BRW}
              PosMenu(P.CCn,STp,SLt);
              RLvl=0}
         var CCnt=Nav4?this.LLyr.CCn:this.CCn,HP=Nav4?this.LLyr:this;
         CurOvr=this;IniFlg=0;ClrAllChlds(this.Ctnr.FrstMbr);
         if(!HP.Hilite)HiliteItem(HP);
         if(CCnt!=null&&!CCnt.Shw)RememberStatus?Unfld():OpnTmr=setTimeout("Unfld()",UnfoldDelay);
    //alert(HP.value);
         status=HP.value;
    function Unfld(){
         var P=CurOvr;
         var TS=ExpYes?ScLoc.document.body.scrollTop:ScLoc.pageYOffset,LS=ExpYes?ScLoc.document.body.scrollLeft:ScLoc.pageXOffset,CCnt=Nav4?P.LLyr.CCn:P.CCn,THt=Nav4?P.clip.height:parseInt(P.style.height),TWt=Nav4?P.clip.width:parseInt(P.style.width),TLt=AcrssFrms&&P.Lvl==1&&!FirstLineHorizontal?0:Nav4?P.Ctnr.left:parseInt(P.Ctnr.style.left),TTp=AcrssFrms&&P.Lvl==1&&FirstLineHorizontal?0:Nav4?P.Ctnr.top:parseInt(P.Ctnr.style.top);
         // TS != 0 is only needed if the menu DIVs are positioned relative to the body.
         // We've made them positioned relative to div#navigationMenu which causes
         // a problem if TS is based on how the body is scrolled.  So set TS to zero.
         // Note: the code below will adjust the final top offset based on the height of
         // the menu bar so the dropdown appears below (and not on top of) the nav bar.
         TS = 0;
         var CCW=Nav4?P.LLyr.CCn.clip.width:parseInt(P.CCn.style.width),CCH=Nav4?P.LLyr.CCn.clip.height:parseInt(P.CCn.style.height),CCSt=Nav4?P.LLyr.CCn:P.CCn.style,SLt=AcrssFrms&&P.Lvl==1?CCnt.OrgLeft+TLt+LS:CCnt.OrgLeft+TLt,STp=AcrssFrms&&P.Lvl==1?CCnt.OrgTop+TTp+TS:CCnt.OrgTop+TTp;
         if(!ShwFlg){ShwFlg=1;BeforeFirstOpen()}
         if(MenuWrap){
              if(RightToLeft){if(SLt<LS)SLt=P.Lvl==1?LS:SLt+(CCW+(1-2*ChildOverlap)*TWt);if(SLt+CCW>SWinW+LS)SLt=SWinW+LS-CCW}
              else{if(SLt+CCW>SWinW+LS)SLt=P.Lvl==1?SWinW+LS-CCW:SLt-(CCW+(1-2*ChildOverlap)*TWt);if(SLt<LS)SLt=LS}
              if(BottomUp){if(STp<TS)STp=P.Lvl==1?TS:STp+(CCH-(1-2*ChildVerticalOverlap)*THt);if(STp+CCH>SWinH+TS)STp=SWinH+TS-CCH+(Nav4?4:0)}
              else{if(STp+CCH>TS+SWinH)STp=P.Lvl==1?STp=TS+SWinH-CCH:STp-CCH+(1-2*ChildVerticalOverlap)*THt;if(STp<TS)STp=TS}}
         CCSt.top=STp+P_X;CCSt.left=SLt+P_X;
         if(Fltr&&MenuSlide){P.CCn.filters[0].Apply();P.CCn.filters[0].play()}
         CCSt.visibility=M_Show}
    function OpenMenuClick(){
         if(!Ldd||!Crtd)return;
         var HP=Nav4?this.LLyr:this;CurOvr=this;
         IniFlg=0;ClrAllChlds(this.Ctnr.FrstMbr);HiliteItem(HP);
    function CloseMenu(){
         if(!Ldd||!Crtd)return;
         status="";
         if(this==CurOvr){if(OpnTmr)clearTimeout(OpnTmr);if(CloseTmr)clearTimeout(CloseTmr);IniFlg=1;CloseTmr=setTimeout("Initiate(CurOvr)",DissapearDelay)}}
    function CntnrSetUp(W,H,NoOff,WMu,Mc){
         var x=BorderColor;
         this.FrstMbr=null;this.NrItms=NoOff;this.Cllr=Mc;this.Shw=0;
         this.OrgLeft=this.OrgTop=0;
         if(Nav4){if(x)this.bgColor=x;this.visibility="hide";this.resizeTo(W,H)}
         else{if(x)this.style.backgroundColor=x;this.style.width=W+P_X;this.style.height=H+P_X;
              if(!NavYes)this.style.zIndex=RLvl+Ztop;
              if(Fltr){FStr="";if(MenuSlide&&RLvl!=1)FStr=MenuSlide;if(MenuShadow)FStr+=MenuShadow;
                   if(MenuOpacity)FStr+=MenuOpacity;if(FStr!="")this.style.filter=FStr}}}
    function MbrSetUp(MbC,PrMmbr,WMu,Wd,Ht,Nofs){
         var Lctn=RLvl==1?FLoc:ScLoc,Tfld=this.Arr[0],t,T,L,W,H,S,a;
         this.PrvMbr=PrMmbr;this.Lvl=RLvl;this.Ctnr=MbC;this.CCn=null;this.ai=null;this.Hilite=0;this.DoRmbr=0;
         this.Clckd=0;this.OM=OpenMenu;this.style.overflow="hidden";
         this.MN=WMu;this.NofChlds=Nofs;
         this.style.cursor=(this.Arr[1]||(RLvl==1&&UnfoldsOnClick))?ExpYes?"hand":"pointer":"default";this.ro=0;
         if(Tfld.indexOf("rollover")!=-1){this.ro=1;this.ri1=Tfld.substring(Tfld.indexOf("?")+1,Tfld.lastIndexOf("?"));
              this.ri2=Tfld.substring(Tfld.lastIndexOf("?")+1,Tfld.length);this.rid=WMu+"i";
              Tfld="<img src=\""+this.ri1+"\" name=\""+this.rid+"\" width=\""+Wd+"\" height=\""+Ht+"\">"}
         this.value=Tfld;
         this.style.color=FontLowColor;
         this.style.fontFamily=FontFamily;
         this.style.fontSize = FontSize + "pt";
         this.style.fontWeight="normal";
         this.style.fontStyle="normal";
         this.style.backgroundColor=LowBgColor;
         if (WMu.length > 6)
         { MenuTextCentered = 'left';}
         else
         {MenuTextCentered = 'center';}     
         this.style.textAlign=MenuTextCentered;
         if(this.Arr[2])this.style.backgroundImage="url(\""+this.Arr[2]+"\")";
         if(Tfld.indexOf("<")==-1){this.style.width=Wd-LftXtra+P_X;this.style.height=Ht-TpXtra+P_X;this.style.paddingLeft=LeftPaddng+P_X;this.style.paddingTop=TopPaddng+P_X}
         else{this.style.width=Wd+P_X;this.style.height=Ht+P_X}
         if(Tfld.indexOf("<")==-1&&DomYes){t=Lctn.document.createTextNode(Tfld);this.appendChild(t)}
         else this.innerHTML=Tfld;
         if(this.Arr[3]){a=RLvl==1&&FirstLineHorizontal?BottomUp?9:3:RightToLeft?6:0;
              if(Arrws[a]!=""){S=Arrws[a];W=Arrws[a+1];H=Arrws[a+2];T=RLvl==1&&FirstLineHorizontal?BottomUp?2:Ht-H-2:(Ht-H)/2;L=RightToLeft?2:Wd-W-2;
                   if(DomYes){t=Lctn.document.createElement("img");this.appendChild(t);
                        t.style.position="absolute";t.src=S;t.style.width=W+P_X;t.style.height=H+P_X;t.style.top=T+P_X;t.style.left=L+P_X}
                   else{Tfld+="<div id=\""+WMu+"_im\" style=\"position:absolute; top:"+T+"; left:"+L+"; width:"+W+"; height:"+H+";visibility:inherit\"><img src=\""+S+"\"></div>";
                        this.innerHTML=Tfld;t=Lctn.document.all[WMu+"_im"]}
                   this.ai=t}}
         if(ExpYes){this.onselectstart=CnclSlct;this.onmouseover=RLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;
              this.onmouseout=CloseMenu;this.onclick=RLvl==1&&UnfoldsOnClick&&this.Arr[3]?OpenMenu:GoTo}
         else{RLvl==1&&UnfoldsOnClick?this.addEventListener("mouseover",OpenMenuClick,false):this.addEventListener("mouseover",OpenMenu,false);
              this.addEventListener("mouseout",CloseMenu,false);
              RLvl==1&&UnfoldsOnClick&&this.Arr[3]?this.addEventListener("click",OpenMenu,false):this.addEventListener("click",GoTo,false)}}
    function NavMbrSetUp(MbC,PrMmbr,WMu,Wd,Ht,Nofs){
         var a;
         this.value=this.Arr[0];this.ro=0;
         if(this.value.indexOf("rollover")!=-1){
              this.ro=1;this.ri1=this.value.substring(this.value.indexOf("?")+1,this.value.lastIndexOf("?"));
              this.ri2=this.value.substring(this.value.lastIndexOf("?")+1,this.value.length);this.rid=WMu+"i";
              this.value="<img src=\""+this.ri1+"\" name=\""+this.rid+"\">"}
         CntrTxt="<div align=\""+MenuTextCentered+"\">";
         TxtClose="</font>"+ "</div>";
         if(LeftPaddng&&this.value.indexOf("<")==-1&&MenuTextCentered=="left")this.value="�\;"+this.value;
         this.Ovalue=this.value;
         this.value=this.value.fontcolor(FontLowColor);
         this.Ovalue=this.Ovalue.fontcolor(FontHighColor);
         this.value=CntrTxt+"<font face=\""+FontFamily+"\" point-size=\""+FontSize+"\">"+this.value+TxtClose;
         this.Ovalue=CntrTxt+"<font face=\""+FontFamily+"\" point-size=\""+FontSize+"\">"+this.Ovalue+TxtClose;
         this.CCn=null;this.PrvMbr=PrMmbr;this.Hilite=0;this.DoRmbr=0;this.Clckd=0;this.visibility="inherit";
         this.MN=WMu;this.NofChlds=Nofs;
         this.bgColor=LowBgColor;
         this.resizeTo(Wd,Ht);
         if(!AcrssFrms&&this.Arr[2])this.background.src=this.Arr[2];
         this.document.write(this.value);this.document.close();
         this.CLyr=new Layer(Wd,MbC);
         this.CLyr.Lvl=RLvl;this.CLyr.visibility="inherit";
         this.CLyr.onmouseover=RLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;this.CLyr.onmouseout=CloseMenu;
         this.CLyr.captureEvents(Event.MOUSEUP);this.CLyr.onmouseup=RLvl==1&&UnfoldsOnClick&&this.Arr[3]?OpenMenu:GoTo;
         this.CLyr.OM=OpenMenu;
         this.CLyr.LLyr=this;this.CLyr.resizeTo(Wd,Ht);this.CLyr.Ctnr=MbC;
         if(this.Arr[3]){a=RLvl==1&&FirstLineHorizontal?BottomUp?9:3:RightToLeft?6:0;
              if(Arrws[a]!=""){this.CLyr.ILyr=new Layer(Arrws[a+1],this.CLyr);this.CLyr.ILyr.visibility="inherit";
                   this.CLyr.ILyr.top=RLvl==1&&FirstLineHorizontal?BottomUp?2:Ht-Arrws[a+2]-2:(Ht-Arrws[a+2])/2;
                   this.CLyr.ILyr.left=RightToLeft?2:Wd-Arrws[a+1]-2;this.CLyr.ILyr.width=Arrws[a+1];this.CLyr.ILyr.height=Arrws[a+2];
                   ImgStr="<img src=\""+Arrws[a]+"\" width=\""+Arrws[a+1]+"\" height=\""+Arrws[a+2]+"\">";
                   this.CLyr.ILyr.document.write(ImgStr);this.CLyr.ILyr.document.close()}}}
    function CreateMenuStructure(MNm,No,Mcllr){
         status="Building menu";RLvl++;
         var i,NOs,Mbr,W=0,H=0,PMb=null,WMnu=MNm+"1",MWd=eval(WMnu+"[5]"),MHt=eval(WMnu+"[4]"),Lctn=RLvl==1?FLoc:ScLoc;
         var BRW=RLvl==1?BorderWidthMain:BorderWidthSub,BTWn=RLvl==1?BorderBtwnMain:BorderBtwnSub;
         if(RLvl==1&&FirstLineHorizontal){
              for(i=1;i<No+1;i++){WMnu=MNm+eval(i);W=eval(WMnu+"[5]")?W+eval(WMnu+"[5]"):W+MWd}
              W=BTWn?W+(No+1)*BRW:W+2*BRW;H=MHt+2*BRW}
         else{for(i=1;i<No+1;i++){WMnu=MNm+eval(i);H=eval(WMnu+"[4]")?H+eval(WMnu+"[4]"):H+MHt}
              H=BTWn?H+(No+1)*BRW:H+2*BRW;W=MWd+2*BRW}
         if(DomYes){var MbC=Lctn.document.createElement("div");MbC.style.position="absolute";MbC.style.visibility="hidden";Lctn.document.getElementById("navigationMenu").appendChild(MbC)}
         else{if(Nav4)var MbC=new Layer(W,Lctn);
              else{WMnu+="c";Lctn.document.body.insertAdjacentHTML("AfterBegin","<div id=\""+WMnu+"\" style=\"visibility:hidden; position:absolute;\"><\/div>");
                   var MbC=Lctn.document.all[WMnu]}}
         MbC.SetUp=CntnrSetUp;MbC.SetUp(W,H,No,MNm+"1",Mcllr);
         if(Exp4){MbC.InnerString="";
              for(i=1;i<No+1;i++){WMnu=MNm+eval(i);MbC.InnerString+="<div id=\""+WMnu+"\" style=\"position:absolute;\"><\/div>"}
              MbC.innerHTML=MbC.InnerString}
         for(i=1;i<No+1;i++){WMnu=MNm+eval(i);NOs=eval(WMnu+"[3]");
              W=RLvl==1&&FirstLineHorizontal?eval(WMnu+"[5]")?eval(WMnu+"[5]"):MWd:MWd;
              H=RLvl==1&&FirstLineHorizontal?MHt:eval(WMnu+"[4]")?eval(WMnu+"[4]"):MHt;
              if(DomYes){Mbr=Lctn.document.createElement("div");     Mbr.style.position="absolute";Mbr.style.visibility="inherit";MbC.appendChild(Mbr)}
              else Mbr=Nav4?new Layer(W,MbC):Lctn.document.all[WMnu];
              Mbr.Arr=eval(WMnu);                    
              Mbr.SetUp=Nav4?NavMbrSetUp:MbrSetUp;Mbr.SetUp(MbC,PMb,WMnu,W,H,NOs);
              if(NOs&&!BuildOnDemand){Mbr.CCn=CreateMenuStructure(WMnu+"_",NOs,Mbr)}
              PMb=Mbr}
         MbC.FrstMbr=Mbr;
         RLvl--;
         return(MbC)}
    function CreateMenuStructureAgain(MNm,No){
         if(!BuildOnDemand){
              var i,WMnu,NOs,PMb,Mbr=FrstCntnr.FrstMbr;RLvl++;
              for(i=No;i>0;i--){WMnu=MNm+eval(i);NOs=eval(WMnu+"[3]");PMb=Mbr;if(NOs)Mbr.CCn=CreateMenuStructure(WMnu+"_",NOs,Mbr);Mbr=Mbr.PrvMbr}
              RLvl--}
         else{     var Mbr=FrstCntnr.FrstMbr;
              while(Mbr){Mbr.CCn=null;Mbr=Mbr.PrvMbr}}}

    Hi thanks...As you said I am performing only on onload event..only thing i am confused is if i remove the javacript MRHeader.js everything works fine...am totally confused...pls help
    Here is my JSP code for my input page
    <%@page import="java.util.*" %>
    <%@page import="com.ford.mr.*" %>
    <HTML>
    <HEAD>
    <link href="./css/mplstyle.css" rel="STYLESHEET" type="text/css">
    <title>Input Frame</title>
    <link type="text/css" rel="STYLESHEET" href="./css/classic.css">
    <STYLE>
        .vis1 { visibility:visible }
        .vis2 { visibility:hidden }
    </STYLE>
    <%--
    MRIFValidation.js contains the java script for the following requirement:
    1. Setting the current date in date to compare
    2. All input frame client validations.
    E.g Plant id should not be empty.
    --%>
    <script type="text/javascript" src="./javascript/MRIFValidation.js"> </script>
    <%--
    MRR2HandleDropdown.js is the javascript for the input frame server side actions
    It has many functions related to drop down populating and rendering the data
    to user from server.
    --%>
    <script language="javascript" src="./javascript/MRR2HandleDropdown.js"> </script>
    <%--
    MRheader.js is the javascript which displays the header for our application
    plus it has an internal call to MRMenuItem.js and menuscript.js which
    builds the menu bar for our application
    Issue is here - On commenting the below the previously entered user
    inputs are displayed correctly. Else they are not displayed.
    --%>
    <script language="javascript" src="./javascript/MRheader.js"> </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    a:visited {
         color: #0000FF;
    .style1 {font-weight: bold}
    .style2 {color: #FF0000}
    body {
         background-color: #FFFFFF;
    -->
    </style>
    <%--
    Declaring all the JSP variables used in the page
    These variables are used for holding the session parameters
    and are used while setting the selected values in the screen.
    --%>
    <%!      
         // HTTPSession object
         HttpSession sess;
         // To hold session Variables //
         // Selected plant index
         String plantIndex;
         // Selected supplier index
         String supplierIndex;
         // Selected part index
         String partIndex;
         // List of plant codes
         Vector plantCodes = new Vector();
         // List of supplier codes
         Vector supplierCodes = new Vector();
         // List of part codes
         Vector partCodes = new Vector();
         // To hold the part description for the selected part
         String partDescription;
         // List of release numbers matching the selected plant, supplier & part
         Vector releaseNumbers = new Vector();
         // Type of release - Weekly / Daily
         String releaseType;
         // Selected release1 index
         String release1Index;
         // Selected release2 index
         String release2Index;
         // Holds the issue date 1 corresponding to release 1 selected
         String issueDate1;
         // Holds the issue date 2 corresponding to release 2 selected
         String issueDate2;
         // List of matching release numbers to the entered issue date1 (Might be one or two
         // in case if amended release exist)
         Vector matchingRelease1Number = new Vector();
         // List of matching release numbers to the entered issue date2 (Might be one or two
         // in case if amended release exist)
         Vector matchingRelease2Number = new Vector();
         // Size of matchingRelease1Number collection
         int matchingRelease1Size = 0;
         // Size of matchingRelease2Number collection
         int matchingRelease2Size = 0;
         // Boolean flags to hold if amended release exists in the release numbers
         // matching the issue dates entered by user.
         boolean amendedRelease1Exist;
         boolean amendedRelease2Exist;
         String pageName = "";
    %>
    <%--
    The below code does the following:
    1. Fetches the various values available in session
    2. Stores the same in various JSP variables for access within the page
    --%>
    <%
    System.out.println("In input frame page");
    sess = request.getSession(true);
         if(sess != null) {
              System.out.println("Session id in input frame: "+ sess.getId());
              plantIndex = (String) sess.getAttribute("selectedPlantIndex");
              supplierIndex = (String) sess.getAttribute("selectedSupplierIndex");
              partIndex = (String) sess.getAttribute("selectedPartIndex");
              //plantCodes = (Vector) sess.getAttribute("plantCodes");
              supplierCodes = (Vector) sess.getAttribute("supplierCodes");
              partCodes = (Vector) sess.getAttribute("partCodes");
              partDescription = (String) sess.getAttribute("partDescription");
              releaseNumbers = (Vector) sess.getAttribute("releaseNumbers");
              releaseType = (String) sess.getAttribute("releaseType");
              release1Index = (String) sess.getAttribute("selectedRelease1Index");
              release2Index =(String)  sess.getAttribute("selectedRelease2Index");
              issueDate1 = (String) sess.getAttribute("issueDate1");
              issueDate2 = (String) sess.getAttribute("issueDate2");
              matchingRelease1Number = (Vector) sess.getAttribute("correspondingRelease1Number");
              matchingRelease2Number = (Vector) sess.getAttribute("correspondingRelease2Number");
              System.out.println("Displaying values in session *******************");
              Enumeration enum = sess.getAttributeNames();
              while(enum.hasMoreElements()) {
                   String elementName = (String) enum.nextElement();
                   System.out.println("element:"+ elementName+": Value: "+ sess.getAttribute(elementName));
              System.out.println("Plant Index JSP variable:"+ plantIndex);
    %>
    <%--
    This code is used for getting the plant codes from
    the DB. Currently it is hardcoded.
    --%>
    <%
    MRR2GetPlantCodes obj = new MRR2GetPlantCodes();
    plantCodes = obj.getPlantCodes();
    %>
    <%--
    The below two blocks are used to iterate through matchingRelease1Number & matchingRelease2Number
    and checks if it has amended release. If yes, sets a boolean flag.
    matchingRelease1Number & matchingRelease2Number are two collections which
    contains the release number(s) matching the inputted issue date
    --%>
    <%
    // Code to set boolean flag amendedRelease1Exist
    if(matchingRelease1Number != null) {
         Iterator relIter = matchingRelease1Number.iterator();
         while(relIter.hasNext()) {
              if( ((String)relIter.next()).endsWith("A") ) {                    
                   amendedRelease1Exist = true;
    // Code to set boolean flag amendedRelease2Exist
    if(matchingRelease2Number != null) {
         Iterator relIter = matchingRelease2Number.iterator();
         while(relIter.hasNext()) {
              if( ((String)relIter.next()).endsWith("A") ) {                    
                   amendedRelease2Exist = true;
    %>
    <%--
    The below script has one method fillDropDown which is used for setting the
    values of the various I/P controls to user selected values:
    It sets the below selected values:
    1. Plant Index, Supplier Index, Part Index, Part description
    2. Release Type (Daily / weekly)
    3. Release 1 Index, Release 2 Index
    4. Issue date1 & Issue date2
    --%>
    <script language="javascript">
    function fillDropDown(field) {
         with(field) {
              var partD = "<%=partDescription%>"
              <% System.out.println("Loading the index values in input frame......");%>
              // inputform.country.selectedIndex = inputform.hiddencountry.value
              // Loading plant Index, supplier Index, part index and part description to selected values
              <% if(plantIndex != null && !plantIndex.equals("")) {%>
                   inputframe.plant.selectedIndex = "<%=Integer.parseInt(plantIndex)%>"               
              <% System.out.println("Selected Plant Index after loading:"+plantIndex);} %>
              <% if(supplierIndex != null && !supplierIndex.equals("")) { System.out.println("****Supplier Index not equals null..."+Integer.parseInt(supplierIndex)); %>
                   inputframe.supplier.selectedIndex = "<%=Integer.parseInt(supplierIndex)%>"
              <% } %>
              <% if(partIndex != null && !partIndex.equals("")) { %>
                   inputframe.part.selectedIndex = "<%=Integer.parseInt(partIndex)%>"
              <% } %>
              <% if(partDescription != null && !partDescription.equals("")) { %>
                   document.getElementById("partDescription").innerHTML = partD
              <%     } %>
              // Making the default release type selection as done by user
              <% if(releaseType != null && !"".equals(releaseType)) {
                        if("daily".equals(releaseType)) {%>
                             inputframe.release[0].checked = "checked"
                        <%     //isDaily = true;
                        } else { %>
                             inputframe.release[1].checked = "checked"
                        <%     //isWeekly = true;
                   } %>
              <%--
                   The below code is used to fetch the session variable issueDate1
                   & issueDate2 (based on the release numbers selected)
                   and sets the same in two text fields.
               --%>          
              <% if(issueDate1 != null && !issueDate1.equals("")) { %>
                   inputframe.issueDate1.value = "<%=issueDate1%>"
              <% } %>
              <% if(issueDate2 != null && !issueDate2.equals("")) { %>
                   inputframe.issueDate2.value = "<%=issueDate2%>"
              <% } %>     
         <%--
              Loading release drop down with the value matching with the entered issue date.
              Scenario : User enters the issue date and the corresponding release number is
              selected in drop down.
              Logic 1:
              1. Pass the issue date entered by user and get the matching release numbers
              from EJB
              2. Compare this with the combo collection and get the perfect match.
              3. If more than one match is found take the one with amendment by default
              4. Else get the matching one
              5. Update the selected index of dropdown to this value
         --%>          
              if(inputframe.release1.options.length > 0) {
                   var matchingCombo1Index = 0
                   var comboValue               
                   var matchFound = "false"
                   var size
                   var amended = false;
                   var amendedReleaseExist = "<%=amendedRelease1Exist%>";
                   var firstValue = ""
                   var secondValue = ""
                   var amendedValue = ""
                   var j = 0
                <%                 
                     if(matchingRelease1Number != null && matchingRelease1Number.size() != 0) {
                          Iterator iter = matchingRelease1Number.iterator();                          
                        matchingRelease1Size = matchingRelease1Number.size(); %>
                        size = "<%=     matchingRelease1Size %>"
                        //alert("Size of collection to be matched:"+size)
                   <%     while(iter.hasNext()) {                         
                             //String matchFound1 = "false";
                             String relValue = (String)iter.next();%>
                             //alert("Collection value under iteration:"+ "<%=relValue%>")                         
                             amended = "<%=relValue.endsWith("A")%>"
                             if(amended) {
                                  amendedValue = "<%=relValue%>"
                             //alert("Collection value under iteration ends with A:"+amended)
                             var comb = "<%=relValue%>"
                             j = j + 1
                             for(var i = 0; i < inputframe.release1.options.length; i++) {
                                  //      breaking the for loop when matchingCombo1Index is set greater than 0
                                  /*if(matchFound == true) {
                                       break
                                  comboValue = inputframe.release1.options.value                              
                                  //alert("Combo value:->"+comboValue)
                                  //alert("rel value in comparison:"+ comb);
                                  if(comboValue == comb) {
                                       if(size == 1) {
                                            matchFound = "true";
                                       if(size == 2) {
                                            if(j == 1)
                                                 firstValue = comb
                                            if(j == 2)
                                                 secondValue = comb
                                            // The below if block shall be also kept as if((amended||(!amendedReleaseExist)==true)
                                            // The below one perfectly works fine
                                            if(amended || !amendedReleaseExist) {
                                                 matchFound = "true";
                                  if(matchFound == "true") {
                                       matchingCombo1Index = i
                                       // alert("Matching combo index set to:"+ matchingCombo1Index)                                   
                                       inputframe.release1.selectedIndex = matchingCombo1Index
                                       if(size == 2)
                                            document.getElementById('errorArea').innerHTML = "There are"
                                                 + " two release numbers for the particular Issue date."
                                                 +" Please select either one of the release numbers ("+firstValue+ " or "+secondValue+" )."
                                                 +" Default selection in the Release drop down is "+ amendedValue+ "."
                                       matchingCombo1Index = 0;
                                       matchFound = "false";
                                       // Breaking the for loop
                                       break;                                   
                        <%                          
                        sess.removeAttribute("correspondingRelease1Number") ;
                   }%>
                   // Setting the selected release 1 index based on the logic done above.
                   if(matchingCombo1Index == 0) {
                        <% if(release1Index != null && !release1Index.equals("")) { matchingRelease1Number = null;%>
                                  inputframe.release1.selectedIndex = "<%=Integer.parseInt(release1Index)%>"
                        <% } %>
              <%--
                   Performing the above logic to select Release2 value
                   when the user enters issue date2
              --%>
              if(inputframe.release2.options.length > 0) {
                   var matchingCombo2Index = 0
                   var comboValue
                   var matchFound = "false"
                   var size
                   var amended = false;
                   var amendedReleaseExist = "<%=amendedRelease2Exist%>";
                   var firstValue = ""
                   var secondValue = ""
                   var amendedValue = ""
                   var j = 0
              <%               
                   if(matchingRelease2Number != null && matchingRelease2Number.size() != 0) {
                        Iterator iter = matchingRelease2Number.iterator();                         
                        matchingRelease2Size = matchingRelease2Number.size(); %>
                        size = "<%=     matchingRelease2Size %>"
                        //alert("Size of collection to be matched:"+size)
                   <%     while(iter.hasNext()) {
                             String matchFound1 = "false";
                             String relValue = (String)iter.next();%>
                             //alert("Collection value under iteration:"+ "<%=relValue%>")                         
                             amended = "<%=relValue.endsWith("A")%>"                         
                             if(amended) {
                                  amendedValue = "<%=relValue%>"
                             //alert("Collection value under iteration ends with A:"+amended)
                             var comb = "<%=relValue%>"
                             j = j + 1
                             for(var i = 0; i < inputframe.release2.options.length; i++) {
                                  //      breaking the for loop when matchingCombo2Index is set greater than 0
                                  /*if(matchFound == true) {
                                       break
                                  comboValue = inputframe.release2.options[i].value                              
                                  //alert("Combo value:->"+comboValue)
                                  //alert("rel value in comparison:"+ comb);
                                  if(comboValue == comb) {
                                       if(size == 1) {
                                            matchFound = "true";
                                       if(size == 2) {
                                            if(j == 1)
                                                 firstValue = comb
                                            if(j == 2)
                                                 secondValue = comb
                                            // The below if block shall be also kept as if((amended||(!amendedReleaseExist)==true)
                                            // The below one perfectly works fine
                                            if(amended || !amendedRelease2Exist) {
                                                 matchFound = "true";
                                  if(matchFound == "true") {
                                       matchingCombo2Index = i
                                       // alert("Matching combo index set to:"+ matchingCombo2Index)                                   
                                       inputframe.release2.selectedIndex = matchingCombo2Index
                                       if(size == 2)
                                            document.getElementById('errorArea').innerHTML = "There are"
                                                 + " two release numbers for the particular Issue date."
                                                 +" Please select either one of the release numbers ("+firstValue+ " or "+secondValue+" )."
                                                 +" Default selection in the Release drop down is "+ amendedValue+ "."
                                       matchingCombo2Index = 0;
                                       matchFound = "false";
                                       // Breaking the for loop
                                       break;                                   
                        <%                          
                        sess.removeAttribute("correspondingRelease2Number") ;
                   }%>
                   // Loading the selected release2 value in drop down
                   if(matchingCombo2Index == 0) {
                        <% if(release2Index != null && !release2Index.equals("")) { matchingRelease2Number = null;%>
                                  inputframe.release2.selectedIndex = "<%=Integer.parseInt(release2Index)%>"
                        <% } %>
         } // end of WITH
              Logic 2: Not used
              1. Pass the issue date entered by user and get the matching release numbers
              2. Get the release numbers from session.
              3. if release type is daily get the daily release numbers else get weekly release numbers
              4. Compare the matching release numbers with daily / weekly release numbers collection
              5. Find the match and update the selected index of drop down to this value
    }// end of function
    </script>
    </HEAD>
    <%-- Calling the two methods onload event of body --%>
    <BODY onload="setCurrentDate(this);fillDropDown(this)">

  • Help with add file name problem with Photoshop CS4

    Frustrating problem: Help with add file name problem with Photoshop CS4. What happens is this. When I am in PS CS4 or CS3 and run the following script it runs fine. When I am in Bridge and go to tools/photoshop/batch and run the same script it runs until it wants interaction with preference.rulerunits. How do I get it to quit doing this so I can run in batch mode? Any help is appreciated. HLower
    Script follows:
    // this script is another variation of the script addTimeStamp.js that is installed with PS7
    //Check if a document is open
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.INCHES;
    try
    var docRef = activeDocument;
    // Create a text layer at the front
    var myLayerRef = docRef.artLayers.add();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";
    var myTextRef = myLayerRef.textItem;
    //Set your parameters below this line
    //If you wish to show the file extension, change the n to y in the line below, if not use n.
    var ShowExtension = "n";
    // Insert any text to appear before the filename, such as your name and copyright info between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextBefore = "Lower© ";
    // Insert any text to appear after the filename between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextAfter = " ";
    // Set font size in Points
    myTextRef.size = 10;
    //Set font - use GetFontName.jsx to get exact name
    myTextRef.font = "Arial";
    //Set text colour in RGB values
    var newColor = new SolidColor();
    newColor.rgb.red = 0;
    newColor.rgb.green = 0;
    newColor.rgb.blue = 0;
    myTextRef.color = newColor;
    // Set the position of the text - percentages from left first, then from top.
    myTextRef.position = new Array( 10, 99);
    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.
    myLayerRef.blendMode = BlendMode.NORMAL;
    // select opacity in percentage
    myLayerRef.opacity = 100;
    // The following code strips the extension and writes tha text layer. fname = file name only
    di=(docRef.name).indexOf(".");
    fname = (docRef.name).substr(0, di);
    //use extension if set
    if ( ShowExtension == "y" )
    fname = docRef.name
    myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
    catch( e )
    // An error occurred. Restore ruler units, then propagate the error back
    // to the user
    preferences.rulerUnits = originalRulerUnits;
    throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );

    you might want to try the scripting forum howard:
    http://www.adobeforums.com/webx?13@@.ef7f2cb

  • Problem Sending mails in a loop using JavaMail API

    Hello All,
    I am sending emails in a loop(one after the other) using JavaMail API,but the problem is, if the first two,three email addresses in the loop are Valid it sends the Email Properly, but if the Fourth or so is Invalid Address it throws an Exception....
    "javax.mail.SendFailedException: Sending failed;"
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 450 <[email protected]>:Recipient address rejected: Domain not found......
    So if i want to send hundereds of emails and if one of the Emails inbetween is Invalid the process Stops at that point and i could not send the other emails in the Loop......
    How Could i Trap the exception thrown and handle it in such a way, so that the loops continues ..
    Is there something with the SMTP Server....?
    The code which i am using is as follows....
    <Code>...
    try {
    InitialContext ic = new InitialContext();
    Session session = (Session) ic.lookup(JNDINames.MAIL_SESSION);
    if (Debug.debuggingOn)
    session.setDebug(true);
    // construct the message
    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(eMess.getEmailSender()));
    String to = "";
    msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(to, false));
    msg.setRecipients(Message.RecipientType.BCC,
    InternetAddress.parse(eMess.getEmailReceiver(), false));
    msg.setSubject(eMess.getSubject());
    msg.setContent(eMess.getHtmlContents(),"text/plain");
    msg.saveChanges();                
    Transport.send(msg);
    } catch (Exception e) {
    Debug.print("createAndSendMail exception : " + e);
    throw new MailerAppException("Failure while sending mail");
    </Code>....
    Please give me any suggestions regarding it....and guide me accordingly..
    Thanks a million in advance...
    Regards
    Sam

    How about something like the code attached here. Be aware it is lifted and edited out of an app we have here so it may require changing to get it to work. If it don't work - don't come asking for help as this is only a rough example of one way of doing it. RTFM - that's how we worked it out!
    SH
    try {
    Transport.send(msg);
    // If we get to here then the mail went OK so update all the records in the email as sent
    System.out.println("Email sent OK");
    catch (MessagingException mex) {
    System.out.println("Message error");
    Exception ex = mex;
    do {
    if (ex instanceof SendFailedException) {
    if (ex.getMessage().startsWith("Sending failed")) {
    // Ignore this message as we want to know the real reason for failure
    // If we get an Invalid Address error or a Message partially delivered message process the message
    if (ex.getMessage().startsWith("Message partially delivered")
    || ex.getMessage().startsWith("Invalid Addresses")) {
    // This message is of interest as we need to process the actual individual addresses
    System.out.println(ex.getMessage().substring(0, ex.getMessage().indexOf(";")));
    // Now get the addresses from the SendFailedException
    SendFailedException sfex = (SendFailedException) ex;
    Address[] invalid = sfex.getInvalidAddresses();
    if (invalid != null) {
    System.out.println("Invalid Addresse(s) found -");
    if (invalid.length > 0) {
    for (int x = 0; x < invalid.length; x++) {
    System.out.println(invalid[x].toString().trim());
    Address[] validUnsent = sfex.getValidUnsentAddresses();
    if (validUnsent != null) {
    System.out.println("Valid Unsent Addresses found -");
    if (validUnsent.length > 0) {
    for (int x = 0; x < validUnsent.length; x++) {
    System.out.println(validUnsent[x].toString().trim());
    Address[] validSent = sfex.getValidSentAddresses();
    if (validSent != null) {
    System.out.println("Valid Sent Addresses found -");
    if (validSent.length > 0) {
    for (int x = 0; x < validSent.length; x++) {
    System.out.println(validSent[x].toString().trim());
    if (ex instanceof MessagingException)
    ex = ((MessagingException) ex).getNextException();
    else {
    // This is a general catch all and we should assume that no messages went and should stop
    System.out.println(ex.toString());
    throw ex;
    } while (ex != null);

  • NullPointer exception in request.getParameter().indexof(.....) only in 6.1

    Hi
    I have one full working application (containing WAR + JAR) files.
    Right now this application is working absolutely fine in weblogic 6.0 sp1 on
    WINNT & Solaris.
    In this application, we accept events to save data from external
    applications like excel files.
    Now code in JSP is -->
    Line 1: String Data = request.getParameter("data");
    Line 2: Data.indexof(........);
    Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
    but I am NOT getting any exception in case of weblogic 6.0sp1.
    To my surprise, I am also printing request obj parameters values, whenever
    jsp get called from external source, there it is printing value of "data".
    I am totally clueless!!
    Any idea plz?
    Ashish Jain

    Looking very closely at request object contents..
    Wht i am sending (posting) from excel file-->
    xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet bu="SHKXXX"
    report="PBrandContr" sheet=
    "PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId="PIC"
    opt="P" ></reportSheet>
    But 6.1 interprets like this ---->
    key is --------> xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet
    bu="SHKXXX" report="PBrandContr" sheet=
    "PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId
    And Value is -------> "PIC" opt="P" ></reportSheet>
    This thing is causing all problems.
    I am not observing this kinda behaviour in 6.0sp1.
    Thanks
    Ashish Jain
    "Ashish Jain" <[email protected]> wrote in message
    news:[email protected]..
    Hi
    I have one full working application (containing WAR + JAR) files.
    Right now this application is working absolutely fine in weblogic 6.0 sp1on
    WINNT & Solaris.
    In this application, we accept events to save data from external
    applications like excel files.
    Now code in JSP is -->
    Line 1: String Data = request.getParameter("data");
    Line 2: Data.indexof(........);
    Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
    but I am NOT getting any exception in case of weblogic 6.0sp1.
    To my surprise, I am also printing request obj parameters values,whenever
    jsp get called from external source, there it is printing value of "data".
    I am totally clueless!!
    Any idea plz?
    Ashish Jain

  • Problem with socket communications

    I am trying to put together a client server socket communication pair.
    I have one application that runs in the background acting as a server and another that can be started and stopped that acts as a client.
    I can start the server and create a server socket with no problem.
    I can start the client and it connects to the server.
    The server acknowledges the connection and appears to go into a blocking state waiting for the client to send another message.
    The server blocks at the line
    parent.logit("Waiting for message from EVR..... ");
    The problem is that when the client sends another message, the server doesn't hear it.
    I am not sure if the problem is with the client or server communication code.
    If anyone out there is a socket communication guru, I would appreciate it if you could tell me what I am doing wrong.
    Thanks
    Server code:
    import java.io.*;
    import java.net.*;
    public class EVRServer
        extends Thread
      EVRDataLoader parent = null;
      ServerSocket serverSock = null;
      Socket clientSock = null;
      BufferedReader reader = null;
      BufferedWriter writer = null;
      int evrPort = 0;
      int retryLimit = 10;
      int retryCount = 0;
      boolean alive = false;
      boolean killSocket = false;
      boolean evrConnected = false;
      boolean retry = true;
      EVRListener evrListener = null;
    //=============================================================================
    // Full constructor
    //=============================================================================
       * Full constructor.
       * @param dl DataLoader - Parent application
       * @param port int Socket port
      public EVRServer(EVRDataLoader dl, int port)
        parent = dl;
        evrPort = port;
    //=============================================================================
    //  Run method - Main thread executed by start() method
    //=============================================================================
       * Main thread executed by start() method
      public void run()
        while (retry)
          if (retryCount > retryLimit)
            retry = false;
          parent.logit("Retry count = " + retryCount);
          // Create new server socket connection
          if (serverSock == null)
            try
              serverSock = new ServerSocket(evrPort);
              parent.logit("Created Server Socket for EVR on port " + evrPort);
              alive = true;
              killSocket = false;
              evrConnected = false;
            catch (Exception e)
              parent.logit(
                  "ERROR - Could not create Server socket connection for EVR: " +
                  e.toString());
              killSocket = true;
              alive = false;
          // Create new client socket connection
          if (clientSock == null)
            try
              parent.logit("Waiting for EVR to connect");
              clientSock = null;
              clientSock = serverSock.accept();
              retryCount = 0;
              evrConnected = true;
              killSocket = false;
              parent.logit("EVR connected on server Socket Port " + evrPort);
            catch (Exception e)
              parent.logit("ERROR - Error accepting EVR connection: " + e.toString());
              killSocket = true;
            try
              reader = new BufferedReader(new InputStreamReader(
                  clientSock.getInputStream()));
              writer = new BufferedWriter(new OutputStreamWriter(
                  clientSock.getOutputStream()));
              parent.logit( "Created reader "+reader);
              parent.logit( "Created writer "+writer);
            catch (Exception e)
              parent.logit(
                  "ERROR - creating reader or writer to EVR: " + e.toString());
              killSocket = true;
          int nullCount = 0;
          while (killSocket == false)
            try
              parent.logit("Waiting for message from EVR..... ");
    //          sendMessage("Data Controller connected on port " + evrPort);
              String s = reader.readLine();
              parent.logit("EVR - Received message: " + s);
              if (s != null)
                parent.processEvrMessage( s);
              else
                sleep(1000);
                nullCount++;
                if (nullCount > 10)
                  parent.logit("Exceeded retry limit: ");
                  killSocket = true;
            catch (Exception ex)
              parent.logit("Error Reading from EVR: " + ex.toString());
              killSocket = true;
          parent.logit( "After while loop");
          evrConnected = false;
          try
            retryCount++;
            parent.logit("Closing EVR connection. ");
            reader.close();
            writer.close();
            clientSock.close();
            writer = null;
            reader = null;
            clientSock = null;
            try
              sleep(1000);
            catch (Exception ee)
              parent.logit("Error after sleep " + ee.toString());
          catch (Exception e)
            parent.logit("Error closing EVR server socket");
    //=============================================================================
    // Call this method to kill the client socket connection.
    //=============================================================================
       * Call this method to kill the client socket connection.
      public void killConnection()
        killSocket = true;
    //=============================================================================
    // Return RTM connected state
    //=============================================================================
       * Return RTM connected state
       * @return boolean - Returns true if RTM is connected to server, false if not.
      public boolean isRtmConnected()
        return evrConnected;
    //=============================================================================
    // Returns state of server socket.
    //=============================================================================
       * Returns state of server socket.
       * @return boolean - Returns true if server socket is enabled, false if not.
      public boolean isServerSocketAlive()
        return alive;
    //=============================================================================
    // Send a message to the client socket.
    //=============================================================================
         * Send a message to the client socket.
         * @param msg String - Message to send.
         * @return boolean - Returns true if message sent OK, false if not.
      public boolean sendMessage(String msg)
        parent.logit(" In EVR Server - Send Message - got message: " + msg);
        if (evrConnected)
          try
            parent.logit("Sending message to EVR: " + msg);
            writer.write(msg + "\n");
            writer.flush();
            return true;
          catch (Exception e)
            parent.logit("ERROR - Error sending message to EVR: " + e.toString());
            return false;
        else
          parent.logit("EVR not connected, cannot send message: " + msg);
          return false;
    }Client code:
    package evrsimulator;
    import java.net.*;
    import java.io.*;
    class PortConnector
          extends Thread
       ServerSocket serverSock = null;
       boolean isIP = false;
       InetAddress addr = null;
       Frame1 parent = null;
       byte[] rawIP;
        //   String initialMsg = "";
       public PortConnector( Frame1 f )
         parent = f;
       // This method is called when the thread runs
       public void run()
          if ( parent.hostName.indexOf( "." ) > 0 )
             isIP = true;
             byte[] rawIP = parent.getRawIP( parent.hostName );
          try
             System.out.println( "Connecting to host " +
                                            parent.hostName + " on port " +
                                            parent.socketPort );
             if ( isIP )
                addr = InetAddress.getByAddress( rawIP );
             else
                addr = InetAddress.getByName( parent.hostName );
             System.out.println( "Inet address = " + addr );
             SocketAddress sockaddr =
                   new InetSocketAddress( addr, parent.socketPort );
             // Create an unbound socket
             parent.client = new Socket();
             // This method will block no more than timeoutMs.
             // If the timeout occurs, SocketTimeoutException is thrown.
             parent.client.connect( sockaddr, parent.socketTimeOut );
             parent.socketOut =
                   new BufferedWriter( new OutputStreamWriter(
                   parent.client.getOutputStream() ) );
             parent.socketIn = new BufferedReader( new InputStreamReader(
                   parent.client.getInputStream() ) );
             parent.localName = parent.localName +
                   parent.client;
             System.out.println( "Parent socketOut = "+parent.socketOut);
             System.out.println( "Parent socketIn = "+parent.socketIn);
          catch ( UnknownHostException uhe )
             System.out.println( "Unknown Host - " + uhe.getMessage() );
          catch ( SocketTimeoutException ste )
             System.out.println( "Socket time out - " + ste.getMessage());
          catch ( IOException ioe )
             System.out.println( "IO exception - " + ioe.getMessage() );
          // Listen on socket for message from host - thread should block.
          parent.portConnected = true;
          while ( parent.portConnected )
             try
                String msg = parent.socketIn.readLine();
                System.out.println( "Message from Host: " + msg );
                System.out.println( "Message from Host: |" + msg + "|" );
                if( msg.length() > 2)parent.processMessage( msg );
             catch ( IOException ioe )
                System.out.println( "Exception creating server socket." );
          try
             System.out.println(
                   "PortConnection - Closing socket and IO connections" );
             parent.socketIn.close();
             parent.socketOut.close();
             parent.client.close();
             parent.clockRunning = false;
             if( parent.heartBeating) heartBeat.interrupt();
          catch ( IOException ioex )
             System.out.println( "Exception closing socket." );
    }

    Your first problem is that you keep closing and recreating the ServerSocket. Do this once only in the lifetime of the server.
    This is such a basic error that I haven't read the rest of the code. Before you go any further I suggest you read the Custom Networking trail of the Java Tutorial.

  • Problems with the Proxy Programme--Please help

    Hi All,
    I have written a simple proxy server in the form of a servlet. I changed the proxy config of my browser to connect to this servlet hosted on the default context(http://localhost:8080) of the Tomcat 5.0.25 . Well , this servlet internally connects to the proxy of the corporate LAN . The logic that I have applied is as follows. The servlet gets the request from the client (ie the browser in this case) , extracts the headers and contents from the request, sets them to a new request that it forms and finally send this new request to the proxy. When the proxy responds, the servlet collects the response headers and contents adn writes them in its response. To sum up , this servlet transparently carries the requests and responses between the client(browser) and the corporate LAN proxy. Now the problem is this. Let's say , now I am accessing http://www.google.com.The browser sends a request to my servlet with the following headers as they are extracted by my servlet.
    ProxyServer:::>posting request
    ProxyServer:::>headerValue::> headerName = accept : headerValue=*/*
    ProxyServer:::>headerValue::> headerName = referer : headerValue=http://www.google.com/
    ProxyServer:::>headerValue::> headerName = accept-language : headerValue=en-us
    ProxyServer:::>headerValue::> headerName = proxy-connection : headerValue=Keep-Alive
    ProxyServer:::>headerValue::> headerName = user-agent : headerValue=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; UB1.4_IE6.0_SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
    ProxyServer:::>headerValue::> headerName = host : headerValue=www.google.com
    ProxyServer:::>headerValue::> headerName = cookie : headerValue=PREF=ID=1be27c0a74f198ca:TM=1082058853:LM=1082058853:S=bu6ORrygzm8AUkm8
    ProxyServer:::>postRequest
    I set these headers into a new connection opened to the proxy and post a fresh request to the proxy,which, in turn responds with the following headers.
    ProxyServer:::>posted request successfully
    ProxyServer:::>writing response
    ProxyServer:::>writeResponse-->headerName = Proxy-Connection : headerValue = [close]
    ProxyServer:::>writeResponse-->headerName = Content-Length : headerValue = [257]
    ProxyServer:::>writeResponse-->headerName = Date : headerValue = [Tue, 13 Jul 2004 14:01:40 GMT]
    ProxyServer:::>writeResponse-->headerName = Content-Type : headerValue = [text/html]
    ProxyServer:::>writeResponse-->headerName = Server : headerValue = [NetCache appliance (NetApp/5.5R2)]
    ProxyServer:::>writeResponse-->headerName = Proxy-Authenticate : headerValue = [Basic realm="Charlotte - napxyclt2"]
    ProxyServer:::>writeResponse-->headerName = null : headerValue = [HTTP/1.1 407 Proxy Authentication Required]
    ProxyServer:::>writeResponse exiting
    ProxyServer:::>wrote response successfully
    I write these headers back to the client. According to what I was thinking, the client ie the browser would open a new dialog box asking for username/password owing to the presence of the "Proxy-Authenticate " header. But it does not happen that way. Rather the browser stops responsding and displays a blank page. Does anyone know why it happens this way? I am pasting the server prog below for everybody's reference.
    package server.proxy;
    //import all servlet related classes
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import server.resources.*;
    //My Proxy server --->Currently it is very simplea and relies on
    //other proxy servers of an already connected network.
    public class ProxyServer extends HttpServlet
    //stores the resource bundle
    private ServerResBundle resBundle = null;
    //checks for the mode of operation
    private boolean proxySet = false;
    private String proxy = null;
    //storing the original System out/err etc
    private PrintStream sysOutOrig = null;
    private PrintStream sysErrOrig = null;
    private InputStream sysInOrig = null;
    //initialise certain features that are required later
    public void init() throws ServletException
    try
    //initialise the resource bundle
    this.initResBundle();
    System.out.println("ProxyServer:::>res bundle init");
    //set the mode of operation
    this.setMode();
    System.out.println("ProxyServer:::>mode set");
    //set the system out and err --System.setOut etc
    this.setSystemOutErr();
    System.out.println("ProxyServer:::>in/out/err set");
    }//End try
    catch(Exception e)
    System.out.println("Exception in init..."+(e.getMessage()));
    throw new ServletException(e);
    }//Edn
    catch(Throwable e)
    System.out.println("Irrecoverable Error...");
    throw new ServletException(e);
    }//End
    }//End init
    //method to init the resource bundle;
    private void initResBundle()
    this.resBundle = ServerResBundle.getBundle();
    }//End
    //method to set the mode of the server--proxy or direct
    private void setMode()
    //read the target proxy property from the bundle and
    //if it is set,take that URL
    String temp = (String)(this.resBundle.getResource(ResKeys.PROXY_SERVER));
    if ( (temp != null) && (temp.length() > 0) )
    this.proxySet = true;
    this.proxy = temp;
    temp = null;
    }//End
    }//End
    //method to set the system out and err etc
    private void setSystemOutErr() throws Exception
    //keep a copy of the original system out and error
    this.sysOutOrig = System.out;
    this.sysErrOrig = System.err;
    try
    //read the options adn if they are set, take the values directly
    String newOutStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_OUT));
    String newErrStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_ERR));
    if ((newOutStr != null) && (newOutStr.length() > 0))
    System.setOut(new PrintStream(new FileOutputStream(new File(newOutStr),true),true));
    }//End if
    if ((newErrStr != null) && (newErrStr.length() > 0))
    System.setErr(new PrintStream(new FileOutputStream(new File(newErrStr),true),true));
    }//End if
    }//End
    catch(Exception e)
    //restore the stuff
    System.setOut(this.sysOutOrig);
    System.setErr(this.sysErrOrig);
    }//End
    }//End
    //this is where the proxy functionalities will be embedded
    public void service(HttpServletRequest req,HttpServletResponse resp)
    throws ServletException,java.io.IOException
    //conenction URL
    URL target = null;
    //conenction to the remote object
    URLConnection targetConn = null;
    //stores the OOS and the OIS
    ObjectOutputStream oos = null;
    ObjectInputStream ois = null;
    try
    //check for the mode of operation
    if (proxySet)
    URLConnection objects go through two phases: first they are created, then they are connected.
    After being created, and before being connected, various options can be specified
    (e.g., doInput and UseCaches). After connecting, it is an error to try to set them.
    Operations that depend on being connected, like getContentLength, will implicitly perform the connection,
    if necessary.
    //for the URL to the proxy
    target=new URL(this.proxy);
    //conenct to the proxy
    targetConn = target.openConnection();
    //set the details of the connectuon
    targetConn.setDoInput(true);
    targetConn.setDoOutput(true);
    targetConn.setUseCaches(false);
    // If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed
    targetConn.setAllowUserInteraction(true);
    //connect to the remote object
    // targetConn.connect();//call this only when all the request properties are set
    System.out.println("ProxyServer:::>posting request");
    //post the received request to the URL
    this.postRequest(targetConn,req);
    System.out.println("ProxyServer:::>posted request successfully");
    System.out.println("ProxyServer:::>writing response");
    //receive the response
    //write the received response to the client
    this.writeResponse(targetConn,resp);
    System.out.println("ProxyServer:::>wrote response successfully");
    }//End if
    else
    //currently this functionality is not supported
    throw new ServletException(
    (String)(this.resBundle.getResource(ResKeys.ERR_FUNC_NOTSUPPORTED)));
    }//End
    }//End try
    catch(Exception e)
    if(e instanceof ServletException)
    throw (ServletException)e;
    }//End
    if (e instanceof IOException)
    throw (IOException)e;
    }//End
    //wrap it up in ServletException
    throw new ServletException(e);
    }//End
    }//End
    //method to write the response back to the client
    private void writeResponse(URLConnection targetConn,HttpServletResponse resp)
    throws ServletException
    //get all the header fields from the response connection and set them to the
    //response of the servlet
    Map headerFields = null;
    Iterator headerFieldEntries = null;
    Map.Entry header = null;
    //stores the input stream to the conn
    BufferedReader brConn = null;
    //stores the writer to the response
    PrintWriter prResp = null;
    //checks if the proxy authentication needed or not
    boolean proxyAuthReqd = false;
    try
    //juste ensuring that the proxy authentication is reset
    proxyAuthReqd = false;
    if( (targetConn != null) && (resp != null) )
    //Returns an unmodifiable Map of the header fields.
    //The Map keys are Strings that represent the response-header field names.
    //Each Map value is an unmodifiable List of Strings that represents the corresponding
    //field values
    headerFields = targetConn.getHeaderFields();
    //Returns a set view of the mappings contained in this map
    Set temp = headerFields.entrySet();
    //Returns an iterator over the elements in this set
    headerFieldEntries = temp.iterator();
    if (headerFieldEntries != null)
    while (headerFieldEntries.hasNext())
    Object tempHeader = headerFieldEntries.next();
    if (tempHeader instanceof Map.Entry)
    header = (Map.Entry)tempHeader;
    Object headerName = header.getKey();
    Object headerValue=header.getValue();
    System.out.println("ProxyServer:::>writeResponse-->headerName = "+headerName+" : headerValue = "+headerValue);
    //do not select the key-value pair if both the key adn the value are null
    if ( ( headerName == null) && (headerValue == null) )
    continue;
    }//Enmd
    if (headerValue != null)
    List headerValList = null;
    if (headerValue instanceof List)
    headerValList = (List)headerValue;
    }//End
    if(headerValList != null)
    for (int i=0;i<headerValList.size();i++)
    Object headerValueStr = headerValList.get(i);
    if (headerValueStr instanceof String)
    //note that the header-key can not be null for addHeader
    //I have made this temporary provision to make the programme work.
    resp.addHeader(( (headerName==null)? ("null_header"+i) :(String)headerName),
    (String)headerValueStr);
    //check if the proxy authentication required or not
    if (((String)headerValueStr).
    indexOf(resp.SC_PROXY_AUTHENTICATION_REQUIRED+"") != -1)
    System.out.println("ProxyServer:::>writeResponse-->proxy auth needed");
    //proxy authentication is needed
    proxyAuthReqd = true;
    }//End
    }//Ednd of
    else if (headerValueStr == null)
    resp.addHeader(( (headerName==null)? null :(String)headerName),
    null);
    }//End
    }//End for
    }//End if
    }//End if
    }//End
    }//End while
    }//End if
    //get the writer to the client
    prResp = resp.getWriter();
    System.out.println("ProxyServer:::>writeResponse-->proxyAuthReqd="+proxyAuthReqd);
    //juste test a simple header
    System.out.println("Proxy-Authenticate = "+(resp.containsHeader("Proxy-Authenticate")));
    //if the proxy asks you for authentication,pass on the same to the client
    //from whom you have received the request.When this flag is true,the connection
    //is closed by the remotehost adn hence any attempt to open in input steram
    //results in an error ie IOException
    if (!proxyAuthReqd)
    //now get the content adn write it to the response too
    brConn = new BufferedReader(new InputStreamReader(
    targetConn.getInputStream()));
    String tempStr = null;
    while ((tempStr = brConn.readLine())!=null)
    prResp.println(tempStr);
    }//End while
    //close the connections
    brConn.close();
    }//End if
    else
    prResp.println("Proxy Authentication needed...");
    }//End
    //close the streams
    prResp.flush();
    prResp.close();
    }//End if
    System.out.println("ProxyServer:::>writeResponse exiting\n");
    }//End try
    catch(Exception e)
    throw new ServletException(e);
    }//End
    }//End
    //method to post request to the internet
    private void postRequest(URLConnection targetConn,HttpServletRequest req)
    throws ServletException
    //extract the header parameters and the body content from the incoming request
    //and set them to the new connection
    Enumeration reqHeaders = null;
    //reads the incoming request's content
    BufferedReader brReqRd = null;
    PrintWriter prResWt = null;
    //stores temp header names and values
    String headerName = null;
    String headerValue = null;
    try
    if( (targetConn != null) && (req != null) )
    reqHeaders = req.getHeaderNames();
    //extract a header adn set it to the new connection
    while (reqHeaders.hasMoreElements())
    headerName = (String)(reqHeaders.nextElement());
    headerValue = req.getHeader(headerName);
    targetConn.setRequestProperty(headerName,headerValue);
    System.out.println("ProxyServer:::>headerValue::> headerName = "+headerName+" : headerValue="+headerValue);
    }//End
    System.out.println("ProxyServer:::>postRequest\n");
    //establis the actual connection
    //calling this method bfore the above loop results in IllegalStateException
    targetConn.connect();
    //NOTE : try reading from and writing into OIS and OOS respectively
    //now read the contents and write them to the connection
    // brReqRd = req.getReader(); //this hangs for some reason
    brReqRd = new BufferedReader(new InputStreamReader(req.getInputStream()));
    System.out.println("Got the reader..brReqRd = "+brReqRd);
    if (brReqRd != null)
    String temp = null;
    //establish the printwriter
    // prResWt = new PrintWriter(targetConn.getOutputStream(),true);
    prResWt = new PrintWriter(targetConn.getOutputStream());
    System.out.println("trying to read in a loop from brReqRd.. ready="+(brReqRd.ready()));
    while( (brReqRd.ready()) && ((temp=brReqRd.readLine()) != null) )
    System.out.println("In while::>temp = "+temp);
    prResWt.println(temp);
    }//Emd while
    //close the streams adn go back
    brReqRd.close();
    prResWt.flush();
    prResWt.close();
    }//End
    }//End outer if
    System.out.println("ProxyServer:::>postRequest exiting\n");
    }//End try
    catch(Exception e)
    throw new ServletException(e);
    }//End
    }//End
    }//End

    Hi serlank ,
    Thanks for your reply. Well , I initially I thought of not pasting the code,as it was too long. But I could not help it,as I thought I must show in code what I exactly meant. That's why I followed a description of my problem with the code. You could probably have copied the code and pasted it in one of your favourite editors to take a look at it. Did you,by any chance, try to read it on the browser? And as regards reposting the same message, I can say that I did it as I felt the subject was not quite appropriate in the first posting and I was not sure as to how I could delete/alter the posting. I am not asking for a code-fix,but some suggestions from some one who might ever have come across such a thing.Anyway, lemme know if you have any idea on it. Thanks...

  • Problems creating a sticky footer

    Hi,
    I'm trying to create a website in Dreamweaver using a template that I purchased but I am having problems fixing a footer to the bottom of the page,
    At the moment the content footer that I have created (which is a table) changes positon from page to page depending on the content.
    The template comes with 2 x CSS style sheets  and 1 x JS coded page which I know I need to amend in order for the footer to remain fixed to the bottom of each page.
    The trouble is my CSS and JS are not up to much. I have inserted the code from the HTML, CSS & JS below.
    If anyone can help me out it would be fantastic as I'm really at a loss!
    The HTML of my main webpage is as follows:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <!-- saved from url=(0023)http://www.contoso.com/ -->
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="layout.css" rel="stylesheet" type="text/css" />
    <script src="maxheight.js" type="text/javascript"></script>
    <script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
    <script type="text/javascript">
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    </script>
    </head>
    <body  id="page1" onload="new ElementMaxHeight(); ;MM_preloadImages('images/facebook2.gif','images/linkedin2.gif','images/twitter2.gif')">
    <div id="header">
        <div class="main">
         <div class="flash">
           <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="980" height="137">
             <param name="movie" value="flash/menu_v8.swf" />
             <param name="quality" value="high" />
             <param name="wmode" value="transparent" />
             <param name="swfversion" value="8.0.35.0" />
             <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
             <param name="expressinstall" value="Scripts/expressInstall.swf" />
             <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
             <!--[if !IE]>-->
             <object type="application/x-shockwave-flash" data="flash/menu_v8.swf" width="980" height="137">
               <!--<![endif]-->
               <param name="quality" value="high" />
               <param name="wmode" value="transparent" />
               <param name="swfversion" value="8.0.35.0" />
               <param name="expressinstall" value="Scripts/expressInstall.swf" />
               <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
               <div>
                 <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                 <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" id="Image2" /></a></p>
               </div>
               <!--[if !IE]>-->
             </object>
             <!--<![endif]-->
           </object>
         </div>
           <div class="flash1">
             <object id="FlashID2" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="587" height="389">
               <param name="movie" value="flash/header_v8.swf" />
               <param name="quality" value="high" />
               <param name="wmode" value="transparent" />
               <param name="swfversion" value="8.0.35.0" />
               <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
               <param name="expressinstall" value="Scripts/expressInstall.swf" />
               <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
               <!--[if !IE]>-->
               <object type="application/x-shockwave-flash" data="flash/header_v8.swf" width="587" height="389">
                 <!--<![endif]-->
                 <param name="quality" value="high" />
                 <param name="wmode" value="transparent" />
                 <param name="swfversion" value="8.0.35.0" />
                 <param name="expressinstall" value="Scripts/expressInstall.swf" />
                 <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                 <div>
                   <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                   <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" id="Image3" /></a></p>
                 </div>
                 <!--[if !IE]>-->
               </object>
               <!--<![endif]-->
             </object>
           </div>
            <div class="indent1">
             <div class="container1">
               <p>Welcome to ACL International.<br />
                     Through our offices in the UK and Portugal we supply the<br />
                     very latest in energy saving technologies with our main<br />
                     focus being on lighting. ACL have been active in the lighting<br />
                  industry for over 10 years and have built up strong relationships with some of the world's leading lighting manufacturers.</p>
               <p> </p>
               <p>Welcome to ACL International.<br />
    Through our offices in the UK and Portugal we supply the<br />
    very latest in energy saving technologies with our main<br />
    focus being on lighting. ACL have been active in the lighting<br />
    industry for over 10 years and have built up strong relationships with some of the world's leading lighting manufacturers.</p>
              </div>
          </div>
        </div>
    </div>
    <div id="content">
        <div class="main">
            <div class="indent-main">
                <div class="container bg">
                    <div class="container bg1">
                        <div class="container bg2">
                            <div class="col-1 bg-1">
                             <div class="indent-col">
                                 <img alt="" src="images/1page_title1.gif" class="title" /><br />
                                    <p>An easy and affordable<br />
                                  way to change existing<br />
                                  lighting to an energy<br />
                                  saving alternative...</p>
                                    <div class="container"><a href="#" class="link-1"><em><b>read more</b></em></a></div>
                                </div>
                            </div>
                            <div class="col-1 bg-2">
                             <div class="indent-col">
                                 <img alt="" src="images/1page_title2.gif" class="title" /><br />
                                    <p>A more natural,<br />
                                    environmentally<br />
                                    friendly light<br />
                                    source...  </p>
                                    <div class="container"><a href="#" class="link-1"><em><b>read more</b></em></a></div>
                                </div>
                            </div>
                            <div class="col-1 bg-3">
                             <div class="indent-col">
                                 <img alt="" src="images/1page_title3.gif" class="title" /><br />
                                    <p>Up to 80% energy <br />
                                  saving with an<br />
                                  extremely long<br />
                                  lifetime... </p>
                                    <div class="container"><a href="#" class="link-1"><em><b>read more</b></em></a></div>
                                </div>
                            </div>
                            <div class="col-1 bg-4">
                             <div class="indent-col">
                                 <img alt="" src="images/1page_title4.gif" class="title" /><br />
                                    <p>Low glare,<br />
                                    creating a more<br />
                                    comfortable<br />
                                    environment... </p>
                                    <div class="container"><a href="#" class="link-1"><em><b>read more</b></em></a></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="footer">
        <div class="main">
            <div class="indent-footer">
              <table width="929" border="0">
                <tr>
                  <td width="869">ACLI  &copy; 2012  <a href="index-5.html">Privacy Policy</a></td>
                  <td><img src="images/followus.gif" alt="" width="73" height="20" /></td>
                  <td width="20"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('facebook','','images/facebook2.gif',1)"><img src="images/facebook.gif" width="20" height="20" border="0" id="facebook" /></a></td>
                  <td width="20"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('linkedin','','images/linkedin2.gif',1)"><img src="images/linkedin.gif" width="25" height="20" border="0" id="linkedin" /></a></td>
                  <td width="20"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('twitter','','images/twitter2.gif',1)"><img src="images/twitter.gif" width="27" height="20" border="0" id="twitter" /></a></td>
                </tr>
              </table>
            </div>
        </div>
    </div>
    <script type="text/javascript">
    swfobject.registerObject("FlashID");
    swfobject.registerObject("FlashID2");
    </script>
    </body>
    </html>
    The CSS of the layout is as follows:
    .col-1, .col-2, .col-3, .col-4, .col-5{ float:left}
    /*======= width =======*/
    .main{margin:0 auto; text-align:left; width:929px; }
    /*======= header =======*/
    #header {height:339px;  background:url(images/bg.jpg) }
    #page1 #header {height:526px;}
    /*======= index.html =======*/
    #page1 #content .col-1{ width:231px; margin-right:1px}
    #page1 #content .bg{ background:url(images/tail.gif) repeat-y 231px top }
    #page1 #content .bg1{ background:url(images/tail.gif) repeat-y 463px top }
    #page1 #content .bg2{ background:url(images/tail.gif) repeat-y 695px top }
    /*======= index-1.html =======*/
    #page2 #content .col-1{ width:339px; margin-right:0}
    #page2 #content .col-2{ width:590px}
    #page2 #content .col-3{ width:154px; margin-right:32px}
    #page2 #content .col-4{ width:158px; margin-right:30px}
    #page2 #content .col-5{ width:155px; margin-right:0}
    /*======= index-2.html =======*/
    #page3 #content .col-1{ width:590px; margin-right:0}
    #page3 #content .col-2{ width:339px}
    #page3 #content .col-3{ width:188px; margin-right:0}
    #page3 #content .col-4{ width:155px; margin-right:0}
    /*======= index-3.html =======*/
    #page4 #content .col-1{ width:339px; margin-right:0}
    #page4 #content .col-2{ width:590px}
    #page4 #content .col-3{ width:95px; margin-right:2px; text-align:right; line-height:1em; padding-top:3px}
    #page4 #content .col-4{ width:188px; margin-right:0}
    /*======= index-4.html =======*/
    #page5 #content .col-1{ width:590px; margin-right:0}
    #page5 #content .col-2{ width:339px}
    #page5 #content .col-3{ width:95px; margin-right:2px; text-align:right; line-height:1em; padding-top:3px}
    #page5 #content .col-4{ width:188px; margin-right:0}
    /*======= footer =======*/
    #footer { height:110px; }
    The CSS of the style is as follows:
    /* CSS Document */
    * { margin:0; padding:0;}
    html, body { height:100%; }
    body {font-size:100%; line-height:1.125em;}
    html, input, textarea {
    font-family: "Century Gothic";
    color:#646464;
    .alignMiddle{ vertical-align:middle}
    .alignCenter{ text-align: center}
    .container1{ width:100%}
    object { vertical-align:top; outline:none}
    .clear { clear:both;}
    .fleft{ float:left}
    .fright{ float:right}
    div.container { overflow:hidden; width: 100%;}
    a img{ border:0}
    img{ vertical-align:top;  }
    a{color:#000000; text-decoration:underline; outline:none}
    a:hover{text-decoration:none}
    .link{color:#000000; background:url(images/marker.gif) top left no-repeat; padding-left:20px; background-position:0 5px; text-decoration:none; font-size:.916em  }
    .link:hover{text-decoration:underline }
    .button{color:#fff; font-size:.916em; line-height:20px ; padding:2px 8px 8px 6px; text-decoration:none;  }
    .button:hover{color:#000; background:url(images/button.gif) top left no-repeat; padding:2px 8px 8px 6px; text-decoration:none; line-height:20px ;  }
    .current{color:#000; background:url(images/button.gif) top left no-repeat; padding:2px 8px 8px 6px; text-decoration:none; line-height:20px ;  }
    ul{margin:0; padding:0; list-style:none;}
    ul li a{color:#646464; text-decoration: underline; line-height:1.66em}
    ul li a:hover { text-decoration:none; }
    .ul1 li{background:url(images/marker.gif) top left no-repeat; background-position:0 5px; margin:0; padding-left:10px; }
    .ul1 li a{color:#646464; text-decoration:none ; line-height:1.5em}
    .ul1 li a:hover { text-decoration:underline; }
    .ul li{background:url(images/tail-1.gif) repeat-x bottom; margin:0; padding-left:0; }
    .ul li span{color:#646464; float:right; background:url(images/tail-2.gif) repeat-x bottom;}
    .ul li a{color:#646464; text-decoration: underline; line-height:1.66em;  background:url(images/tail-2.gif) repeat-x bottom;}
    .ul li a:hover { text-decoration:none; }
    .link-1 { display:block; float:left; background:url(images/link_bg.gif) left top repeat-x; color:#ffffff; text-decoration:none; }
    .link-1 em { display:block; background:url(images/link_left.gif) no-repeat left top;}
    .link-1  b { display:block; background:url(images/link_right.gif) no-repeat right top; padding:0 5px 3px 7px; font-weight:normal; font-style:normal;}
    .link-1:hover{ text-decoration:none; color:#627311}
    .link-2 { display:block; float:left; background:url(images/link_bg.gif) left top repeat-x; color:#ffffff; text-decoration:none; }
    .link-2 em { display:block; background:url(images/link_left.gif) no-repeat left top;}
    .link-2  b { display:block; background:url(images/link_right.gif) no-repeat right top; padding:0 15px 3px 17px; font-weight:normal; font-style:normal;}
    .link-2:hover{ text-decoration:none; color:#627311}
    /*header*/
    #header {font-size:0.75em; color:#646464 }
    #header .logo{ margin:19px 0 9px 0 }
    #header .indent{margin:30px 0 0 755px; position:absolute; width:175px; color:#625a49}
    #page1 #header .indent1{padding:40px 0 0 565px}
    #header .indent1{padding:22px 0 0 0px}
    #header .indent2{padding:11px 0 0 397px}
    #header .img-left{ float:left; margin:0 31px 0 0}
    #header .img-indent{ margin:0 24px 0 0}
    #header .img-indent1{ margin:0 23px 0 0;}
    #header .title{  margin-bottom:11px}
    #header a{ color:#625a49; text-decoration:none}
    #header a:hover{text-decoration: underline}
    .flash{ margin:0 -27px 0 -25px; position:relative}
    .flash1{ margin:0 0 0 -25px; position: absolute}
    #page1 .bg-1{
    background-image: url(images/1page_img1.jpg);
    background-repeat: no-repeat;
    background-position: right bottom;
    #page1 .bg-2{ background:url(images/1page_img2.jpg) no-repeat bottom right}
    #page1 .bg-3{ background:url(images/1page_img3.jpg) no-repeat bottom right}
    #page1 .bg-4{ background:url(images/1page_img4.jpg) no-repeat bottom right}
    .bg-5{ background:url(images/bg-1.gif) repeat-x top #e5e5e5; width:100%}
    .bg-6{ background:url(images/bg-2.gif) repeat-x top #fff; width:100%}
    /*content*/
    #content{ font-size:0.75em; width:100%; text-align:left; background:url(images/bg_cont.gif) repeat-x top #fff}
    #content .indent-main{padding:11px 0 0 0}
    #content .indent-main1{padding:3px 0 0 0}
    #content .indent-col{padding:14px 0 28px 20px}
    #content .indent-col1{padding:32px 14px 24px 15px}
    #content .indent-col2{padding:32px 28px 0 28px}
    #content .title{  margin-bottom:8px}
    #content .img-left{ float:left; margin:0 20px 16px 0}
    #content .img-right{ float:right; margin:0 0 0 10px}
    #content .img-indent{ margin:0 0 16px 0}
    #content p{ margin:0 0 17px 0}
    #content .p{ margin:0}
    #content .p1{ margin:0 0 17px 0}
    #content h4{color:#8b870e; font-size:1em; margin-bottom:13px;  }
    #content .tail{ background:url(images/tail2.gif) repeat-x bottom; padding-bottom:26px; margin-bottom:21px}
    .txt{ color:#8e9c2e; font-weight:normal}
    .txt a{ color:#8e9c2e; }
    #content .indent{padding:15px 0 0 0}
    /*box*/
    .box{ background:#fcfcfc; width:100%;}
    .box .indent-box{ padding:11px 18px 11px 20px; }
    .box .indent-box1{ padding:11px 10px 11px 10px; }
    /*footer*/
    #footer { color:#5a5a5a; text-transform:uppercase; font-size:0.6875em ; }
    #footer .indent-footer{ padding:37px 0 0 0; background:url(images/bot.gif) repeat-x top;}
    #footer a {color:#5a5a5a; text-decoration:underline} 
    #footer a:hover {  text-decoration:none}
    .jamp{ width:69px;}
    .jamp1{ width:64px;}
    .jamp2{ width:58px;}
    .jamp3{ width:52px;}
    select{font-size:12px; color:#646464; height:19px; font-family: Arial, Helvetica, sans-serif;}
    .indent-2{ position:relative; padding-right:20px; float:left}
    .h{ height:29px}
    .block-contact span{ float:right; margin-right:50px}
    input{
    width:183px; height:17px;
    font-size:1em;
    color:#646464;
    padding-left:5px;
    textarea{
    width:183px; height:57px;
    font-size:1em;
    color:#646464;
    padding-left:5px;
    margin-bottom:11px;
    overflow:auto}
    .textarea{
    width:183px; height:142px;
    font-size:1em;
    color:#646464;
    padding-left:5px;
    margin-bottom:11px;
    overflow:auto}
    The JS page is as follows:
    var ElementMaxHeight = function() {
      this.initialize.apply(this, arguments);
    ElementMaxHeight.prototype = {
      initialize: function(className) {
        this.elements = document.getElementsByClassName(className || 'maxheight');   
        this.textElement = document.createElement('span');
        this.textElement.appendChild(document.createTextNode('A'));
        this.textElement.style.display = 'block';
        this.textElement.style.position = 'absolute';
        this.textElement.style.fontSize = '1em';
        this.textElement.style.top = '-1000px';
        this.textElement.style.left = '-1000px';
        document.body.appendChild(this.textElement);
        this.textElementHeight = document.getDimensions(this.textElement).height;
        var __object = this;
        var __checkFontSize = this.checkFontSize;
        this.checkFontSizeInterval = window.setInterval(function() {return __checkFontSize.apply(__object)}, 500);
        this.expand();
        // Refresh elements height onResize event
        var __expand = this.expand;
        if (window.addEventListener) {
          window.addEventListener('resize', function(event) {return __expand.apply(__object, [( event || window.event)])}, false);
        } else if (window.attachEvent) {
          window.attachEvent('onresize', function(event) {return __expand.apply(__object, [( event || window.event)])});
      expand: function() {
        this.reset();
       for (var i = 0; i < this.elements.length; i++) {  
          this.elements[i].style.height = document.getDimensions(this.elements[i].parentNode).height + 'px';
      reset: function() {
        for (var i = 0; i < this.elements.length; i++) {   
          this.elements[i].style.height = 'auto';
      checkFontSize: function() {
       var height = document.getDimensions(this.textElement).height;
       if(this.textElementHeight != height) {
        this.textElementHeight = height;
        this.expand();
    if (!!document.evaluate) {
      document._getElementsByXPath = function(expression, parentElement) {
        var results = [];
        var query = document.evaluate(expression, parentElement || document,
          null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
        for (var i = 0, length = query.snapshotLength; i < length; i++)
          results.push(query.snapshotItem(i));
        return results;
    document.getElementsByClassName = function(className, parentElement) {
      if (!!document.evaluate) {
        var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
        return document._getElementsByXPath(q, parentElement);
      } else {
        var children = (parentElement || document.body).getElementsByTagName('*');
        var elements = [], child;
        for (var i = 0, length = children.length; i < length; i++) {
          child = children[i];
          if (child.className.length != 0 &&
              (child.className == className ||
               child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))) {     
            elements.push(child);
        return elements;
    document.getDimensions = function (element) {
      var display = element.style.display;
      if (display != 'none' && display != null) { // Safari bug
        return {width: element.offsetWidth, height: element.offsetHeight};
      return {width: originalWidth, height: originalHeight};

    A sticky footer is position:fixed and therefor always visible in the bottom of browser viewports -- even when users scroll up or down the page.
    Sticky Footer Demo:
    http://alt-web.com/DEMOS/CSS2-Sticky-Footer.shtml
    I believe what you're trying to achieve is 100% height on long & short pages.  Try this:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>100% height page layout</title>
    <style type="text/css">
    /**==========================
    100% height layout
    ===========================*/
    html,body {
    margin:0;
    padding:0;
    height:100%; /* needed for container min-height */
    background:gray;
    font-family:arial,sans-serif;
    font-size:small;
    color:#666;
    zoom: 1;
    #container {
    position:relative; /* needed for footer positioning*/
    margin:0 auto; /* center, not in IE5 */
    width:1000px;
    background:#FF9999;
    height:auto !important; /* real browsers */
    height:100%; /* IE6: treated as min-height*/
    min-height:100%; /* real browsers */
    #header {
    padding:1em;
    background:#ddd;
    min-height: 95px;
    border-bottom:6px double gray;
    #content {
    padding:1em 1em 5em; /* bottom padding for footer */
    #footer {
    position:absolute;
    width:100%;
    bottom:0; /* stick to bottom */
    background:#ddd;
    min-height: 95px;
    border-top:6px double gray;
    #footer p {padding:1em}
    </style>
    </head>
    <body>
    <div id="container">
    <div id="header">
    <p>here is the header</p>
    </div>
    <div id="content">
    <p>Here is the content</p>
    </div>
    <div id="footer">
    <p>Here is the footer</p>
    </div>
    <!--end container --></div>
    </body>
    </html>
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

Maybe you are looking for

  • Can I convert many XMLs into one Excel Sheet?

    Hi: I get 20-30 XMLs daily from client and I want them all converted and merged in single excel sheet through AppleScript. Can any one help? Thank you.

  • How to invoke BPMN processes in another project in JDeveloper?

    I have imported two BPMN diagrams from the Oracle BPA to JDeveloper. After importing I ended up with two projects each containing the first and second diagram. The problem now is in the final product, the user should be able to go through the tasks a

  • Attachment jpg

    Hi,  I used the SMPT Send File.vi to send an E-mail with an attachment which is a picture,  picture format is .JPG. But in the foxmail I can't open it. I want know the reason and how can I get the picture from E-mail. Thanks in  advance.

  • File transfer between mac and windows 7

    Is it possible to transfer files between my Mac and a windows 7 machine via bluetooth? MacBook Pro OS X 10.6.4 Thanks

  • Is anyone else experiencing long restart and shutdown times?

    I installed Mavericks the day it came out. I am experiencing very long restart and shutdown times, well over 2 minutes. I thought the shutdown times with Mountain Lion were bad. Is anyone else having this issue? If so, how did you fix it?