Pls help 4m swing class

Design, implement and test a Java class that will extract the required information from a headstone inscription. From a programming viewpoint this involves complex string manipulation with a little file handling to get the inscription from the Text file. For each inscription it is required to display on the computer screen, in tabular form, the Name, Death Date and Birth Date of each person buried under the stone.
Note:
That the birth date is not always given. Often the age at death in years is given hence it would be possible to compute the birth year or the year after the birth year. Complications arise with the death of young children. Often the age at death is given in days or months hence it might be possible to compute an exact birth date or at least a birth month. As each inscription is analysed the �original� inscription should be displayed, thus giving an immediate visual check that the data has been extracted correctly.
EX
Some sample data from gravesite Stoke Oats Esfield, UK
In / memory of / WENDY-SARAH / SMITH 6th of March 1599/ and HENRY TODOR 28th of
January 1547/ Forever in our thoughts / love LIZ and HARRY /
In loving memory / of / JACK McDONALD /aged 3 days / 1799 / Jesus said suffer little /
children to come unto Me /
In / loving / memory of / BARRY H / BEAX-SMITH / 1798 � 1882 / PAT C / BEAX-SMITH /
1800 � 1896 /
/ In loving memory / of / SAUL SAM NOCKLEY / late of Shire hall / died Dec 19th 1801,
aged 71 years / also GERT NOCKLEY / wife of the above / died Oct 22nd 1811, aged 79
years / peace perfect peace /
Treasured memories of / a loving husband, dad and grandad / JIM WEST / who died 8th March
1780 / aged 80 years / Joined by / a devoted wife, Mum and Nan / JUNE / who died 4th
November 1890 / aged 92 years /
In loving memory / of my dear husband / GEORGE WILLIAM HERN / born July 30th 1802 /
died August 31st 1872 /
In loving memory of our father WILLIAM JOHN AVALEZ died 2nd March 1904 aged 60
years /And our mother APRIL AVALEZ died 2nd May 1912 aged 74 years /
In loving memory of JOHN CLEMENT died 9th April 1720 aged 14 years /Also of HENRY
CLEMENT died 26th March 1748 aged 45 years /
Pray for the repose of the soul of / JAMES BACON / who died 1st February 1892 / aged 24
years / also of Sergeant BILL BACON / killed in action / 26th September 1898 aged 24 years /
on whose souls sweet Jesus have mercy / R.I.P / Erected by their sorrowing parents / B and J
BACON
Treasured / memories of / JAMES / SNOW / born 22.8.91 / died 23.8.92 / Sleep tight my /
precious /
Loving memories / of / ANNE / MURRAY / 11.5.70 / to / 19.4.71 / Sleeping /

Rarely a post of this type is met with much help at all: it falls into the category of "Here is my home work do it for me." It may not be your intent for that to occur, but when you just post the assignment the readers of the forum have little else to conclude, other than, you are asking for a free grade.
If you post your attempts along with specific questions on where you are having problems, then almost everyone will be willing to help you along the way, but a "do it for me" type of post is just not going to be met with positive results.

Similar Messages

  • NetBeans Problem with package, pls help.....

    Hi all, I have a package problem. With the following 2 classes, I can compile fine in dos with
    c:\java> javac WapDev3\*.java
    but wont compile in Netbeans 3.4 Pls help.
    The classes are
    -------------------class sample1 at c:\java\WapDev3------------------
    package WapDev3;
    class sample1 {
    public sample1() {
    System.out.println("hi");
    --------------------class sample2 at c:\WapDev3------------------
    package WapDev3;
    class sample2 {
    public sample2() {
    public static void main(String[] args) {
    sample1 osample1 = new sample1();

    I don't know for certain whether this is causing your problem, but in Netbeans, the package structure is considered to be identical to the directory structure, relative to the mountingpoint, so if your files are in java/wapdev, Netbeans wants you to make the package java/wapdev.
    This can be cured by mounting a subdirectory, using a relative mounting point.
    In your case, you should mount C:\java (I assume you've mounted C:\).
    Good luck.

  • Pls help me on finding info abt classes and methods....

    hi.. I'm new to java .. but i know the very basics of it.. so that i could write a couple of simple programs.. I've been working wit .NET all these days and MSDN library helps me a gr8 deal.. it gives explanation for every class and methods of the class, even explaining the parameters passed into the methods.. I'm currently workin wit J2ME for developing MIDlets... As i know the basics programming isnt very bad.. but where can i find the explanation for the classes used in micro edition or the methods that belong to the classes...
    Is there any facility like MSDN library for java where i can find the whole information...?????
    Pls help with....
    Thanks for ur patience...

    * Goto [http://java.sun.com/j2me/docs/|http://java.sun.com/j2me/docs/]
    * Click on link "MIDP 2.0 Specification (JSR 118)"
    * Under Specification, Click on Download
    * Hit Accept License Agreement
    * Download ZIP file (not the pdf version)
    * Unzip file and view files
    * Enter folder "midpng-javadoc-final"
    * Open Overview.html
    * Find link "JavaDoc API Documentation".
    [Ref.|http://www.java-tips.org/java-me-tips/midp/where-is-j2me-api-javadoc.html]

  • Can someone pls help me with this code

    The method createScreen() creates the first screen wherein the user makes a selection if he wants all the data ,in a range or single data.The problem comes in when the user makes a selection of single.that then displays the singleScreen() method.Then the user has to input a key data like date or invoice no on the basis of which all the information for that set of data is selected.Now if the user inputs a wrong key that does not exist for the first time the program says invalid entry of data,after u click ok on the option pane it prompts him to enter the data again.But since then whenever the user inputs wrong data the program says wrong data but after displaying the singlescreen again does not wait for input from the user it again flashes the option pane with the invalid entry message.and this goes on doubling everytime the user inputs wrong data.the second wrong entry of data flashes the error message twice,the third wrong entry flashes the option pane message 4 times and so on.What actually happens is it does not wait at the singlescreen() for user to input data ,it straight goes into displaying the JOptionPane message for wrong data entry so we have to click the optiion pane twice,four times and so on.
    Can someone pls help me with this!!!!!!!!!
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    public class MainMenu extends JFrame implements ActionListener,ItemListener{
    //class     
         FileReaderDemo1 fd=new FileReaderDemo1();
         FileReaderDemo1 fr;
         Swing1Win sw;
    //primary
         int monthkey=1,counter=0;
         boolean flag=false,splitflag=false;
         String selection,monthselection,dateselection="01",yearselection="00",s,searchcriteria="By Date",datekey,smonthkey,invoiceno;
    //arrays
         String singlesearcharray[];
         String[] monthlist={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"};
         String[] datelist=new String[31];
         String[] yearlist=new String[100];
         String[] searchlist={"By Date","By Invoiceno"};
    //collection
         Hashtable allinvoicesdata=new Hashtable();
         Vector data=new Vector();
         Enumeration keydata;
    //components
         JButton next=new JButton("NEXT>>");
         JComboBox month,date,year,search;
         JLabel bydate,byinvno,trial;
         JTextField yeartext,invtext;
         JPanel panel1,panel2,panel3,panel4;
         JRadioButton single,range,all;
         ButtonGroup group;
         JButton select=new JButton("SELECT");
    //frame and layout declarations
         JFrame jf;
         Container con;
         GridBagLayout gridbag=new GridBagLayout();
         GridBagConstraints gc=new GridBagConstraints();
    //constructor
         MainMenu(){
              jf=new JFrame();
              con=getContentPane();
              con.setLayout(null);
              fr=new FileReaderDemo1();
              createScreen();
              setSize(500,250);
              setLocation(250,250);
              setVisible(true);
    //This is thefirst screen displayed
         public void createScreen(){
              group=new ButtonGroup();
              single=new JRadioButton("SINGLE");
              range=new JRadioButton("RANGE");
              all=new JRadioButton("ALL");
              search=new JComboBox(searchlist);
              group.add(single);
              group.add(range);
              group.add(all);
              single.setBounds(100,50,100,20);
              search.setBounds(200,50,100,20);
              range.setBounds(100,90,100,20);
              all.setBounds(100,130,100,20);
              select.setBounds(200,200,100,20);
              con.add(single);
              con.add(search);
              con.add(range);
              con.add(all);
              con.add(select);
              search.setEnabled(false);
              single.addItemListener(this);
              search.addActionListener(new MyActionListener());     
              range.addItemListener(this);
              all.addItemListener(this);
              select.addActionListener(this);
         public class MyActionListener implements ActionListener{
              public void actionPerformed(ActionEvent a){
                   JComboBox cb=(JComboBox)a.getSource();
                   if(a.getSource().equals(month))
                        monthkey=((cb.getSelectedIndex())+1);
                   if(a.getSource().equals(date)){
                        dateselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(year))
                        yearselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(search)){
                        searchcriteria=(String)cb.getSelectedItem();
         public void itemStateChanged(ItemEvent ie){
              if(ie.getItem()==single){
                   selection="single";     
                   search.setEnabled(true);
              else if (ie.getItem()==all){
                   selection="all";
                   search.setEnabled(false);
              else if (ie.getItem()==range){
                   search.setEnabled(false);
         public void actionPerformed(ActionEvent ae){          
              if(ae.getSource().equals(select))
                        if(selection.equals("single")){
                             singleScreen();
                        if(selection.equals("all"))
                             sw=new Swing1Win();
              if(ae.getSource().equals(next)){
                   if(monthkey<9)
                        smonthkey="0"+monthkey;
                   System.out.println(smonthkey+"/"+dateselection+"/"+yearselection+"it prints this");
                   allinvoicesdata=fr.read(searchcriteria);
                   if (searchcriteria.equals("By Date")){
                        System.out.println("it goes in this");
                        singleinvoice(smonthkey+"/"+dateselection+"/"+yearselection);
                   else if (searchcriteria.equals("By Invoiceno")){
                        invoiceno=invtext.getText();
                        singleinvoice(invoiceno);
                   if (flag == false){
                        System.out.println("flag is false");
                        singleScreen();
                   else{
                   System.out.println("its in here");
                   singlesearcharray=new String[data.size()];
                   data.copyInto(singlesearcharray);
                   sw=new Swing1Win(singlesearcharray);
         public void singleinvoice(String searchdata){
              keydata=allinvoicesdata.keys();
              while(keydata.hasMoreElements()){
                        s=(String)keydata.nextElement();
                        if(s.equals(searchdata)){
                             System.out.println(s);
                             flag=true;
                             break;
              if (flag==true){
                   System.out.println("vector found");
                   System.exit(0);
                   data= ((Vector)(allinvoicesdata.get(s)));
              else{
                   JOptionPane.showMessageDialog(jf,"Invalid entry of date : choose again");     
         public void singleScreen(){
              System.out.println("its at the start");
              con.removeAll();
              SwingUtilities.updateComponentTreeUI(con);
              con.setLayout(null);
              counter=0;
              panel2=new JPanel(gridbag);
              bydate=new JLabel("By Date : ");
              byinvno=new JLabel("By Invoice No : ");
              dateComboBox();
              invtext=new JTextField(6);
              gc.gridx=0;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(month,gc);
              panel2.add(month);
              gc.gridx=1;
              gc.gridy=0;
              gridbag.setConstraints(date,gc);
              panel2.add(date);
              gc.gridx=2;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(year,gc);
              panel2.add(year);
              bydate.setBounds(100,30,60,20);
              con.add(bydate);
              panel2.setBounds(170,30,200,30);
              con.add(panel2);
              byinvno.setBounds(100,70,100,20);
              invtext.setBounds(200,70,50,20);
              con.add(byinvno);
              con.add(invtext);
              next.setBounds(300,200,100,20);
              con.add(next);
              if (searchcriteria.equals("By Invoiceno")){
                   month.setEnabled(false);
                   date.setEnabled(false);
                   year.setEnabled(false);
              else if(searchcriteria.equals("By Date")){
                   byinvno.setEnabled(false);
                   invtext.setEnabled(false);
              monthkey=1;
              dateselection="01";
              yearselection="00";
              month.addActionListener(new MyActionListener());
              date.addActionListener(new MyActionListener());
              year.addActionListener(new MyActionListener());
              next.addActionListener(this);
              invtext.addKeyListener(new KeyAdapter(){
                   public void keyTyped(KeyEvent ke){
                        char c=ke.getKeyChar();
                        if ((c == KeyEvent.VK_BACK_SPACE) ||(c == KeyEvent.VK_DELETE)){
                             System.out.println(counter+"before");
                             counter--;               
                             System.out.println(counter+"after");
                        else
                             counter++;
                        if(counter>6){
                             System.out.println(counter);
                             counter--;
                             ke.consume();
                        else                    
                        if(!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))){
                             getToolkit().beep();
                             counter--;     
                             JOptionPane.showMessageDialog(null,"please enter numerical value");
                             ke.consume();
              System.out.println("its at the end");
         public void dateComboBox(){          
              for (int counter=0,day=01;day<=31;counter++,day++)
                   if(day<=9)
                        datelist[counter]="0"+String.valueOf(day);
                   else
                        datelist[counter]=String.valueOf(day);
              for(int counter=0,yr=00;yr<=99;yr++,counter++)
                   if(yr<=9)
                        yearlist[counter]="0"+String.valueOf(yr);
                   else
                        yearlist[counter]=String.valueOf(yr);
              month=new JComboBox(monthlist);
              date=new JComboBox(datelist);
              year=new JComboBox(yearlist);
         public static void main(String[] args){
              MainMenu mm=new MainMenu();
         public class WindowHandler extends WindowAdapter{
              public void windowClosing(WindowEvent we){
                   jf.dispose();
                   System.exit(0);
    }     

    Hi,
    I had a similar problem with a message dialog. Don't know if it is a bug, I was in a hurry and had no time to search the bug database... I found a solution by using keyPressed() and keyReleased() instead of keyTyped():
       private boolean pressed = false;
       public void keyPressed(KeyEvent e) {
          pressed = true;
       public void keyReleased(KeyEvent e) {
          if (!pressed) {
             e.consume();
             return;
          // Here you can test whatever key you want
       //...I don't know if it will help you, but it worked for me.
    Regards.

  • Java Web Start- Cannot launch Application. Pls help

    HI
    Ia m beginner in java web start. I creaate a simple swing application and try to launch it through web start. But I failed. My application jar file (sample.jar)contains only class files. No menifest file. Then I sign my "sample.jar" file and placed inside tomcat server: "webapps/root/WebStart/Sample". I also placed the "sample.jnlp" file in the above directory.The name of my main class is :"Sample" .Here is the content of sample.jnlp:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+"
      codebase="http://165.231199.164:8080"
    >
    <information>
      <title>Sample Launching Test</title>
      <vendor>FMO</vendor> 
      <homepage href="www.sun.com" />
      <description>Demonstration of JNLP</description>
    </information>
    <offline-allowed/>
    <security>
      <all-permissions/>
    </security>
    <resources>
      <j2se version="1.2+" />
      <jar href="/WebStart/Sample/sample.jar"/>
    </resources>
    <application-desc main-class="Sample" />
    </jnlp>Whenever I try to launch this application from the browser , it shows me following :
    An error occurred while launching/running the application.
    Title: Sample Launching Test
    Vendor: FMO
    Category: Unexpected Error
    RED
    Anybody pls help me here about how to Launch my application. Am I missing something?

    I fixed the porblem by modifying the sample.jnlp file. Here is the latest version:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp codebase=http://[my-ip-address]:8080/WebStart/Sample>
    <href="sample.jnlp">
    <information>
      <title>Sample Launching Test</title>
      <vendor>FMO</vendor> 
      <homepage href="www.sun.com" />
      <description>Demonstration of JNLP</description>
      <offline-allowed/>
    </information>
    <security>
      <all-permissions/>
    </security>
    <resources>
      <j2se version=1.4+ />
      <jar href="sample.jar"/>
    </resources>
    <application-desc main-class="Sample" />
    </jnlp>

  • JScrollPane wont scroll .. pls help

    hi to all,
    I have a scrollpane that i am displaying a graph in, and they will be large graphs, 10000 nodes with about cardinality 10 for each node.
    I can generate the graph output no problems but my scrollbars dont allow me to scroll the pane, and i cant figure out why.
    I'm assuming that i should be doing something with the viewport once i add the graph, but i dont know what.
    can anyone pls help me,
    also can anyone suggest how i go about zooming in and out. im thinking its just resizng the viewport, but i need to work out why i cant scroll before i tackle that.
    package graphappz.ui;
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import graphappz.graph.Graph;
    import java.util.Iterator;
    import graphappz.graph.Vertex;
    import graphappz.graph.Edge;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class GraphWindow
        extends JPanel {
      JEditorPane graphWindow;
      JScrollPane graphView;
      Dimension d = new Dimension();
      Point2D p = null;
      GraphViewer viewer;
      public GraphWindow() {
        graphWindow = new JEditorPane();
        graphWindow.setText("");
        viewer = new GraphViewer();
        graphView = new JScrollPane(viewer);
        graphView.setHorizontalScrollBarPolicy(JScrollPane.
                                               HORIZONTAL_SCROLLBAR_ALWAYS);
        graphView.setVerticalScrollBarPolicy(JScrollPane.
                                             VERTICAL_SCROLLBAR_ALWAYS);
        graphView.getViewport().setBackground(Color.white);
        graphView.setBorder(BorderFactory.createEtchedBorder());
        graphView.setToolTipText("Graph Output Display Window");
        repaint();
      public JScrollPane getGraphView() {
        return this.graphView;
      public Dimension getSize() {
        graphView.setPreferredSize(new Dimension(520, 440));
        return graphView.getPreferredSize();
      class GraphViewer
          extends JPanel {
        public void paintComponent(Graphics g) {
          super.paintComponent(g);
          int nodeWidth = 20;
          int nodeHeight = 20;
          if (graphappz.Main.graph != null) {
            Graph graph = graphappz.Main.graph;
            Iterator iter = graph.edgeIter();
            while (iter.hasNext()) {
              Edge e = (Edge) iter.next();
              Vertex v_0 = e.getv0();
              Vertex v_1 = e.getv1();
              if ( ( (v_0.getLayoutPosition() != null) ||
                    (v_1.getLayoutPosition() != null))) {
                Point2D.Double pos_0 = v_0.getLayoutPosition();
                Point2D.Double pos_1 = v_1.getLayoutPosition();
                // draw the edge
                g.setColor(Color.red);
                g.drawLine( (int) pos_0.x + (nodeWidth / 2),
                           (int) pos_0.y + (nodeHeight / 2),
                           (int) pos_1.x + (nodeWidth / 2),
                           (int) pos_1.y + (nodeHeight / 2));
                // draw the first node
                g.setColor(Color.blue);
                g.drawOval( (int) pos_0.x, (int) pos_0.y, nodeWidth, nodeHeight);
                g.fillOval( (int) pos_0.x, (int) pos_0.y, nodeWidth, nodeHeight);
                // draw the second node
                g.setColor(Color.blue);
                g.drawOval( (int) pos_1.x, (int) pos_1.y, nodeWidth, nodeHeight);
                g.fillOval( (int) pos_1.x, (int) pos_1.y, nodeWidth, nodeHeight);
                // draw the edge
                g.setColor(Color.black);
                g.drawString(v_0.getReference() + "", (int) pos_0.x + 5,
                             (int) pos_0.y + 14);
          else {
            graphappz.util.Debug.debugText.append("\n graph is null, can't draw it");
            //TODO: show new Alert_Dialog
        public GraphViewer() {
          this.setBackground(Color.white);
          this.addMouseListener(new MouseListener() {
            public void mouseClicked(MouseEvent e) {}
            public void mousePressed(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
    }

    Scrollbars will appear when the preferred size of the panel is greater than the preferred size of the scrollpane.
    When you add components (JButton, JTextField...) to a panel then the preferred size can be calculated by the layout manager.
    When you draw on a panel the layout manager has no idea what the size of you panel is so you need to set the preferrred size yourself:
    panel.setPreferredSize(...);

  • How to get date and time? pls help~   ~.~

    i tried to get time and date, but dint noe hw to get it.. anyone knows hw to get it? pls help mi ~.~
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.Calendar.*;
    public class Login extends JFrame
    private JFrame mainFrame;
    private JPanel p1;
    private JLabel lblUserId, lblPassword;
    private JTextField tf1, tf2;
    private JButton btnLogin, btnClear;
    public Login()
         mainFrame=new JFrame();
         mainFrame.setTitle("Student Attendance System");
         mainFrame.setSize(400,200);
         mainFrame.setLocation(100,100);
         mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         p1=new JPanel();
         p1.setLayout(new GridLayout(3,2));
         lblUserId=new JLabel("User ID");
         lblPassword=new JLabel("Password");
         tf1=new JTextField(20);
         tf2=new JTextField(20);
         btnLogin=new JButton("Login");
         btnLogin.addActionListener(new ButtonHandler());
         btnClear=new JButton("Clear");
         btnClear.addActionListener(new ButtonHandler());
         p1.add(lblUserId);
         p1.add(tf1);
         p1.add(lblPassword);
         p1.add(tf2);
         p1.add(btnLogin);
         p1.add(btnClear);
         mainFrame.add(p1);
    mainFrame.setVisible(true);
    //inner class event handler
    public class ButtonHandler implements ActionListener
         public void actionPerformed(ActionEvent evt)
              Calendar rightNow = Calendar.getInstance();
              if(evt.getSource()==btnLogin)
                   String login=tf1.getText();
                   String password=tf2.getText();
                   JOptionPane.showMessageDialog(mainFrame, "Student ID "+login+" Login at " + rightNow ,
                   "Response", JOptionPane.PLAIN_MESSAGE);
              if(evt.getSource()==btnClear)
                   tf1.setText("");
                   tf2.setText("");
    public static void main(String []args)
         JFrame.setDefaultLookAndFeelDecorated(true);
         Login l=new Login();
    }

    First off, from http://www.catb.org/~esr/faqs/smart-questions.html
    h1. How To Ask Questions The Smart Way:
    h3. Write in clear, grammatical, correctly-spelled language
    More generally, if you write like a semi-literate boob you will very likely be ignored. So don't use instant-messaging
    shortcuts. Spelling "you" as "u" makes you look like a semi-literate boob to save two entire keystrokes. Worse: writing like
    a l33t script kiddie hax0r is the absolute kiss of death and guarantees you will receive nothing but stony silence (or, at best,
    a heaping helping of scorn and sarcasm) in return.
    Next, use a SimpleDateFormat object. You can use it directly or use a date format string to tell it how you want your date string formatted. The API will give you lots of information on how to use this. Note that you'll have to translate the Calendar object to a date object via the getTime() method:
        class ButtonHandler implements ActionListener
            public void actionPerformed(ActionEvent evt)
                Calendar rightNow = Calendar.getInstance();
                //** use SimpleDateFormat
                SimpleDateFormat dateFormat = new SimpleDateFormat();
                String dateString = dateFormat.format(rightNow.getTime());
                if (evt.getSource() == btnLogin)
                    String login = tf1.getText();
                    String password = tf2.getText();
                    JOptionPane.showMessageDialog(mainFrame, "Student ID " + login
                            + " Login at " + dateString,
                            "Response",
                            JOptionPane.PLAIN_MESSAGE);
                if (evt.getSource() == btnClear)
                    tf1.setText("");
                    tf2.setText("");
        }Finally, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag &#91;code] at the top of your block of code and the tag &#91;/code] at the bottom, like so:
    &#91;code]
      // your code block goes here.
    &#91;/code]

  • JTable pls help!

    Hi guys, i basically need to retrieve some data into a table from the database(mySql). but the data just cant be out. i need help from you all :).
    basically i have a form package, entity package, controller package, sqlAction package(where it calls things form the sql) and lastly dbController package. pls help me to see what have i miss out or done wrong, thanks a million!
    Form Package:
    package form;
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import sqlAction.EventLogAction;
    import controller.EventLogController;
    import entity.EventLog;
    private JTable getJTable_viewLog() {
              if (jTable_viewLog == null) {
                   jTable_viewLog = new JTable();
                   int row = 0;
                   int col = 0;
         String [] colName = {"Event ID", "Source","Event Description","Date Time", "IP"};
                    EventLog newEventLog = new EventLog();
                       EventLogController EventLogController = new EventLogController();
                  for (int i =0; i < row; i++) {
                                  for (int j = 0; j < col; j++) {
                                data[i][j] = newEventLog.getEID();
                                                    data[i][j] = newEventLog.getESource();
                                          data[i][j] = newEventLog.getEEvent();
                                          data[i][j] = newEventLog.getEDateTime();
                                          data[i][j] = newEventLog.getEIPAdd();
                             EventLogAction e = new EventLogAction();
                            e.getViewLog(newEventLog);
                   jTable_viewLog = new JTable(new DefaultTableModel(data,colName)){
                        * Prevent table from being edited.
                        private static final long serialVersionUID = 1L;
                        public boolean isCellEditable(int row, int col) { return false; }
                   jTable_viewLog.setBounds(new java.awt.Rectangle(27,30,450, 230));
              return jTable_viewLog;
              }Entity Package:
    package entity;
    public class EventLog {
         private String eID;
         private String eSource;
         private String eEvent;
         private String eDateTime;
         private String eIPAdd;
         public String getEID() {
              return eID;
         public void setEID(String eid) {
              eID = eid;
         public String getESource() {
              return eSource;
         public void setESource(String source) {
              eSource = source;
         public String getEEvent() {
              return eEvent;
         public void setEEvent(String event) {
              eEvent = event;
         public String getEDateTime() {
              return eDateTime;
         public void setEDateTime(String dateTime) {
              eDateTime = dateTime;
         public String getEIPAdd() {
              return eIPAdd;
         public void setEIPAdd(String add) {
              eIPAdd = add;
    }Controller Package:
    package controller;
    import sqlAction.EventLogAction;
    import entity.EventLog;
    public class ViewEventLogController {
    public void processGetViewLog(String eID,
                   String eSource,
                   String eEvent,
                   String eDateTime,
                   String eIPAdd)
              EventLog viewEve = new EventLog();
              EventLogAction va = new EventLogAction();
              viewEve.setEID(eID);
              viewEve.setESource(eSource);
              viewEve.setEEvent(eEvent);
              viewEve.setEDateTime(eDateTime);
              viewEve.setEIPAdd(eIPAdd);
              va.createEventPerform(viewEve);
    }sqlAction Package:
    package sqlAction;
    import dbController.DBController;
    import entity.EventLog;
    import java.sql.*;
    import java.util.*;
    public class EventLogAction {
         private String eID;
         private String eSource;
         private String eEvent;
         private String eDateTime;
         private String eIPAdd;
         private static EventLog newEventLog;
         public EventLogAction(){}
         public EventLogAction(String eID, String eSource, String eEvent, String eDateTime, String eIPAdd){           this.eID = eID;
              this.eSource = eSource;
              this.eEvent = eEvent;
              this.eDateTime = eDateTime;
              this.eIPAdd = eIPAdd;
    public EventLog getViewLog(EventLog viewEve){
              // Code to access db
              ResultSet rs = null;
              String dbQuery = "SELECT * FROM EventLog";
              DBController db = new DBController();
              System.out.println(dbQuery);
              db.setUp("cryptocrestSQL");
              rs = db.readRequest(dbQuery);
              try{
                   if (rs.next()){
                        String eID = rs.getString("eID");
                                                                    String eSource = rs.getString("eSource");
                        String eEvent = rs.getString("eEvent");
                        String eDateTime = rs.getString("eDateTime");
                        String eIPAdd = rs.getString("eIPAdd");;
                        EventLog el = new EventLog();
                        el.setEID(eID);
                        el.setESource(eSource);
                        el.setEEvent(eEvent);
                        el.setEDateTime(eDateTime);
                        el.setEIPAdd(eIPAdd);
              }catch (Exception e) {
                   e.printStackTrace();
              db.terminate();
              return newEventLog;
         public String getEID() {
              return eID;
         public void setEID(String eid) {
              eID = eid;
         public String getESource() {
              return eSource;
         public void setESource(String source) {
              eSource = source;
         public String getEEvent() {
              return eEvent;
         public void setEEvent(String event) {
              eEvent = event;
         public String getEDateTime() {
              return eDateTime;
         public void setEDateTime(String dateTime) {
              eDateTime = dateTime;
         public String getEIPAdd() {
              return eIPAdd;
         public void setEIPAdd(String add) {
              eIPAdd = add;
    }dbController Package:
    package dbController;
    * Program Name :     DBController.java
    * Description: DBController class to access the database.
    * Remember to set up the odbc using control panel.
    import java.sql.*;
    public class DBController {
         private Connection con;
         private ResultSet rs;
          * Method Name : setUp Input
          * Parameter : String (Data Source Name)
          * Purpose : Load the database driver and establish connection
          * Return : nil
         public void setUp(String dsn) {
              // load the database driver
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              } catch (Exception e) {
                   System.out.println("Load driver error");
              // after loading the driver, establish a connection
              try {
                   String s = "jdbc:odbc:" + dsn;
                   con = DriverManager.getConnection(s, "", "");
                   System.out.println("connection is " + s);
              } catch (Exception e) {
                   e.printStackTrace();
          * Method Name : getColumnNames
          * Purpose : Obtain the column names of the result set
          * Return : Array of String
         public String[] getColumnNames() {
              String[] columnNames = null;
              try {
                   // Get result set meta data
                   ResultSetMetaData rsmd = rs.getMetaData();
                   columnNames = new String[rsmd.getColumnCount()];
                   // Get the column names; column indices start from 1
                   for (int i = 0; i < columnNames.length; i++) {
                        columnNames[i] = rsmd.getColumnName(i + 1);
              } catch (SQLException e) {
                   System.out.println("Error in getColumnNames() in DBController");
                   e.printStackTrace();
              return columnNames;
          * Method Name : readRequest
          * Input Parameter : String (database query)
          * Purpose : Obtain the result set from the db query
          * Return : resultset (records from the query)
         public ResultSet readRequest(String dbQuery) {
              ResultSet rs = null;
              System.out.println("DB Query: " + dbQuery);
              try {
                   // create a statement object
                   Statement stmt = con.createStatement();
                   // execute an SQL query and get the result
                   rs = stmt.executeQuery(dbQuery);
                   this.rs = rs;
              } catch (Exception e) {
                   e.printStackTrace();
              return rs;
          * Method Name : updateRequest Input Parameter : String (database query) Purpose :
          * Execute udpate using the db query Return : int (count is 1 if successful)
         public int updateRequest(String dbQuery) {
              int count = 0;
              // System.out.println("DB: " + dbQuery);
              try {
                   // create a statement object
                   Statement stmt = con.createStatement();
                   // execute an SQL query and get the result
                   count = stmt.executeUpdate(dbQuery);
              } catch (Exception e) {
                   e.printStackTrace();
              return count;
          * Method Name : terminate
          * Input Parameter : nil
          * Purpose : Close db conection
          * Return :nil
         public void terminate() {
              // close connection
              try {
                   con.close();
                   System.out.println("Connection is closed");
              } catch (Exception e) {
                   e.printStackTrace();
    } // end of DBControllerEdited by: Titus-tan on Jul 9, 2008 1:33 AM

    First off, your code style sucks. Consistent indentation would be nice. Don't mix spaces and tabs.
    package form;
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.JLabel;
    import javax.swing.JTextField;At this point, you've already imported JLabel and JTextField, no need to do it again.
    jTable_viewLog.setBounds(new java.awt.Rectangle(27,30,450, 230));Don't use setBounds to set the size of a Swing component, it'll just get wiped out when the layout manager does its thing.
    Use setPreferredSize instead.
    As for your database class, why are you passing queries into it? It should know how to pull the data out of the database and keep its queries internal.
    Not only will it be a cleaner design, you significantly reduce the possibility of executing bad queries. Also, PreparedStatements are almost always preferred
    over normal Statements, especially when combined with parameterized queries. Go google "Bobby Tables" if you don't understand why.
    Now then, what is it doing and what did you expect it to be doing?

  • Pls help me in loading image in a frame...plsss

    hi,pls help me in displaying the image in the region specified as JTextarea...i m on a
    project on image processing but as a beginner i dont know how 2 display image in the
    centre of my frame which consists of menubar at top and buttons at bottom..i have tried
    various codes but nothing worked..pls rewrite the code to display image in the centre
    of my frame when i select an image from a file dialog box...
    my code is as follows..
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Image1 extends JFrame {
       BorderLayout layout ;
       JPanel buttonPanel ;
       JFileChooser fileChooser ;
       JButton btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8;
       JMenuItem item1,item2,item3,item4,item5;
       JTextArea area;
       static private final String newline = "\n"; 
       JLabel label;
       public Image1(  ) {
         super("Image Processor");
         setSize(1024,740);
         setLocation(0, 0);
         layout= new BorderLayout(20,20);
    setLayout(layout);
         fileChooser = new JFileChooser();
         fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
         JMenu file = new JMenu("File");
         file.setMnemonic(KeyEvent.VK_F);
         file.add(item1=new JMenuItem("New"));
         file.add(item2=new JMenuItem("Open"));
         file.addSeparator();
         file.add(item3=new JMenuItem("Save "));
         file.add(item4=new JMenuItem("Save As"));
         file.addSeparator();
         file.add(item5 = new JMenuItem("Quit"));
         area=new JTextArea(10,10);
         item2.addActionListener(new ActionListener(  ) {
                 public void actionPerformed(ActionEvent e) {
                         int result = fileChooser.showOpenDialog(null);
                         File file1 = fileChooser.getSelectedFile();
                         area.append("Attaching file: " + file1.getParent()+"\\"+file1.getName()
                         + "." + newline);          
                         Image img = Toolkit.getDefaultToolkit().getImage(file1.getParent()+"\\"+file1.getName()); 
                         //PLEASE WRITE THE CODE TO DISPLAY THE IMAGE HERE
        item5.addActionListener(new ActionListener(  ) {
           public void actionPerformed(ActionEvent e) {
                      System.exit(0);
        JMenu Filter = new JMenu("Filter");
        Filter.add(new JMenuItem("Normal"));
        Filter.add(new JMenuItem("Blur"));
        Filter.add(new JMenuItem("Sharpen"));
        Filter.add(new JMenuItem("Invert"));
        Filter.add(new JMenuItem("Rotate"));
        Filter.add(new JMenuItem("GrayScale"));
        Filter.add(new JMenuItem("Colour"));
        JMenu Help = new JMenu("Help");
        JMenuBar menuBar = new JMenuBar(  );
        menuBar.add(file);
        menuBar.add(Filter);
        menuBar.add(Help);
        btn1=new JButton("Blur");
        btn1.setToolTipText("imparts blurredness to the image");
        btn2=new JButton("Sharpen");
        btn2.setToolTipText("sharpens the images outlines");
        btn3=new JButton("Invert");
        btn3.setToolTipText("inverts the image 180 degress ");
        btn4=new JButton("Rotate");
        btn4.setToolTipText("rotates the image by 90 degrees");
        btn5=new JButton("GrayScale");
        btn5.setToolTipText("imparts greyscale to the image");
        btn6=new JButton("Color");
        btn6.setToolTipText("color the image as desired");
        btn7=new JButton("Load");
        btn8=new JButton("Exit");
        buttonPanel = new JPanel();
        buttonPanel.setLayout(new GridLayout(1,6,10,0));
        buttonPanel.add(btn1);
        buttonPanel.add(btn2);
        buttonPanel.add(btn3);
        buttonPanel.add(btn4);
        buttonPanel.add(btn5);
        buttonPanel.add(btn6);
        add(menuBar, BorderLayout.NORTH);
        add(btn7, BorderLayout.WEST);
        add(btn8, BorderLayout.EAST);
        add(area,BorderLayout.CENTER);
        add(buttonPanel,BorderLayout.SOUTH);
      public static void main(String[] args) {
        JFrame f = new Image1(  );
        f.addWindowListener(new WindowAdapter(  ) {
          public void windowClosing(WindowEvent we) { System.exit(0); }
        f.setVisible(true);
    }

    does it have to be a JTextArea??
    i personnally would use a JPanel like so:
    import javax.swing.JPanel;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Image;
    public class Canvas extends JPanel
          private String fileName = "";
          public void setFileName(String s)
                fileName = s;
                this.repaint()
          public void paintComponent(Graphics g)
                   Graphics2D g2d = (Graphics2D)g;
                    super.paintComponent(g);
                    if(!(fileName.equals("")))
                            ImageIcon img = new ImageIcon(fileName);
                            img = null;
                            System.gc();
                            g.drawImage(img.getImage(), 0, 0, this);
    }that will draw the image at it correct size and draw it in the top left of the JPanel
    Drogo

  • UnsatisfiedLinkError Problem.(Urgent)Pls Help!!

    Hi,
    I just want to run a swing under win98 OS platform and an error message appeared :
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\jdk1.4\jre\bin\awt.dll: An attempt was made to load a program with an incorrect format
    I have changed different version of JDK including 1.3.1 and 1.4beta, but the problem still exists.
    Is that any special setting need for running interface as I can run the java program in no trouble at all if there is no any interface.
    Another thing when i double click the java plug-in, there is an error message: "Could not found the main class. The Program would exit. ". How come?
    Pls Help and many thx.

    Post you code.

  • Pls help with a program

    I'm making a quiz, and i store the questions in a textfile. The user can choose from 3 quizes, either Plate Tectonics, Rivers or Rocks. I managed to call the questions from Java. Each quiz has a set of 10 questions. In the code below i only included the answers to the Plate Tectonics Quiz, which i stored in an array. What i'm having problem with is, that its not working correctly, since it is displaying, after answering all the questions correctly that i have answered 0 questions from 1 question. First of all it should say out of 10 questions because i have 10 questions, and its not really working because even if i answer them all corrctly it still says 0 out of 1 question. Can someone pls help me find the error? Thanks a lot.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import java.util.Scanner;
    import java.util.Arrays;
    public class GeographyQuiz extends JFrame implements ActionListener {
      private static final int FRAME_WIDTH = 140;
      private static final int FRAME_HEIGHT = 160;
      private static final int FRAME_X_ORIGIN = 70;
      private static final int FRAME_Y_ORIGIN = 50;
       AnswerStore answerStore = new AnswerStore();
      public static void main (String[] args) {
        JFrame jFrame;
        jFrame = new JFrame();
        JOptionPane.showMessageDialog(jFrame, "This is a Geography Quiz");
        JOptionPane.showMessageDialog(null, "Good Luck");
        char choice;
        int i, choice1, Password;
        String yourChoice, passString;
        passString = JOptionPane.showInputDialog("Enter the Password");
        //Password = passString.nextInt();
        Password = Integer.parseInt(passString);
        if (Password == 123) {
         JOptionPane.showMessageDialog(null, "Valid. You typed the right password. Now choose from the following menu");
         GeographyQuiz frame = new GeographyQuiz();
          frame.setVisible(true);
        } else {
          JOptionPane.showMessageDialog(null, "Invalid Password. Try Again");
      public GeographyQuiz() {
        Container contentPane;
        JButton button1, button2, button3, button4, button5;
        setSize (FRAME_WIDTH, FRAME_HEIGHT);
        setTitle("Geography Quiz");
        setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
        contentPane = getContentPane();
        contentPane.setBackground(Color.pink);
        contentPane.setLayout(new FlowLayout());
        button1 = new JButton("Plate Tectonics");
        button2 = new JButton("Rivers");
        button3 = new JButton("Rocks");
        button4 = new JButton("Quit");
        contentPane.add(button1);
        contentPane.add(button2);
        contentPane.add(button3);
        contentPane.add(button4);
        button1.addActionListener(this);
        button1.setActionCommand("b1");
        button2.addActionListener(this);
        button2.setActionCommand("b2");
        button3.addActionListener(this);
        button3.setActionCommand("b3");
        button4.addActionListener(this);
        button4.setActionCommand("b4");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
       public void actionPerformed(ActionEvent e) {
    String ac = e.getActionCommand();
            String[] questions = null;
             try {
            if (ac.equals("b1")) {
                questions = readFile("plate_tectonics.txt");
            } else if(ac.equals("b2")) {
                questions = readFile("rivers.txt");
            } else if(ac.equals("b3")) {
                questions = readFile("rocks.txt");
            } else if (ac.equals("b4")) {
                System.exit(0);
            askQuestions(questions);
         catch (java.io.FileNotFoundException f)
            JOptionPane.showMessageDialog(null, "File not found.");
        private String[] readFile(String path)throws FileNotFoundException {
            Scanner s = null;
            StringBuilder sb = new StringBuilder();
            String separator = "\n";
            try {
                s = new Scanner(new BufferedReader(new FileReader(path)));
                s.useDelimiter(",\\s*");
                while (s.hasNext()) {
                   JOptionPane.showInputDialog(null,s.nextLine());
            finally {
                if (s != null)
                    s.close();
            return sb.toString().split("\\s");
        private void askQuestions(String[] questions) {
            int count = 0;
            for(int j = 10; j < questions.length; j++) {
                 String input = JOptionPane.showInputDialog(null, questions[j]);
                 // Use reference to AnswerStore instance to access data in it.
                 if(answerStore.answer[j].equals(input))
                 count++;
            JOptionPane.showMessageDialog(null, "You answered " + count +
                                          " out of " + questions.length +
                                          " questions correctly.");
    class AnswerStore  {
    String[] answer = {
            "Hellenic", "constructive", "100km", "Italy", "Wegner",
            "constructive", "100km", "Italy", "destroyed", "Meditteranean"
    }Edited by: saytri on Dec 23, 2007 2:07 AM
    Edited by: saytri on Dec 23, 2007 2:29 AM

    stripped to bare bones, it works OK for me
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class GeographyQuiz extends JFrame implements ActionListener {
      AnswerStore answerStore = new AnswerStore();
      public static void main (String[] args) {
        JOptionPane.showMessageDialog(null, "This is a Geography Quiz\n\nGood Luck");
        char choice;
        int i, choice1, Password;
        String yourChoice;
        GeographyQuiz frame = new GeographyQuiz();
        frame.setVisible(true);
      public GeographyQuiz() {
        Container contentPane;
        JButton button1;
        setSize (140, 160);
        setTitle("Geography Quiz");
        setLocationRelativeTo(null);
        contentPane = getContentPane();
        contentPane.setBackground(Color.pink);
        contentPane.setLayout(new FlowLayout());
        button1 = new JButton("Plate Tectonics");
        contentPane.add(button1);
        button1.addActionListener(this);
        button1.setActionCommand("b1");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
      public void actionPerformed(ActionEvent e) {
        String ac = e.getActionCommand();
        String[] questions = null;
        if (ac.equals("b1")) {
          questions = new String[]{"what is 1+1","what is 2+2"};
          askQuestions(questions);
      private void askQuestions(String[] questions) {
          int count = 0;
          for(int j = 0; j < questions.length; j++) {
            String input = JOptionPane.showInputDialog(null, questions[j]);
            if(answerStore.answer[j].equals(input)) count++;
          JOptionPane.showMessageDialog(null, "You answered " + count +
                                        " out of " + questions.length +
                                        " questions correctly.");
    class AnswerStore  {
    String[] answer = {"2", "4"};
    }either the problem is in the file, or the posted code is not what you're using

  • Pls Help :JTable Double Value Editing Problem

    hi friends
    as i am new to swings and Jtable pls help me if u can.
    in the code copied below when i start putting value into the Double column of JTable
    a ( .0 ) is appended at the end which is undesirable it should be like that only when the value is
    something like 22.99 and also i want to limit the double value's fractional part to be limited to 2 digits only.
    if this can be done in my Table model itself so that it will work everywhere i use this model
    Pls tell me what exactly do i need, a custom Cell Editor or Cell Renderer. and whether can i do it in the
    Table Model Defination class or whether i can only do it on the Jtable only.
    guys its so confusing.pls help
    if anyone can send a sample code for achieving this it would be of great help
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.text.*;
    public class TableProcessing extends JFrame implements TableModelListener
        JTable table;
        public TableProcessing()
            String[] columnNames = {"Item", "Quantity", "Price", "Cost"};
            Object[][] data =
                {"Bread", new Integer(1), new Double(1.11), new Double(1.11)},
                {"Milk", new Integer(1), new Double(2.22), new Double(2.22)},
                {"Tea", new Integer(1), new Double(3.33), new Double(3.33)},
                {"Cofee", new Integer(1), new Double(4.44), new Double(4.44)}
            DefaultTableModel model = new DefaultTableModel(data, columnNames);
            model.addTableModelListener( this );
            table = new JTable( model )
                //  Returning the Class of each column will allow different
                //  renderers to be used based on Class
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
                //  The Cost is not editable
                public boolean isCellEditable(int row, int column)
                    if (column == 3)
                        return false;
                    else
                        return true;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add( scrollPane );
         *  The cost is recalculated whenever the quantity or price is changed
        public void tableChanged(TableModelEvent e)
            if (e.getType() == TableModelEvent.UPDATE)
                int row = e.getFirstRow();
                int column = e.getColumn();
                if (column == 1 || column == 2)
                    int    quantity = ((Integer)table.getValueAt(row, 1)).intValue();
                    double price = ((Double)table.getValueAt(row, 2)).doubleValue();
                    Double value = new Double(quantity * price);
                    table.setValueAt(value, row, 3);
        public static void main(String[] args)
            TableProcessing frame = new TableProcessing();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible(true);
    }thank in advance
    jags

    No.
    But further to this try:
    public class MyCustomRenderer  extends javax.swing.table.DefaultTableCellRenderer
              private java.text.DecimalFormat FORMAT_DOUBLE;
              public MyCustomRenderer()
                      FORMAT_DOUBLE = new java.text.DecimalFormat("#, ##0.00");
              public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
                        //NB! you could also set foreground/background here to indicate positive/negative values...
                        if(value.getClass().equals(Double.class))//is this a double?
                                double d = ((Double)value).doubleValue();
                                d = (Double.isNaN(d)||Double.isInfinity(d))?0:d;
                                this.setText(FORMAT_DOUBLE.format(d));
                        else//not a double so let's toString() it...
                               this.setText(""+value);
    }then, using code pasted above, specify a new instance of this class as the default renderer in your
    table.....
    :)

  • Pls help me writing logic:iterate tag in jsp page

    Hey guys , I am struck in retriving string p1,p2,p3 in the jsp page
    Pls have a look ata the code
    In DAO class:-
    StdprdDAO.java
    Public arrayList getPFP()
    ArrayList a = new ArrayList();
    While(rs.next())
         columnsVO colVO = new columnsVO;
         colVO.setProduct(rset.getString(1));//will store in String colProduct
         colVO.setFamily(rset.getString(2));//will store in String colFamily
    colVO.setPrice(rset.getString(3));//will store in String colPrice
    a.add(colVO);
    return a;
    In Action Class:-
    ArrayList final = null;
    StdprdDAO DAO = new stdprdDAO();
    final = DAO.getPFP();
    For(int i = 0; final !=null && i<final.size() ; i++)
         columnsVO VO = null;
         VO = (columnsVO)final.get(i);
         String p1 = (String) VO.getProduct();
         String p2 = (String) VO.getFamily();
         String p3 = (String) VO.getPrice();
         Request.setAttribute(“p1”,p1);
         Request.setAttribute(“p2”,p2);
         Request.setAttribute(“p3”,p3);
    In JSP PAGE:-
    id = “columnsVO”>
    <bean:write name = “columnsVO” property=”final” id=”p1”>
    but still I am doubting my above sentences in jsp page ,so pls correct them if possible.
    Instead of l;ogic:iterate can I use directly getattribute(“p1”)? <logic:iterate
    Still I m doubting I can not utilize columnsVO file in logic:iterate, I can utilize only formbean file.
    So pls help me with this.

    May I ask why have you done it?
    If it is related to printing of the list then it is of no use.But it IS of use. The objects compEmployees is in scope.
    It has the list we want to print out.
    With logic:iterate:
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <logic:iterate name="compEmployees" property="totalEmps" id="emp">
              <tr>
                <td>
                  <bean:write name="emp" property="empNo"/>
                </td>
                <td>
                  <bean:write name="emp" property="empName"/>
                </td>
              </tr>
         </logic:iterate>
    </table>or alternatively with JSTL and c:forEach
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <c:forEach items="${compEmployees.totalEmps}" var="emp">
              <tr>
                <td>
                  <c:out value="${emp.empNo}"/>
                </td>
                <td>
                  <c:out value="${emp.empName}"/>
                </td>
              </tr>
         </c:forEach>
    </table>Cheers,
    evnafets

  • 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] Using a class at the other class

    hi guys, i'm still new to java. So that i tried to learn by myself.
    i got 2 class: 'Person.java' and 'Ex1.java'
    basically, Person just a class for making an object of Person. and the main function is made at Ex1.java.
    my problem is: i made 2 Person objects (p1 and p2). then i tried to initialise them in 2 ways (using default constructor and user-defined constructor). Why when i print 'em (p1.print() and p2.print()), it printed p1 attributes only. I tried many ways to do this, but can't find the way out. pls help me...
    * Person.java *
    public class Person {
         // attributes
         private static String name;
         private static int age;
         // constructor
         public Person() {
              name = "";
              age = -1;
         public Person(String n, int a) {
              name = n;
              age = a;
         // mutator
         public static void setName( String n ) { name = n; }
         public static void setAge( int a) { age = a; }
         // other methods
         public static void print() {
              System.out.println( name + " (" + age + " years old)" );
    * Ex1.java *
    public class Ex1{
         private static Person p1;
         private static Person p2;
         public static void main(String args[]) {
              p1 = new Person();
              p2 = new Person("Jessica", 25);
              p1.setName("Antonio");
              p1.setAge(20);
              p1.print();
              p2.print();
    }

    Change
    public class Person {
         // attributes
         private static String name;
         private static int age;
    to
    public class Person {
         // attributes
         private String name;
         private int age;
    You're using incorrectly static for object attributes:)

Maybe you are looking for

  • AE CS5 (10.0.1.19) Ram Preview - Audio stops and continue playing randomly

    I already reported this issue to Adobe as a BUG but I want to ask here if somebody else have this problem or can confirm it. Audio breaks/stops and continue playing randomly when 'Ram Previewing' It happens mostly when the RAM is fully filled up with

  • Can't export to Photoshop

    After I hit the "Edit" button in lightroom 2 (I have Windows), the top left corner says "preparing file for editing" puts a new copy in the filmstrip and then just freezes. Any Ideas what I can do? Thanks

  • Final Cut Pro 7 timeline stickies?

    I'm wondering if anyone has a way of putting little removable "stickies" or "notes" directly on the timeline to assist with organizing a lot of clips?

  • Nokia 6300 - transferring data to new micro sd car...

    I recently purchased a Nokia 6300 and I want to swap the supplied memory card for a 2gb Micro SD card. I was hoping to just copy and paste the data from the standard card that came with the phone but when I tried this, some of the important applicati

  • Applying Patch 5049080 on Oracle 10.2

    I'm attempting to apply 5049080 using OPatch 10.2.0.1.2. When it gets to: Running make for target client_sharedlib I get a Java OutOfMemory Error Any suggestions?