JTabbed Pane help needed. Urgent Request.

Hello Folks
I have a question regarding tabbedPanes
In the Java Sun Site,there is an example of using JTabbedPane using an
example called DiveLog.
There is a line showing
tabbedPane.addTab("Welcome",
null,
new Welcome(),
"Welcome to the Dive Log");
This gives an error unless I say:
tabbedPane.addTab("Welcome",
null,
(Component) new Welcome(),
"Welcome to the Dive Log");
I am type casting Welcome() to a Component and this works fine!!!!
How can Java Sun give such an example??
Am I right in typecasting the class to Component as addTab expects
a component!!!
Please correct me if we can use new Welcome() as given in the example.

I don't know this example ... but if Welcome extends any Component there should be no need for a cast. Is the problem during runtime or during compile time? Maybe the cast satisfies the compiler, but not the JRE because Welcome does not extend any Component?
Rommie.

Similar Messages

  • HT201210 i have an error of no 11. kindly help, needed urgently

    i have an error of no 11. kindly help, needed urgently
    when i try to upgrage my
    iphone 3gs wit 4.1 to new latest 5.1
    it gives the erorr of 11. what that mean? Reply as soon as you can !
    thnx

    Error -1 may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.

  • Some J2ME midlets doubts!! help needed urgently!!!

    Hi,
    I am currently working in a company where it does wireless technology like WAP and I am assigned a task of creating a screensaver midlet. I have some doubts on the midlets.
    1) How do i use a midlet suites? From what I heard from my colleagues & friends, a servlet is needed for midlets to interact with one another. is it true?
    2) How do I get the startin midlet to take note the phone is idling so that the screen saver midlet can be called?
    Help needed urgently... if there is any source codes for me to refer to would be better... Thanks...
    Leonard

    indicates that MIDlet suites are isolated (on purpose) from each other, so you can't write over another one's address space.
    Also, I believe (at least on cell phones) that you have to specifically enter the Java Apps mode; unless you do the app won't execute. If you are in Java apps mode and a call comes in, the cell's OS puts the Java app currently executing on "Pause" mode and switches back to phone mode.
    Not sure if you will be able to have a Java app do that automatically.
    BTW why do you need a screensaver on an LCD display? Is it really intended to show an advertisement?
    Download and real all the docs you can from Sun, once you get over the generic Java deficiencies MIDlet's aren't that hard.

  • Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss....

    Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss..

    The startup disk may need repairing.
    Startup your Mac while holding down the Command + R keys so you can access the built in utiliites to repair the startup disk if necessary or restore OS X using OS X Recovery

  • Help needed urgently on a problem..plzzz

    hi..this is a linear congruential generator. I have to implement it and i need the execution time for the program.
    for your understanding i'm providing an example below.
    Xn=(( a* xn-1 )+b) mod m
    If X0=7 ; a = 7 ; b =7 ; m=10
    Then
    X0 = 7
    X1 =((7 * 7) + 7))mod 10 = 6
    X2 = ((6*7)+7))mod 10 = 9
    X3 = ((9*7)+7) mod 10 = 0
    X4 = ((0*7)+7) mod 10 = 7
    Now since the cycle is being repeated i.e 7 appears again�so the period is 4 coz there are 4 diff nos. i.e 7,6,9,0�..
    help required urgently....your help will be appreciated...thankyou..

    Hi,
    I wrote the code so that it catches any cycle (not only the "big" one).
    Otherwise it will enter infinite loop...
    The time complexity is O(N*logN): it can do at most N iterations (here N is your 'm'), and in each iteration there can be O(log N) comparisons (since I maintain TreeSet).
    Interesting issue: is it possible to supply such (x0, a, b, m) tuple such that all possible values from 0 to m-1 will be output? I think no :)
    Here is the program:
    package recurr;
    import java.util.TreeSet;
    import java.util.Comparator;
    public class Recurrences {
         private static long x0, a, b, m;
         private static TreeSet theSet;
         public static void main(String[] args)
              long l0, l1, l2, l3;
              try {
                   x0 = Long.parseLong(args[0]);
                   a = Long.parseLong(args[1]);
                   b = Long.parseLong(args[2]);
                   m = Long.parseLong(args[3]);
              } catch(NumberFormatException nfe) {
                   nfe.printStackTrace();
              System.out.println("X[0]: " + x0 + "\n");
              long curr = x0;
              boolean cut = false;
              int i;
              // initialize the set
              theSet = new TreeSet(new LongComparator());
              // we can get at most m distinct values (from 0 to m-1) through recurrences
              for(i=1; i <= m; ++i) {
                   // iterate until we find duplicate
                   theSet.add(new Long(curr));
                   curr = recurrence(curr);
                   if(theSet.contains(new Long(curr))) {
                        cut = true;
                        break;
                   System.out.println("X[" + i + "]: " + curr + "\n");
              if(cut) {
                   System.out.println("Cycle found: the next will come " + curr + "\n");
              } else {
                   System.out.println("No cycle found!");
              System.out.println("----------------------------------");
              System.out.println("Totally " + (i-1) + " iterations");
         private static long recurrence(long previous)
              return (a*previous + b)%m;
         static class LongComparator implements Comparator
              public int compare(Object o1, Object o2)
                   if(((Long)o1).longValue() < ((Long)o2).longValue()) {
                        return -1;
                   } else if(((Long)o1).longValue() > ((Long)o2).longValue()) {
                        return 1;
                   } else return 0;
    }

  • Help needed Urgently- Rebate based on collected amount

    Dear all,
    I come across scenario while discussiion with client that they require rebate with collection. Details of the requirement are given below:
    1. SAP rebates run on billed values & set the accrual in rebate agreement on the rate what we have specified in the rebate agreement. Requirement is that, If i have billed on 1000$ & my accrual value is 100$ with the rate of 10%. If i collected 800$ instead of 1000$, then i need to pay the accrual on the basis of 800$ not on the basis of 1000$. It means i have to adjust accrual amount on the basis of 800$. Conclusion is that i have to pay not 100$ accrual instead less then 100$ on the basis of 800$ which i collected.
    2. In month 1 have billed on 5000$, my accrual amount is 500$ with rate of 10%. In the 2nd month i have to bill 1000$ and i have given an discount of 500$, it means my billed value is 500$ and my accrual amount is 50$@10%. In month 3 again i billed 500$ and my accrual amount is 50$@10%.
    Requirement is that, when i am going to pay the accrual to client, i should pay correct accrual for which he is entitled for. Means i should pay 100$ accrual not 600$ because i have already given an discount of 500$. Discount which i have given already of 500$ should need to be offest with the first month accrual of 500$. So remaning accrual is 100$.
    Great if somebody can help me out for the solutioning of the above requirements.

    Thanks Ivano,
    Somebody has started the conversation.
    Let me put my questions again.
    This requirement is nothing to do with Payment procedure in the agreement type.
    1. In any month if i billed 1000$, so my account receivable would be 1000$. My rebate for that month is 100$ at the rate of 10%. During customer receipt if i collected against my invoice 900$ instead of 1000$, my accrual needs to be corrected 90$ instead of 100$.
    I know this can not be fullfilled by standard SAP, by any thoughts on this welcomed.
    2. I know Rebate can be settled partially or full settlement by payment method( by cheque, bank transfer, or by credit memo) we have configure in rebate agreement type. But here requirement is totally different.
    Here, i need to pay the Rebate as a Discount instead of by cheque or by credit memo. While doing the partial or full settlement system will take into account collected accrual up to that day & apply as a discount to the final bill.
    Scenario is like that sometimes customer asked to give us the discount on bill for whatever they accrued so far.
    This is again cannot solved by standard SAP, but any thought by any body welcome. We have already thought that we need to enhance the solution.
    Solution needed urgently.

  • Unable to allocate 27160 bytes.........Help needed urgently

    hi
    in my production database in getting this error..
    ORA-04031: unable to allocate 27160 bytes of shared memory ("shared
    pool","unknown object","sga heap(1,0)","session param values")
    help needed urgently

    If you have a program that does not use bind variables you can get this error.
    In such cases you do not want to increase the size of the shared pool, but reduce it, and flush regularly. This is a bug in the application and should be fixed to use bind variables.
    Another possible workaround is setting cursor_sharing = force, but this can cause other problems, so should only be used as a last resort. If the apps connections can be distinguished by user account or machine, then a log on trigger could be set cursor_sharing just for that application, to limit the damage until the vendor can fix it.

  • JOption Pane help needed! urgent

    For a programming assignment in my AP Comp Sci class, we had to create a method (example: public int BlahBlah (int blah)). The instructions also say to use JOptionPane for inputing the int needed. However, because I created the method, it automatically brings up the method input box, AS WELL as the JOptionPane box I wrote in the code. So, essentially, I am getting two input boxes when all I want is the JOptionPane one.
    Also, it is the JOptionPane number that I input that is used for the output.
    How am I supposed to write a method but disable the method input box, and instead keep the JOptionPane box?
    Any help is greatly appreciated

    In the future, Swing related questions should be posted in the Swing forum.
    1) Read the JOptionPane API description for an example;
    2) Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html]How to Use Option Panes.

  • XML Gurus -My first request -Help needed urgently

    Hi XML gurus,
    I have a requirement to convert the following XML into two oracle tables.This is the first time I am looking at an XML script this closely....Could any of the gurus study the pattern of the xml and convert this into oracle tables with the constraints and post the script.After some thorough look I am able to conclude that the data has to be pushed into two tables.Appreciate your help!!
    XML file is as below
    - <Batch BatchCreated="633479274856698434" TransType="EISendCATProfile">
    - <SiebelMessage>
    - <CATProfiles>
    - <CATProfile Id="1-6XCMTV3">
    <CATCode>SE0</CATCode>
    <LegacyHandled>N</LegacyHandled>
    <DOLStart>05/31/2008</DOLStart>
    <DOLEnd>06/02/2008</DOLEnd>
    <Status>New</Status>
    <TransStatus>Pending</TransStatus>
    <Description>CAT SE0 MN Auto Wind and Hail Prop Wind, Hail and Other Weather 5/31 - 6/2</Description>
    <GMTCreated>06/01/2008 14:23:26</GMTCreated>
    <GMTUpdated>06/01/2008 14:31:21</GMTUpdated>
    - <Details>
    - <Detail Id="1-6XCMTV5">
    <State>MN</State>
    <PolicyType>Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:23:47</GMTCreated>
    <GMTUpdated>06/01/2008 14:24:11</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTV9">
    <State>MN</State>
    <PolicyType>Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Wind</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:24:11</GMTCreated>
    <GMTUpdated>06/01/2008 14:24:28</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVC">
    <State>MN</State>
    <PolicyType>Commercial Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:24:29</GMTCreated>
    <GMTUpdated>06/01/2008 14:24:45</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVF">
    <State>MN</State>
    <PolicyType>Commercial Auto</PolicyType>
    <ClaimType>Comprehensive</ClaimType>
    <CauseOfLoss>Wind</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:24:47</GMTCreated>
    <GMTUpdated>06/01/2008 14:25:10</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVI">
    <State>MN</State>
    <PolicyType>Commercial Property</PolicyType>
    <ClaimType>Commercial Property</ClaimType>
    <CauseOfLoss>Windstorm & Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:25:13</GMTCreated>
    <GMTUpdated>06/01/2008 14:25:55</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVL">
    <State>MN</State>
    <PolicyType>Homeowners</PolicyType>
    <ClaimType>Property</ClaimType>
    <CauseOfLoss>Hail</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:25:57</GMTCreated>
    <GMTUpdated>06/01/2008 14:26:14</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVO">
    <State>MN</State>
    <PolicyType>Homeowners</PolicyType>
    <ClaimType>Property</ClaimType>
    <CauseOfLoss>Wind</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:26:16</GMTCreated>
    <GMTUpdated>06/01/2008 14:27:06</GMTUpdated>
    </Detail>
    - <Detail Id="1-6XCMTVU">
    <State>MN</State>
    <PolicyType>Homeowners</PolicyType>
    <ClaimType>Property</ClaimType>
    <CauseOfLoss>Other Weather Related</CauseOfLoss>
    <Status>New</Status>
    <GMTCreated>06/01/2008 14:29:35</GMTCreated>
    <GMTUpdated>06/01/2008 14:29:52</GMTUpdated>
    </Detail>
    </Details>
    </CATProfile>
    </CATProfiles>
    </SiebelMessage>
    </Batch>
    Thanks Much!
    Sridhar

    I tried what you told AnanSmriti.
    But still Server cannot find the page .
    I have saved JSP pages in DefaultWebApp and Java class files in WEB-INF /classes under DefaultWebApp dir.
    Also I have given the same URl in web.xml as in my first page.
    Please tell me where am I going wrong.
    Thanx in advance for any help.

  • Help needed urgently :cannot dispatch request to JSP

    HI everyone,
    I'm having problem while calling JSP page from a servlet .
    I'm giving code below :
    import Pack.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class CheckLogin extends HttpServlet
         public void init(ServletConfig con) throws ServletException
              super.init(con);
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
         Statement stmt;
         PreparedStatement pst;
         ResultSet rs;
         String str,insertstring,dept="",fullName="",user="";
         int flag=0;
         String txtname,txtpass,cate="";
         java.util.Date thisdate=new java.util.Date();
         HttpSession session=req.getSession(true);     
         res.setContentType("text/html");
         PrintWriter out=res.getWriter();
         txtname=req.getParameter("login");
         txtpass=req.getParameter("pass");
    Connection myCon=null;
    PreparedStatement pstmt;
              try
                        myCon=Pack.JdbcCode.Connect_mrs();
              catch(Exception ae)
                   System.out.println("Error in opening Connection   "+ae);
         try
                        stmt=myCon.createStatement();
                        rs=stmt.executeQuery("select * from Login");
                             while(rs.next())
                                       if(txtname.equals(rs.getString(1)) && txtpass.equals(rs.getString(2)))
                                            if(rs.getString(8).equals("N"))
                                                 flag=1;
                                                 dept=rs.getString(6);
                                                 fullName=rs.getString(4);
                                                 cate=rs.getString(7);
                                            else
                                                 out.println("<body BACKGROUND=\"/images/recbg.jpg\"><font face=arial color=blue> User :<font color=red size=3>"+txtname+"</font> is already Logged in to FIR System 2004</font><font size=3 color=\"red\"><p><p>Please try later...</font></body>");
                                                 flag=2;
                             out.print("<p><p>");
                             if(flag==1)
                                       if(!txtname.equals("admin"))
                                                 pst=myCon.prepareStatement("update Login set Status=? where LoginName=?");
                                                 pst.setString(2,txtname);
    //change done
                                                 pst.setString(1,"N");
    //changed to Y
                                                 int a=pst.executeUpdate();
                                       //writing to the log
                                             try
                                                 int tmp = 0;
                                                 java.io.FileWriter fileWriter = new FileWriter("C:/bea/My projects/domainone/applictaions/DefaultWebApp/log.txt",true);
                                                 fileWriter.write("\nUser:   "+txtname+"  Logged In Time  "+thisdate);
                                                 fileWriter.close();
                                               catch (IOException e)
                                                  System.out.println( "IO error:" + e );
                                                 user=txtname;
                                                 session.setAttribute("userName",user);
                                                 session.setAttribute("dept",dept);
                                                 session.setAttribute("fullName",fullName);
                                                 session.setAttribute("cat",cate);
                                                 ServletContext sc = this.getServletContext();
                                                 RequestDispatcher rd = sc.getRequestDispatcher("/DefaultWebApp/Welcome.jsp");
                                                 if (rd !=null)
                                                      try
                                                           rd.forward(req, res);
                                                       catch (Exception e)
                                                           sc.log("---------------Problem invoking JSP.------------------", e);
                             if(flag==0)
                                       out.println("<body BACKGROUND=\"/images/recbg.jpg\"><font face=arial color=red>Wrong user name or Password <P></font><font face=arial color=red size=4>     Access Denied</font>");
                                       out.println("<p><p><font face=arial color=blue><p> <a href=\"/DefaultWebApp/login.jsp\">Login Again</a></font></body>");
                   catch(Exception e)
                        System.out.println("---------------------------Exception-------------------------------");
                        e.printStackTrace();
    }I'm not getting any errors.
    My server is weblogic, hence my JSP code is present in DefaultWebApp and java code in DDefaultWebApp/WEB-INF.
    Please tell me something .
    Thanx in advance.

    I tried what you told AnanSmriti.
    But still Server cannot find the page .
    I have saved JSP pages in DefaultWebApp and Java class files in WEB-INF /classes under DefaultWebApp dir.
    Also I have given the same URl in web.xml as in my first page.
    Please tell me where am I going wrong.
    Thanx in advance for any help.

  • Java Progrramming HELP, Needed Urgently, T hanks

    hey guys,
    I have this lab I need to be done tomorrow, its been weeks lol of thinking and figuring things out can someone make it work ? Pleaseeeee !
    I feel like going out and yelling for help lol I have been trying to figure this out for weeks now.
    I am pasting my Lab and My Codes I did so far, And Please I really need this done today at any rate, all help would be kindly appreciated.
    A Java program is required that will produce a number of reports based on the data from the Product file. This file contains the product name, cost, quantity and UPC. The file name must be input. Valid data from the file will be loaded into an array.
    A menu will provide the following options: (Note there are changes from previous assignment.)
    1     Display of all valid product information including extended price and GST including totals sorted by name.
    2     Display of all invalid records sorted by name.
    3     Search and display a certain product by name.
    4     Sort by UPC and use a binary search and display a certain product by UPC. (valid records)
    9 Exit.
    Processing requirements:
    Input the data from a file and load the records into an object array. Use this object array to produce the above reports.
    Code a class definition exactly as given in the following UML.
    (For specific students: you may code the UPC as an integer but if not numeric throw an exception that is handled in main. Document your choice in your submission).
    Product
    ? Name : String
    ? UPC : String
    ? Cost : Real
    ? Quantity : Integer
    + Product (Name : String, UPC : String, Cost : Real, Quantity : Integer)
    + Calculate Extended Cost() : Real
    + Calculate GST(): Real
    Input Record:
    Product name: String
    UPC: String
    Cost: real
    Quantity: integer
    Output Reports
    1. Display of all product information including extended cost and GST including totals of these 3 fields.
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 10,723,160.83
    Tissues 98989898989x 1.99 2 3.98      0.20     4.18
    TOTALS                         10,212,538.10 510,626.91 10,723,165.01
    2. Display of all invalid records and the count.
    Following is a sample of the output required:
    Invalid UPC Records = 1
    Count Record
    1          Tiara Diamond, 12345678901x, 36020.00, 2
    3. Search and display a certain product by name. Display appropriate message if not found.
    Following is a sample of the output required:
    Enter product name: CrownJewels
    CrownJewels 99999999991x     100,000.00 1 100,000.00 5,000.00 $105,000.00
    6. Display the product information sorted by name
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    CrownJewels 99999999991x 100,000.00 1 100,000.00 5,000.00 $105,000.00
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 $10,723,160.83
    Pearls      88888888881x 10,000.00 1 10,000.00 500.00 $10,500.00
    RubyRing      77777777771x 10,000.00 1 10,000.00 500.00 $10,500.00
    Tissues      98989898989x 1.99 2 3.98 0.20     $4.18
    TOTALS          (complete these values)           xxx           xxx      xxx
    Java coding requirements for this assignment
    Main methods required
    1.     Load array with all records. Display exception messages only for records that have invalid data in any of the fields. Return array of valid records and logical size.
    2.     Validate the UPC. Display each report when requested from the menu.
    3.     Justify the data in the columns. Right justify numeric fields; left justify the alpha fields.
    4.     A method for each report required in the menu.
    Class methods
    5.     Use the object method for the extended cost.
    6.     Use the object method for the GST.
    You may use additional methods in the main program but do not add any methods in the class definition.
    Use DecimalFormat for rounding.
    Create an array to hold the objects. Assume that we only need to process a file of a maximum of 500 records but the file may be larger than 500 records.
    A Universal Product Code consists of 12 digits. The first digit (from the left) is the UPC type. The next five digits are the Manufacturer code. The next five digits are the product code which is assigned by the manufacturer. The final digit is the check digit. A person can determine the check digit of a Universal Product Code by doing the following:
    Step 1: Sum all of the digits in the odd positions together.
    0+4+0+1+5+9 = 19
    Step 2: Multiply the sum from Step 1 by 3.
    3 * 19 = 57
    Step 3: Sum all of the digits in the even positions together.
    6+2+0+1+8 = 17
    Step 4: Sum together the results from Step 2 and Step 3.
    17 + 57 = 74
    Step 5: Subtract the sum from the next highest multiple of 10.
    80 - 74 = 6 [check digit]
    TEST DATA:
    Step 1: Create 5 or MORE additional records that will test all conditions. Include these in your documentation. Identify what field is tested in your test data. (Example: error in each field of the record, rounding up, rounding down, valid UPC, invalid UPC, formatting of report, file too large
    Step 2: Use the file attached.
    GODDDDDDDDDDDDDD lol pasting it made me go crazy,
    these are my codes so far, HOwever the problem is ONLY DISPLAY MENU SHOWS, nothing else even though i have enough codes that it can show something,
    My codes are as follows:
    I am working on Eclipse.
    import java.util.Arrays;
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.io.IOException;
    * Name : Sana Ghani
    * Date : July 10
    public class lab56
         public static Scanner file;
         public static Scanner parse;
         public static Scanner input = new Scanner(System.in);
         public static Scanner searchInput = new Scanner(System.in);
         public static void main(String[] args) throws Exception
              Product1[] validProduct = new Product1[500];
              int logicalSize = 0;
              int menuChoice=0;
              String FileName = getFileName();
              displayMenu();
              switch(menuChoice)
              case 1:
                   displayAllValidRecords(validProduct, logicalSize);
                   try
                   // Open an output stream
                   OutputStream fout = new FileOutputStream ("myfile.txt");
                   // Print a line of text
                   new PrintStream(fout).println ("hello world!");
                   // Close our output stream
                   fout.close();          
                   // Catches any error conditions
                   catch (IOException e)
                        System.err.println ("Unable to write to file");
                        System.exit(-1);
                   break;
              case 2:
                   break;
              case 3:
                   binarySearchByName( validProduct,logicalSize);
                   break;
              case 4:
                   break;
              case 5:
                   break;
              menuChoice = displayMenu();
         public static void display(Product1[]validProduct, int logicalSize)throws Exception
              String Product, UPC;
              double Cost;
              int Quantity;
              for(int index =0; index<logicalSize; index++)
                   Product = validProduct[index].GetName();
                   UPC = validProduct[index].GetUPC();
                   Cost=validProduct[index].GetCost();
                   Quantity=validProduct[index].GetQuantity();
                   System.out.println(Product+"\t\t"+UPC+"\t\t"+Cost+"\t\t"+Quantity);
         public static String getFileName()
              String fileName;
              Scanner input = new Scanner(System.in);
              System.out.print("Please enter a file name: ");
              fileName = input.next();
              return fileName;
         public static int displayMenu()
              int menuChoice;
              boolean validFlag = false;
              do
                   System.out.println("\n\n*************************************");
                   System.out.println(" Product Display Menu ");
                   System.out.println("*************************************");
                   System.out.println("(1)Display All Records");
                   System.out.println("(2)Display All Invalid Records");
                   System.out.println("(3)Search by Product Name");
                   System.out.println("(4)Sort by Product Name");
                   System.out.println("(5)Exit");
                   System.out.println("*************************************");
                   System.out.print("Enter your choice(1-5): ");
                   menuChoice = input.nextInt();
                   if ((menuChoice >= 1) && (menuChoice <= 5))
                        validFlag = true;
                   if (!validFlag)
                        System.out.println("You have chosen " + menuChoice + ", " + menuChoice +
                        " is not valid. Please try again");
              }while(!validFlag);
              return menuChoice;
         public static String loadArray(Product1 [] ValidProduct, String fileName)throws Exception
              int logicalSize=0;//will always have to declare
              String record;//will always have to declare
              String Product, UPC;//variable names from
              double Quantity;
              double Cost;
              Scanner file = new Scanner(new File(fileName));//open
              record = file.nextLine();//read a line
              record = file.nextLine();//read a line
              for(int index = 0; index < ValidProduct.length && file.hasNext(); index++)//check to see if the file has data
                   record = file.nextLine();
                   parse = new Scanner(record).useDelimiter(",");
                   String Name = parse.next();
                   UPC = parse.next();
                   Cost = parse.nextDouble();
                   Quantity=parse.nextDouble();
                   ValidProduct[index] = new Product1 ( Name, UPC, Cost, (int) Quantity);
    //               create the object-- call the constructor and pass info
                   logicalSize++;
              return logicalSize+".txt";
         public static double roundDouble(double value, int position)
              java.math.BigDecimal bd = new java.math.BigDecimal(value);
              bd = bd.setScale(position,java.math.BigDecimal.ROUND_UP);
              return bd.doubleValue();
         * This method will print report about valid records
         public static void displayAllRecords( Product1[]valid, int ValidProduct,
                   Product1[] invalid, int InvalidProduct)
    //          Print valid records
              displayAllValidRecords(valid, ValidProduct);
    //          Print invalid UPC records
              displayAllValidRecords(invalid, InvalidProduct);
         public static void displayOneRecord(Product1[]valid, int index)
              double extendedCost, GST, SumofGST = 0, // Total Extended Cost
              totalCost, SumOfTotalCost = 0; // Total Extended Cost + GST
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Quantity", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
              extendedCost = valid[index].CalculateExtendedCost();
              extendedCost = roundDouble(extendedCost, 2);
              GST = valid[index].CalculateGST();
              GST = roundDouble(GST, 2);
              totalCost = extendedCost + GST;
              totalCost = roundDouble(totalCost, 2);
    //          justify method ensures all values are of the same size
              System.out.println(//leftJustify(i+"",3) + ": " +
                        leftJustify(valid[index].GetName(), 50) +
                        leftJustify(valid[index].GetUPC(), 15) +
                        rightJustify(valid[index].GetCost()+"", 10) +
                        rightJustify(valid[index].GetQuantity()+"", 5) +
                        rightJustify(extendedCost+"", 10) +
                        rightJustify(GST+"", 10) +
                        rightJustify(totalCost+"", 10));
         * This method will print report about valid records
         public static void displayAllValidRecords( Product1[]valid, int validCounter)
              double extendedCost, sumOfExtendedCost = 0, // Total Extended Cost
              GST, sumOfGST = 0, // Total GST
              totalCost, sumOfTotalCost = 0; // Total Extended Cost + GST
              System.out.println("************************ XYZ Product " +
                        "Cost REPORT ****************************" +
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Qty", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
    //          Print Records
              for(int i=0; i<validCounter; i++)
                   extendedCost = valid.CalculateExtendedCost();
                   extendedCost = roundDouble(extendedCost, 2);
                   GST = valid[i].CalculateGST();
                   GST = roundDouble(GST, 2);
                   totalCost = extendedCost + GST;
                   totalCost = roundDouble(totalCost, 2);
    //               justify method ensures all values are of the same size
                   System.out.println(//leftJustify(i+"",3) + ": " +
                             leftJustify(valid[i].GetName(), 50) +
                             leftJustify(valid[i].GetUPC(), 15) +
                             rightJustify(valid[i].getClass()+"", 10) +
                             rightJustify(valid[i].GetQuantity()+"", 5) +
                             rightJustify(extendedCost+"", 10) +
                             rightJustify(GST+"", 10) +
                             rightJustify(totalCost+"", 10));
                   sumOfExtendedCost += extendedCost;
                   sumOfGST += GST;
                   sumOfTotalCost += totalCost;
         private static void sortByName(Product1 [] ValidProduct, int logicalSize) throws Exception
              Product1 temp;
              for (int outer = logicalSize-1; outer > 1; outer --)
                   for (int inner = 0; inner < outer; inner ++)
                        if (ValidProduct[inner].GetName().compareToIgnoreCase(ValidProduct[inner+1].GetName())>0)
                             temp = ValidProduct[inner];
                             ValidProduct[inner] = ValidProduct[inner + 1];
                             ValidProduct [+ 1] = temp;
         public static void binarySearchByName(Product1 [] ValidProduct, int logicalSize)
              int high = logicalSize - 1;
              int low = 0;
              int mid = 0;
              int count = 0;
              int compare = 0;
              boolean found = false;
              System.out.print("Enter a product name");
              String product = input.nextLine();
              while (high >= low && !found)
                   count += 1;
                   mid = (high + low) / 2;
                   compare = ValidProduct[mid].GetName().compareToIgnoreCase(product);
                   if (compare == 0)
                        System.out.println("Found: " + ValidProduct[mid].GetName());
                        found = true;
                   else if (compare < 0)
                        low = mid + 1;
                   else
                        high = mid - 1;
              if (!found)
                   System.out.println(product + " not found.");
              System.out.println(count + " steps");
              System.out.println();
         public static String leftJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static String rightJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static void displayValidRecords(Product1 [] ValidProduct, int logicalSize) throws Exception {
              long longMAX_POSSIBLE_UPC_CODE = 999999999999L;
              // set input stream and get number
              Scanner stdin = new Scanner(System.in);
              System.out.print("Enter a 12-digit UPC number: ");
              long input =stdin.nextLong();
              long number = input;
              // determine whether number is a possible UPC code
              if ((input < 0)|| (input > longMAX_POSSIBLE_UPC_CODE)) {
                   // not a UPC code
                   System.out.println(input +"is an invalid UPC code");
              else {   
                   // might be a UPC code
                   // determine digits
                   int d12 = (int) (number % 10);
                   number /= 10;
                   int d11 = (int) (number % 10);
                   number /= 10;
                   int d10 = (int) (number % 10);
                   number /= 10;
                   int d9 = (int) (number % 10);
                   number /= 10;
                   int d8 = (int) (number % 10);
                   number /= 10;
                   int d7 = (int) (number % 10);
                   number /= 10;
                   int d6 = (int) (number % 10);
                   number /= 10;
                   int d5 = (int) (number % 10);
                   number /= 10;
                   int d4 = (int) (number % 10);
                   number /= 10;
                   int d3 = (int) (number % 10);
                   number /= 10;
                   int d2 = (int) (number % 10);
                   number /= 10;
                   int d1 = (int) (number % 10);
                   number /= 10;
                   // compute sums of first 5 even digits and the odd digits
                   int m = d2 + d4 d6 d8 + d10;
                   int n = d1 + d3 d5 d7 + d9 + d11;
                   // use UPC formula to determine required value for d12
                   int r = 10 - ((m +3*n) % 10);
                   // based on r, can test whether number is a UPC code
                   if (r == d12) {
                        // is a UPCcode
                        System.out.println(input+" is a valid UPC code");
                   else {   
                        // not a UPCcode
                        System.out.println(input+" is not valid UPC code");
    Any help would be great thanks !!
    Take care,

    1) It's your problem that you waited until the last minute before you went for help...not ours. We'll give your problem the same attention as anyone elses...therefore your problem isn't any more urgent than any other problem here.
    2) I don't intend on doing your entire assignment. Nor do I intend on reading all of it. If you need help with a specific requirement, then post the information/code relevant to that requirement. I don't know how to help you when you bury the problem inside a 9 mile long essay.
    3) Post code in tags so it's formatted and readable. (there's a *code* button up above that makes the tags for you).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help Needed to Request a Feature

    Hello folks!
    There is a feature I have been awaiting paitently for years,
    ever since Conditional Build Tags came on the scene in RoboHelp.
    Adobe has gotten closer than any of its predecessors at providing
    this functionality, but just this week, I finally heard verbal
    confirmation from Adobe that it doesn't yet do what I need it to
    do.
    I am appealing to you for help. It seems that the only thing
    that will motivate Adobe to provide this (or any) functionality is
    a preponderance of user requests on their Feature Request form. I
    have already filled this out more than once over the years, to no
    avail.
    I have detailed below, in 1989 characters, just what I want
    and why I want it. If you are moved to also request this
    functionality, please go to
    www.adobe.com/go/wish
    select Feature Request, and if you want, simply copy and
    paste my text below into the form. There is a 2000-character limit,
    so I have tweaked the wording to make it all fit.
    I have been drooling over this functionality for literally
    YEARS, because I must maintain 5 separate projects in order to
    provide my programmers with all of the different outputs (in
    essence, different languages) that we need.
    Thanks a bundle!
    Marjorie
    *******Enhancement / FMR*********
    Brief title for your desired feature:
    Apply Conditional Build Tags (CBTs) to Topic Titles Appearing
    in Search Results
    How would you like the feature to work?
    Concise problem statement:
    On all outputs, the Search Results list is being populated
    without my CBTs being applied.
    Steps to reproduce bug:
    1. Create English & French CBTs.
    2. Apply English & French CBTs to topic content,
    including to the Topic Title, when displayed in the Design Editor
    pane. (This must be done in the Design Editor pane, because CBTs
    are not accepted by RH7 in the Topic Properties in the Topic Title
    field.)
    3. Create 2 new duplicate layouts, which use the English
    & French CBTs.
    4. Generate outputs for both English & French (WebHelp,
    FlashHelp, HTMLHelp--it does not matter which one).
    5. View the French output & go to the Search tab.
    Results:
    6. Search for a French topic title. The Help file does indeed
    find the appropriate topic. However, the Search Results list
    displays the ENGLISH topic title. If I display the associated topic
    in the right-hand pane, I do see the French topic title there, as
    well as the French content.
    Desired results:
    7. The Search Results list should display the FRENCH topic
    title in the left-hand pane.
    Why is this feature important to you?
    No matter which language, our application is going to call
    the same specific URL to fulfill a Help request. I use the Map ID
    number in the Topic ID field. When I generate WebHelp output, each
    topic will have a "Name.htm" which appears as "MapIDNumber.htm".
    For instance, "388.htm" is the filename on WebHelp output for the
    topic whose Topic Title is "View" in English & "Afficher" in
    French.
    This feature is important because RH7 will not allow the same
    Map ID number or the same Topic ID to be used on more than one
    source topic. I need to be able to apply the same Topic ID to
    whatever language condition I want, and therefore, my one source
    topic must contain all languages with their CBTs applied.

    Hello, and thank you all so much for your interest in my
    quest!
    Since I have much to address, I will quote each person and
    then reply to their comments. (Ooops! I have so much to say, I must
    address each of your posts separately.)
    quote:
    Originally posted by:
    Peter Grainge
    Marjorie
    I can see the problem this gives you but I am not sure it is
    a bug.
    Peter,
    It's a bug in the sense that the output is not fully in
    French, in every way possible.
    quote:
    Originally posted by:
    Peter Grainge
    There is a difference between the Topic Title, as in the
    Topic Properties and the Topic Heading, as at the top of your
    topic.
    Yes, you are right. In the Design Editor, I am editing the
    topic title where the Heading style is applied. I suppose the
    correct term for this item is indeed "Topic Heading."
    quote:
    Originally posted by:
    Peter Grainge
    It sounds like your layout is to have English content and
    French content in the same topic and exclude whatever you need to
    for a particular output.
    In actuality, I use the Advanced button on the Layout to
    Define my CBT Expression. I choose to INCLUDE my desired CBT by
    Adding the Tag for a particular output.
    For English, I would choose to INCLUDE my English CBT; for
    French, I would choose to INCLUDE my French CBT.
    In my world, there are multiple English names for the very
    same widget. Therefore, I use multiple English conditions to
    deterime which name should appear for a particular widget. I mark
    the rest of the text with ALL of my English conditions, and mark
    the French text with my French conditions. (I MUST mark the English
    as English, simply because my source topic also contains French
    text. This is the only way to leave the English out of the French
    outputs.)
    Now, imagine that I want to output just one of my English
    conditions. If I were to use Exclude for all of the other English
    conditions, then the very text that is marked for all of my English
    condtions would never make it into my output.
    I have tested this, and found that if I simply include only
    the desired CBT, it works beautifully. I don't get the French, and
    I do get all of the appropriate text for my indicated English
    condition.
    quote:
    Originally posted by:
    Peter Grainge
    I don't do any foreign language work but my understanding is
    that those who do maintain two topics and use the tags on the whole
    topic.
    That's what Adobe tried to tell me to do. I explained to them
    the issue with the same URL being used in all of my conditional
    outputs.
    For instance, I want Help to come up and display the exact
    topic whose name in English is "View." This topic has been assigned
    a Map ID of 388. I have also edited the Topic ID to use the number
    388. When I generate WebHelp output, you see this topic generated
    as "388.htm."
    Now, in my French output, this topic would have a different
    title appearing--in French, it would be called "Afficher." My
    programmers have our application programmed to call "388.htm,"
    regardless of what language is running.
    RH source topics cannot use the same topic ID on more than
    one topic. Because of this RH limitation, I must put the source
    text for both languages inside only one source topic: the topic
    whose Topic ID is 388.
    quote:
    Originally posted by:
    Peter Grainge
    If a topic is in, then you will get whatever is in the Topic
    Title.
    I told the Adobe employee who called me that they need to
    code RH so it looks for the Topic Heading material for the text
    they use to populate their Search Results list. He sounded
    intrigued by my idea, and said he would tell their engineers about
    it.
    The only other alternative I can imagine at this point is to
    allow CBTs to be applied to the Topic Title text. I have even
    attempted to manually apply this in the HTML Editor pane. The
    trouble is, when I switch away to the Design Editor pane and then
    back to the HTML Editor pane, all of the CBTs that I manually
    applied have been lost--and it doesn't matter if I Saved first!
    They are simply discarded by RH.
    quote:
    Originally posted by:
    Peter Grainge
    I suspect that would be because of the way the Microsoft
    compiler works and Adobe cannot control that, nor do I expect
    Microsoft to make any changes to accomodate this need.
    This is exactly the sort of programming issue they earn the
    big bucks to solve--establishing workarounds for the technologies
    at work.
    I have to believe it's solvable, because, as I have told the
    Adobe folks, their competitor MadCap had the exact same issue with
    one of their early versions, and they even told me: "The Search
    Results list is being populated before the conditions are being
    applied." I called them on it, they worked to solve it, and they
    ultimately did solve it in Flare by reworking one of their *.DLL
    files.
    Maybe I'm comparing apples to oranges, but I still have faith
    that this can be solved. My only problem is how long it is taking
    to get this issue onto their radar. I have been requesting this
    functionality for over 1.5 years!
    quote:
    Originally posted by:
    Peter Grainge
    Maybe some folks who work in multiple languages could chip in
    and advise how they work.
    I am guessing that where Map IDs are used for the call, they
    maintain two projects so that the "same" topic can have the same
    ID.
    I already do this in RH X5. I maintain five separate
    projects, which contain about a dozen different conditions.
    However, I have never yet used CBT functionality on the text
    in my 5 projects, because my source remains in Word to this day,
    and only RH HTML even comes close to giving me the conditional
    output I require. In today's Help files, our users must read and
    find the text that applies to their condition, because they are
    often presented with text like so:
    Condition A
    * If you are Condition A, then the software does this...
    Condition B
    * If you are Condition B, then the software does this...
    Condition C
    * If you are Condition C, then the software does this...
    Condition D
    * If you are Condition D, then the software does this...
    Condition E
    * If you are Condition E, then the software does this...
    I was actually asked to split out our conditions in this
    manner by managers at my company.
    Now, if I were a user, I would HATE having to read
    documentation like this.
    We actually split out our conditions in this way in 2002!,
    anticipating that eHelp or (later) Macromedia or (now) Adobe would
    provide the CBT functionality so I could hide all of the other
    conditions, and give my users a Help file customized specifically
    for their business line. It's now 6 years and counting...
    Since I will have some major prep work to do in order to
    import my text with minimum pain into RH 7 HTML, I just won't do it
    until or unless I can prove that I will be able to output all of my
    conditions flawlessly. It doesn't pay my company to do the import
    and cleanup if we can't produce the product we are required to give
    our users.
    Marjorie (reply 1 of 4)

  • Help needed urgently to get the values from the jsp page.

    hi,
    I am badly stuck into this problem.Please help me and find a solution.
    I am using ms-access and jsp.
    my database structure is as given below:
    m_emp_no | from_date | to_date | approver| status |
    1002 | 22/9/2008 | 23/9/2008|1003 |pending
    1004 | 29/9/2008 | 30/9/2008|1003 |pending
    2044 | 15/9/2008 | 16/9/2008|3076 |pending
    now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
    for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %>  <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
        </tr>
      </table>
      <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" height="165" valign="top">
            <p align="left"><b>User ID</b>        :
    <input type="text" name="id" value="<%=r.getString(1)%>"  size="4   
         <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select  size="1" name="approved">
            <option value="Approved">Approved</option>
            <option value="Cancelled">Cancelled</option>        </select></p>
    <%
    con.close();
    %>
      <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
              <tr>
                <td width="100%" bgcolor="#999966">
                  <p align="center"><input type="reset" value="Clear" name="B1"> 
                  <input type="submit" value="Submit" name="B2"></td>
              </tr>
            </table>
            </td>
        </tr>
      </table>
    </form>
    </body>
    </html>{code}
    this will display both the rows but when i try to retrieve the values into update.jsp using the code given below it gives me only one value which is the first 1002.
    {code}approved=(String)request.getParameter("approved");
    id=(String)request.getParameter("id");{code}
    but i need both the values to be inserted into the update.jsp only then the approver will be able to approve the leaves individually with respect to the m_emp_no.
    please help me out.
    thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    My comments below are all between (((((( and ))))))
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
    </tr>
    </table>
    <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" height="165" valign="top">
    <p align="left"><b>User ID</b> :
    <input type="text" name="id" value="<%=r.getString(1)%>" size="4   
    ((((((( in the statement above, name="id" should be changed to something like name="id"<%=ii%>
    Where ii is a counter that tells you how many times you have gone through the loop so far.
    The reason for this is that each textfield you generate must have a unique name rather than all have the same name
    such as 'id'. This change will give them names such as id0, id1, id2. Then when you submit the page, you can uniquely
    identify each input textfield.))))))
    <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select size="1" name="approved">
    (((( the above select also has to have a unique name for each time through the loop. Change it to name="approved"<%=ii%>
    <option value="Approved">Approved</option>
    <option value="Cancelled">Cancelled</option> </select></p>
    <%
    con.close();
    %>
    <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966">
    <p align="center"><input type="reset" value="Clear" name="B1">
    <input type="submit" value="Submit" name="B2"></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    (((((((note you would be better off long term to put your business logic in a servlet and dispatch to the JSP page which will only have the responsiblity to display the data.
    Also, connection pooling is better than the above.

  • Html to wml conversion help needed urgently

    Hello everybody,
    I need static HTML to WML code urgently as soon as possible.
    Can please somebody help.
    Moreover, how to discard the tags in HTML which are not in WML.The problem is that few tags are not mandatory to close.So, what should be the rule of discarding tags?
    Please help!!!!
    iwapsms

    http://www.google.co.uk/search?q=html+2+wml&start=0&ie=utf-8&oe=utf-8

  • A puzzling situation...help needed urgently!

    This is somewhat related to the topic I posted here (the app is the same) : http://forum.java.sun.com/thread.jspa?threadID=5253292
    So I managed to set things straight and pass the value of the floor selected from the drop down list to a page called FloorPlanRender.jsp (the parameter name is "floorselected", and I store this parameter into an integer variable of the same name as shown in the code for the whole page below). A controller class receives the request, initializes the DB connection and redirects to the appropriate JSP page (not shown in the codes below, but it works fine) -
    [BTW, I have posted the entire code for the page and classes involved...that was just to make the code more informative. The problem seems to be in a very small part of the code alone].
    <%@page language="java" contentType="text/html"%>
    <%@page import="java.util.Iterator"%>
    <%@page import="java.util.ArrayList"%>
    <%@page import="seatplanner.beans.FloorPlanRenderElement"%>
    <% String base = (String)application.getAttribute("base"); %>
    <% String imageURL = (String)application.getAttribute("imageURL"); %>
    <jsp:useBean id="dataManager" scope="application"
      class="seatplanner.model.DataManager"/>
    <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>Tech Mahindra SeatMaster&reg; | Floor Plan</title>
      <link rel="stylesheet" href="/TechMSeatPlan/css/pagestyle.css" type="text/css"/>
    </head>
    <body>
    <div id="all">
    <!-- Display logo -->
    <div id="toppanel"> <jsp:include page="TopPanel.jsp"/> </div>
    <br/> <br/>
    <!-- Display main content -->
    <div id="contentpanel">
    <!-- Store the floor selected and get the row and column count for the floor -->
    <% String floorselect = request.getParameter("floorselected");
       int floorselected = Integer.parseInt(floorselect);
       int rowcount = dataManager.getRowCount(floorselected);
       int columncount = dataManager.getColumnCount(floorselected);
       ArrayList<FloorPlanRenderElement> floorplanelements = dataManager.getFloorPlanElements(floorselected);
       Iterator<FloorPlanRenderElement> iterator = floorplanelements.iterator(); %>
    <!-- Create Table to display the grid -->
    <% if(!(floorplanelements.isEmpty())) // Checks whether the retrieved ArrayList is empty or not
    FloorPlanRenderElement anelement = new FloorPlanRenderElement();%>
    <table id="floorplan">
    <% while(iterator.hasNext())
         for(int i=1; i==rowcount; i++)
              { %>
                   <tr>
                   <% for(int j=1; j==columncount; j++)
                        anelement = iterator.next(); // Store the elements one by one
                   %>
                   <td width=30px height=30px> <img src="<%=imageURL + anelement.floorelement.getElementType() + "-" + anelement.floorelement.getOccupied()%>"/> </td>
                    <% } //close for...j loop %>
                    </tr>
          <% } //close for...i loop %>
    <% } //close while... loop %>
    </table>
    <% } //close if, start else
    else { %>
    No floor plan exists. Please choose another floor.
    <% } //close else %>
    </div>
    </div>
    </body>
    </html>
                        Now, using this value for floor selected, I have to get the rows and columns configured for this floor from a database. This involves performing a select max statement so that I can get the maximum row and column number respectively. So I call upon the relevant methods in the DataManager class by creating an object, which in turn gets forwarded to a class known as FloorPlanRenderPeer.java [The code for both are shown below]:
    DataManager.java
    package seatplanner.model;
    import java.util.Hashtable;
    import java.util.ArrayList;
    import java.util.Enumeration;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import seatplanner.beans.FloorPlanRenderElement;
    public class DataManager {
      private String dbURL = "";
      private String dbUserName = "";
      private String dbPassword = "";
      /*Basic and connectivity operations */
      public void setDbURL(String dbURL) {
        this.dbURL = dbURL;
      public String getDbURL() {
        return dbURL;
      public void setDbUserName(String dbUserName) {
        this.dbUserName = dbUserName;
      public String getDbUserName() {
        return dbUserName;
      public void setDbPassword(String dbPassword) {
        this.dbPassword = dbPassword;
      public String getDbPassword() {
        return dbPassword;
      public Connection getConnection() {
        Connection conn = null;
        try {
          conn = DriverManager.getConnection(getDbURL(), getDbUserName(),
              getDbPassword());
        catch (SQLException e) {
          System.out.println("Could not connect to DB: " + e.getMessage());
        return conn;
      public void putConnection(Connection conn) {
        if (conn != null) {
          try { conn.close(); }
          catch (SQLException e) { }
         /* Floor related operations */
         public ArrayList<Integer> getAllFloorNumbers() {
              return FloorPeer.getAllFloorNumbers(this);
         /* Floor Plan Rendering related operations */
         public int getRowCount(int floorselected) {
              return (FloorPlanRenderPeer.getRowCount(this, floorselected));
         public int getColumnCount(int floorselected) {
              return (FloorPlanRenderPeer.getColumnCount(this, floorselected));
         public ArrayList<FloorPlanRenderElement> getFloorPlanElements(int floorselected) {
              return FloorPlanRenderPeer.getFloorPlanElements(this, floorselected);
    FloorPlanRenderPeer.java
    package seatplanner.model;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import seatplanner.beans.FloorPlanRenderElement;
    /* This class handles all floor plan rendering operations */
    public class FloorPlanRenderPeer
    /* This method returns the number of rows configured for the floor */
    public static int getRowCount(DataManager dataManager, int floorselected) {
         int rowcount=0;
        Connection connection = dataManager.getConnection();
        if (connection != null) {
          try { 
              Statement s = connection.createStatement();
              try
            String sql = "select max(grid_x_pos) from seatplanner.floorgridpart where floor_id =" + floorselected;
            ResultSet rs = s.executeQuery(sql);
              try {
                  rowcount = rs.getInt(1);
              finally { rs.close(); }
            finally {s.close(); }
          catch (SQLException e) {
            System.out.println("Could not get row count: " + e.getMessage());
          finally {
            dataManager.putConnection(connection);
        return (rowcount);
    /* This method returns the number of columns configured for the floor */
    public static int getColumnCount(DataManager dataManager, int floorselected) {
         int columncount=0;
        Connection connection = dataManager.getConnection();
        if (connection != null) {
          try {
            Statement s = connection.createStatement();
               try {
            String sql = "select max(grid_y_pos) from seatplanner.floorgridpart where floor_id =" + floorselected;
              ResultSet rs = s.executeQuery(sql);
              try {
                  columncount = rs.getInt(1);
                        } finally { rs.close(); }
               } finally {s.close(); }
          catch (SQLException e) {
            System.out.println("Could not get column count: " + e.getMessage());
          finally {
            dataManager.putConnection(connection);
        return columncount;
    /* This method returns all the grid elements needed to render the floor plan for the selected floor */
    public static ArrayList<FloorPlanRenderElement> getFloorPlanElements(DataManager dataManager, int floorselected) {
        ArrayList<FloorPlanRenderElement> floorplanrenderelements = new ArrayList<FloorPlanRenderElement>();
         FloorPlanRenderElement oneelement = new FloorPlanRenderElement();
        Connection connection = dataManager.getConnection();
        if (connection != null) {
          try {
            Statement s = connection.createStatement();
            String sql = "select distinct A.grid_x_pos, A.grid_y_pos, A.element_ID, B.element_type, B.occupied" +
                              "from seatplanner.floorgridpart A, seatplanner.floorelement B where (A.floor_ID = " + floorselected +
                              "and A.element_ID = B.ID) order by A.grid_x_pos, A.grid_y_pos asc";     
            try {
              ResultSet rs = s.executeQuery(sql);
              try {
                while (rs.next()) {
                  oneelement.floorgridpart.setGridXPos(rs.getInt(1));
                     oneelement.floorgridpart.setGridYPos(rs.getInt(2));
                     oneelement.floorgridpart.setElementID(rs.getString(3));
                     oneelement.floorelement.setID(rs.getString(3));
                     oneelement.floorelement.setElementType(rs.getString(4));
                     oneelement.floorelement.setOccupied(rs.getString(5));
                     floorplanrenderelements.add(oneelement);
              finally { rs.close(); }
            finally {s.close(); }
          catch (SQLException e) {
            System.out.println("Could not get floor numbers: " + e.getMessage());
          finally {
            dataManager.putConnection(connection);
        return floorplanrenderelements;
    }When I run the application and choose my floor, the result throws me a "No floor plan exists...." [the else...part in the jsp page].
    I have come to know that it is because for some odd reason, the rowcount and columncount variables are not being set properly. I have tested the queries used in the FloorPlanRender peer class in the mySQL query browser and they work (both the row and column count for floor 3 for example, should return 20). But they don't. When I printed out the rowcount and columncount variables, they were set to a 0. I thought the floorselected parameter wasn't retrieved from the previous page properly, but to my surprise it was successfully set to 3, indicating the desired floor number.
    I can't begin to see where the error is. There is nothing wrong with the DB connection or the query, but the correct value is not being set to the variables in the jsp page.
    Can someone please have a look at the code and guide me as to what possibly is going wrong? I have spent a lot of time and effort and still haven't spotted the mistake, if any. Your help is much appreciated.

    Again wrong usage of Iterator :)
    <%@page language="java" contentType="text/html"%>
    <%@page import="java.util.Iterator"%>
    <%@page import="java.util.ArrayList"%>
    <%@page import="seatplanner.beans.FloorPlanRenderElement"%>
    <% String base = (String)application.getAttribute("base"); %>
    <% String imageURL = (String)application.getAttribute("imageURL"); %>
    <jsp:useBean id="dataManager" scope="application"
      class="seatplanner.model.DataManager"/>
    <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>Tech Mahindra SeatMaster&reg; | Floor Plan</title>
      <link rel="stylesheet" href="/TechMSeatPlan/css/pagestyle.css" type="text/css"/>
    </head>
    <body>
    <div id="all">
    <!-- Display logo -->
    <div id="toppanel"> <jsp:include page="TopPanel.jsp"/> </div>
    <br/> <br/>
    <!-- Display main content -->
    <div id="contentpanel">
    <!-- Store the floor selected and get the row and column count for the floor -->
    <% String floorselect = request.getParameter("floorselected");
       int floorselected = Integer.parseInt(floorselect);
       int rowcount = dataManager.getRowCount(floorselected);
       int columncount = dataManager.getColumnCount(floorselected);
       ArrayList<FloorPlanRenderElement> floorplanelements = dataManager.getFloorPlanElements(floorselected);
       Iterator<FloorPlanRenderElement> iterator = floorplanelements.iterator(); %>
    <!-- Create Table to display the grid -->
    <% if(!(floorplanelements.isEmpty())) // Checks whether the retrieved ArrayList is empty or not
    FloorPlanRenderElement anelement = new FloorPlanRenderElement();%>
    <table id="floorplan">
    <% while(iterator.hasNext()){
    anelement = iterator.next(); // The iterator.next() every call would takes the pointer to the next element in the collection
    for(int i=1; i==rowcount; i++){ %>
    <tr>
    <% for(int j=1; j==columncount; j++){%>
    <td width=30px height=30px> <img src="<%=imageURL + anelement.floorelement.getElementType() + "-" + anelement.floorelement.getOccupied()%>"/> </td>
    <% } //close for...j loop %>
    </tr>
    <% } //close for...i loop %>
    <% } //close while... loop %>
    </table>
    <% } //close if, start else
    else { %>
    No floor plan exists. Please choose another floor.
    <% } //close else %>
    </div>
    </div>
    </body>
    </html>For god sake please bother to understand how any implementation of java.util.Iterator works
    for more info go through javadocs
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html
    and i believe you have completey ignored my other suggestion of using enhanced loop in J2SE 5.0+ if iterator is confusing.
    Anyways,hope the above might help you in fixing of what you are trying to..
    REGARDS,
    RaHuL

Maybe you are looking for

  • Is it safe to increase LUN size of ASM disk online 11gR2 ?

    I have an Oracle 11gr2 ASM in a RAC, using an EMC SAN. I have one Disk Group (DATA), with one disk (DISK1), configured with external redundancy [Flash Recovery Area is non-ASM]. Red Hat Linux. My storage is a 450GB LUN, and I want to grow it by 150GB

  • Can hpled 20 inch backlit monitor  be used on a mac?

    I have an hp 20-inch led backlit monitor but cannot get it to work on my macbook. (it does work on my microsoft computer.  I get just the background pic on the desktop, but nothing else comes thru.  is it possible?

  • Standard Fucntion module error

    Hi, I need to calculate the standard deviation.  For this there is a function module RRT_MATH_STDDEV exist. But this standard function module is not working. It is giving error as 'Error generating the test frame' when executing. I tried by calling t

  • How can I get my lost iPhone 4 back?

    Hey guys,          MY iPhone 4 has been stolen. Is there any way to get the address of the person having my iPhone via itunes? I had not app 'Find my iPhone'. Please guys, helpme.      Thanks a lot.

  • HT1766 iPhone calendar sync

    When I back up to iCloud from iPhone my calendar does not show in iCloud calendar. I need this to work so I can sync with iPad calendar. Any help is appreciated.