Out OF Bounds Exception need help

I am trying to learn how to catch exceptions. I can not see what I am doing wrong. Can someone show me and explain what I am doing wrong. I am taking in Military Time and will convert it to a 12 hour clock. I am testing it as I go so I have not finished adding code. The bad code is marked with // <== StringIndexOutOfBoundsException. Thank You in advance for the help.
public class TimeFormat
public TimeFormat()
public static void main(String[] args)
double amtt;
char ans = 'n';
String time1 = "00:00";
String min1 = " ";
int hh = 0;
int mm = 0;
String dd = " ";
System.out.println("This program will convert 24 hour time into 12 hour time");
do
try
System.out.println("Enter a time in military format: (ex. 14:00)");
time1 = SavitchIn.readLine();
hh = Integer.parseInt(time1.substring( 0, 2));
String amPm = "PM";
if (hh <= 12)
amPm = "AM";
dd = time1.substring( 2, 1); // <== StringIndexOutOfBoundsException
mm = Integer.parseInt(time1.substring( 3, 2));
int t1 = Integer.parseInt(time1);
min1 = time1.substring(3, 3);
if (t1 < 0 || t1 > 2459)
throw new Exception ("Exception: Bad Input, must be between 0 and 2459");
catch(Exception e)
System.out.println("e.getMessage()");
System.out.println("Time must be between 0 and 2499");
System.out.println("\n\nWould you like to do it again? (y/n) : ");
ans= SavitchIn.readLineNonwhiteChar();
}while ((ans == 'y') || (ans == 'y'));

import java.awt.*;
import java.io.*;
import java.text.*;
public class texas {
  int hours, minutes;
  String AM_PM = " am";
  public texas() {
    try {
      BufferedReader br = new BufferedReader(
                          new InputStreamReader( System.in ));
      System.out.print("\nEnter a 24-hour time (\"##:##\"): ");
      System.out.flush();
      String s = br.readLine();
      if(s.indexOf(":") == -1) {
        System.out.println("Invalid entry - separate hours " +
                           "and minutes with \":\"");
        return;
      String[] sarray = s.split(":");
      hours   = Integer.parseInt(sarray[0]);
      minutes = Integer.parseInt(sarray[1]);
    } catch(IOException ioe) {
      System.out.println(ioe.toString());
      return;
    } catch(NumberFormatException nfe) {
      System.out.println(nfe.toString());
      return;
    } catch(ArrayIndexOutOfBoundsException aioobe) {
      System.out.println(aioobe.toString());
      return;
    if(hours < 0 || hours > 24) {
      System.out.println("Invalid input - hours must be between 0 and 24");
      return;
    if(minutes < 0 || minutes > 59) {
      System.out.println("Invalid input - minutes must be between 0 and 59");
      return;
    if(hours > 12) {
      hours -= 12;
      AM_PM = " pm";
    if(hours == 12 && minutes >= 0)
      AM_PM = " pm";
    String minutes12 = String.valueOf(minutes);
    if(minutes12.length() < 2)
      minutes12 = "0" + minutes12;
    String time = String.valueOf(hours) + ":" + minutes12 + AM_PM;
    System.out.println("12-hour time is: " + time);
  public static void main(String[] args) {
    new texas();
}

Similar Messages

  • Java Index Out Of Bounds Exception error

    In the Query Designer when I choose access type for Result value as Master data, and execute, I get the following java Index Out Of Bounds Exception error:
    com.sap.ip.bi.webapplications.runtime.controller.MessageException: Error while generating HTML
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2371)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.doServerRedirect(Page.java:2642)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:2818)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2293)
         at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:841)
         at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:775)
         at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:412)
         at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:21)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
         at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.ip.bi.base.exception.BIBaseRuntimeException: Error while generating HTML
         at com.sap.ip.bi.webapplications.ui.items.UiItem.render(UiItem.java:380)
         at com.sap.ip.bi.webapplications.runtime.rendering.impl.ContainerNode.render(ContainerNode.java:62)
         at com.sap.ip.bi.webapplications.runtime.rendering.impl.PageAssemblerRenderingRoot.processRendering(PageAssemblerRenderingRoot.java:50)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRenderingRootNode(Page.java:3188)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRendering(Page.java:2923)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:2877)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2293)
         ... 39 more
    Caused by: java.lang.IndexOutOfBoundsException: fromIndex = -7
         at java.util.SubList.<init>(AbstractList.java:702)
         at java.util.RandomAccessSubList.<init>(AbstractList.java:860)
         at java.util.AbstractList.subList(AbstractList.java:569)
         at com.sap.ip.bi.bics.dataaccess.base.impl.ModifiableList.remove(ModifiableList.java:630)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsDataCells.removeRows(RsDataCells.java:480)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.removeTuples(RsAxis.java:550)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.applyResultVisibility(RsAxis.java:1312)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.applyResultVisibility(RsAxis.java:1326)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.applyResultVisibility(RsAxis.java:1326)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.applyResultVisibility(RsAxis.java:1326)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.applyResultVisibility(RsAxis.java:1272)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsAxis.applyResultVisibility(RsAxis.java:1170)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.ResultSet.applyPostProcessing(ResultSet.java:282)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.ResultSet.refreshData(ResultSet.java:262)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.QueryView.getResultSet(QueryView.java:267)
         at com.sap.ip.bi.webapplications.ui.items.analysis.control.AcPivotTableInteractive.checkResultSetState(AcPivotTableInteractive.java:368)
         at com.sap.ip.bi.webapplications.ui.items.analysis.control.AcPivotTableExport.validateDataset(AcPivotTableExport.java:249)
         at com.sap.ip.bi.webapplications.ui.items.analysis.control.AcPivotTableInteractive.buildUrTree(AcPivotTableInteractive.java:282)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:33)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayoutItem.iterateOverChildren(FlowLayoutItem.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayout.iterateOverChildren(FlowLayout.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.MatrixLayoutCell.iterateOverChildren(MatrixLayoutCell.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.MatrixLayoutRow.iterateOverChildren(MatrixLayoutRow.java:56)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.MatrixLayout.iterateOverChildren(MatrixLayout.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.container.matrixlayout.control.AcMatrixControlGrid.iterateOverChildren(AcMatrixControlGrid.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.Group.iterateOverChildren(Group.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.container.group.control.AcGroupControl.iterateOverChildren(AcGroupControl.java:259)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayoutItem.iterateOverChildren(FlowLayoutItem.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayout.iterateOverChildren(FlowLayout.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.Group.iterateOverChildren(Group.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.container.group.control.AcGroupControl.iterateOverChildren(AcGroupControl.java:259)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.start(CompositeBuildUrTreeTrigger.java:59)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.ExtendedRenderManager.triggerComposites(ExtendedRenderManager.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.BICompositeManager.renderRoot(BICompositeManager.java:79)
         at com.sap.ip.bi.webapplications.ui.items.UiItem.render(UiItem.java:376)
    Any help in solving this error is highly appreciated. Points will be given
    Best Regards,
    Vidyut K Samanta

    Hi.
    Go to line 9 of your code.
    You are trying to use an array there.
    Suppose you have an array x[4] - this array has 4 elements indexed 0..3.
    you are trying to access an element with an index higher than 3.
    Nimo.

  • How to prevent arrayindex out of bounds exception while unziping the files

    hi all ,
    i am new to java.Can any body help me to solve my problem.here is my problem.
    here i am trying to unzip a ziped file. but i am getting arrayindex out of bounds exception at line no 12 (args[0]), my quesion is to how to prevent arrayindex out of bounds exception ? please give me clear explanation.
    public class UnZip2 {
    static final int BUFFER = 2048;
    public static void main (String args[]) {
    try {
    BufferedOutputStream dest = null;
    BufferedInputStream is = null;
    ZipEntry entry;
    ZipFile zipfile = new ZipFile(args[0]);
    Enumeration e = zipfile.entries();
    while(e.hasMoreElements()) {
    entry = (ZipEntry) e.nextElement();
    System.out.println("Extracting: " +entry);
    is = new BufferedInputStream
    (zipfile.getInputStream(entry));
    int count;
    byte data[] = new byte[BUFFER];
    FileOutputStream fos = new
    FileOutputStream(entry.getName());
    dest = new
    BufferedOutputStream(fos, BUFFER);
    while ((count = is.read(data, 0, BUFFER))
    != -1) {
    dest.write(data, 0, count);
    dest.flush();
    dest.close();
    is.close();
    } catch(Exception e) {
    e.printStackTrace();
    }

    how you run it?
    java Unzip2?
    args[0] refer to first parameter in run command, so u should run it by giving a parameter. eg:
    java Unzip2 someFile.zip

  • Array out of bounds exception when outputting array to file

    Could someone please tell me why i'm getting this array out of bounds exception?
    public class Assignment1 {
    public static void main(String[] names)throws IOException {
    BufferedReader keyboard = null;
    String userChoice;
    String inputFile = null;
    String studentData;
    String searchFile = null;
    String searchName;
    String stringIn;
    PrintWriter outputFile;
    FileWriter fWriter = null;
    BufferedReader fReader = null;
    int first;
    int last;
    int mid;
    int midValue;
    int i;
    int number;
    // creates keyboard as a buffered input stream
    keyboard = new BufferedReader(new InputStreamReader(System.in));
    //prompts user to choose 1 or 2 to make a corresponding choice
    System.out.println("Please Enter: ");
    System.out.println("1 to Create a File: ");
    System.out.println("2 to Search a File: ");
    userChoice = keyboard.readLine(); //user enters 1 or 2
    // converts a String into an int value
    number = Integer.parseInt(userChoice);
    fReader = new BufferedReader(new FileReader("studentData.txt"));
    if (number == 1) {          
    System.out.println("Please Enter the File Name to Create: ");
    studentData = keyboard.readLine();
    File file = new File("studentData.txt");
    fWriter = new FileWriter("studentData.txt");
    outputFile = new PrintWriter(fWriter);
    names = new String[200];
    i=0;
    //keep looping till sentinel
    while (studentData != "end" && studentData != null &&
    i < names.length) {
    if (studentData.equals("end")) break; //break and call sort
    System.out.println("Enter a name and press Enter. " +
    "Type 'end' and press Enter when done: ");
    studentData = keyboard.readLine();
    //loop for putting the names into the array
    for(i=0; i<names.length; i++) ;
    outputFile.println(names);
    } [b]outputFile.close();

    package assignment1;
    import java.io.*;
    import java.util.*;
    public class Assignment1 {
        public static void main(String[] names)throws IOException {
           BufferedReader keyboard = null;
           String userChoice;
           String inputFile = null;
           String studentData;
           String searchFile = null;
           String searchName;
           String stringIn;
           PrintWriter outputFile;
           FileWriter fWriter = null;
           BufferedReader fReader = null;
           int first;
           int last;
           int mid;
           int midValue;
           int i;
           int number;
           // creates keyboard as a buffered input stream
           keyboard = new BufferedReader(new InputStreamReader(System.in));
           //prompts user to choose 1 or 2 to make a corresponding choice
           System.out.println("Please Enter: ");
           System.out.println("1 to Create a File: ");
           System.out.println("2 to Search a File: ");
           userChoice = keyboard.readLine();    //user enters 1 or 2
           // converts a String into an int value
           number = Integer.parseInt(userChoice); 
           fReader = new BufferedReader(new FileReader("studentData.txt"));
           if (number == 1) {          
               System.out.println("Please Enter the File Name to Create: ");
               studentData = keyboard.readLine();
               File file = new File("studentData.txt");
               fWriter = new FileWriter("studentData.txt");
               outputFile = new PrintWriter(fWriter);
               names = new String[200];
               i=0;
                //keep looping till sentinel
                while (studentData.equals("end") && studentData != null &&
                       i < names.length) {
                   if (studentData.equals("end")) break;   //break and call sort
                   System.out.println("Enter a name and press Enter. " +
                                       "Type 'end' and press Enter when done: ");
                    studentData = keyboard.readLine();
                    //loop for putting the names into the array
                    for(i=0; i<names.length; i++) ;
                    outputFile.println(names);
    } outputFile.close();
    //call selectionSort() to order the array
         selectionSort(names);
         // Now output to a file.
    fWriter = new FileWriter("studentData.txt");
    outputFile = new PrintWriter(fWriter);
    } else if (number == 2) {
    System.out.println("Please Enter a File Name to search: ");
    searchFile = keyboard.readLine();
    inputFile = ("studentData.txt");
    } if (searchFile == "studentData.txt") {                      
    // Input from a file. See input file streams.
    fReader = new BufferedReader(new FileReader("studentData.txt"));
    System.out.println("Please enter a Name to search for: ");
    searchName = keyboard.readLine();
    //enter binary search code
    first = 0;
    last = 199;
    while (first < last)
    mid = (first + last)/2; // Compute mid point.
    if (searchName.compareTo(names[mid]) < 0) {
    last = mid; // repeat search in bottom half.
    } else if (searchName.compareTo(names[mid]) > 0) {
    first = mid + 1; // Repeat search in top half.
    } else {
    // Found it.
    System.out.println("The Name IS in the file.");
    } // did not find it.
    System.out.println("The Name IS NOT in the file.");
    } else //if userChoice != 1 or 2, re-prompt then start over
    System.out.println("Please Enter 1 or 2 or correctly " +
    "enter an existing file!!");
    // fWriter = new FileWriter("studentdata.txt");
    //outputFile = new PrintWriter(fWriter); //output
    public static void selectionSort(String[] names) {
    //use compareTo!!!!
    int smallIndex;
    int pass, j = 1, n = names.length;
    String temp;
    for (pass = 0; pass < n-1; pass++)
    //Code for Do/While Loop
    do {
    //scan the sublist starting at index pass
    smallIndex = pass;
    //jtraverses sublist names[pass+1] to names[n-1]
    for (j = pass+1; j < n; j++)
    //if smaller string found, smallIndex=that position
    if (names[j].compareTo(names[smallIndex]) < 0)
    smallIndex = j;
    temp = names[pass]; //swap
    names[pass] =names[smallIndex];
    names[smallIndex] = temp;
    } while (j <= names.length);
    //File file = new File("studentData.txt");
    This is the output window:
    init:
    deps-jar:
    compile:
    run:
    Please Enter:
    1 to Create a File:
    2 to Search a File:
    1
    Please Enter the File Name to Create:
    test
    Exception in thread "main" java.lang.NullPointerException
    at assignment1.Assignment1.selectionSort(Assignment1.java:134)
    at assignment1.Assignment1.main(Assignment1.java:73)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 9 seconds)

  • When ever i try to download my iPod recovery software, it keeps saying connection timed out. really annoyed and need help to fix it

    when ever i try to download my iPod recovery software, it keeps saying connection timed out. really annoyed and need help to fix it

    - Next try the manual install method of:
    iDevice Troubleshooting 101 :: iPhone, iPad, iPod touch
    If the iPod was Disabled, place the iPod in recovery mode after the firmware download is complete and then restore using the instructions in the article. Sometimes recovery mode timeouts and returns to disabled before the firmware download is complete.
    - Then try on another computer

  • Out of bounds exception although increasing heap space

    Hello,
    In my java application, there is a gif file with the size 6000 X 3500 . This file is 536 KB and i use this file with scroll bar.
    My question is that although I increased heap space to 512, it still keep going to give "out of bounds" exception when i try to set new dimention to the frame bigger than (800, 1000).
    How can I use my gif file with bigger frame?

    There is no such exception.
    Are you talking about ArrayIndexOutOfBoundsException?
    OutOfMemoryError?
    Something else?

  • Please iam getting index out of bound exception can any body solve my probl

    Dear all
    iam doing aproject in swing in that one class iam using the below method. Iam getting index out of bound exception. Actually iam trying to access the more that 50mb file at that time its giving out of memory exception after that iam using this method now its giving index out of bound exception, when it is going second time in the while loop. can any body solve my problem. Please give me the solution . Ill be very thankful to you.
    public Vector getFileContent(File fileObj){
    FileInputStream fis = null;
    DataInputStream dis = null;
    Vector v = new Vector();
    byte[] data = null;
    int pos = 0;
    int chunk = 10000;
    int sizePos = 0;
    try{
    fis = new FileInputStream(fileObj);
    int size = (int)fileObj.length();
    dis = new DataInputStream(fis);
    int k = 1;
    if(size <10000){
    data = new byte[size];
    //v.addElement(dis.readFully(data));
    dis.readFully(data);
    v.addElement(data);
    else {
    while(pos < size){
    sizePos = size - chunk*k;
    if(sizePos > 10000){
    chunk = 10000;
    else{
    chunk = sizePos;
    data = new byte[chunk];
    dis.read(data, pos, chunk);
    v.addElement(data);
    System.gc();
    pos = pos + chunk + 1;
    regards,
    surya

    pos = pos + chunk + 1;Why the +1??

  • HT4865 I just bought this ipad and cannot log out from icloud because i dont have the password.how can i log out from icloud?need help

    I just bought this ipad and cannot log out from icloud because i dont have the password.how can i log out from icloud?need help

    You need to return it to the seller and get your money back.  You cannot reset or use the device with another AppleID installed unless you know the password for that ID.
    If the device has been jailbroken, no one on here can give you any further help...the Terms of Use prohibit us from doing so.

  • Dynamic Client Exception - Need help

    Hi,
    Need help.......
    I am getting following exception, when I run
    my dynamic client.
    Attached below is my code as well as WSDL.
    Thanks in advance..
    Regards
    -Shakeel
    [java] javax.xml.rpc.JAXRPCException: failed to invoke operation 'Print' du
    e to an error in the soap layer (SAAJ); nested exception is: Message[ failed to
    serialize interface javax.xml.soap.SOAPElementweblogic.xml.schema.binding.Serial
    izationException: mapping lookup failure. class=interface javax.xml.soap.SOAPEle
    ment class context=TypedClassContext{schemaType=['http://learn.technologies.com/
    WS']:PrintRequest}]StackTrace[
    [java] javax.xml.soap.SOAPException: failed to serialize interface javax.x
    ml.soap.SOAPElementweblogic.xml.schema.binding.SerializationException: mapping l
    ookup failure. class=interface javax.xml.soap.SOAPElement class context=TypedCla
    ssContext{schemaType=['http://learn.technologies.com/WS']:PrintRequest}
    [java] at weblogic.webservice.core.DefaultPart.invokeSerializer(Default
    Part.java:328)
    CODE
    // Setup the global SAAJ message factory
    System.setProperty("javax.xml.soap.MessageFactory", "weblogic.webservice.core.soap.MessageFactoryImpl");
    // Setup the global JAX-RPC service factory
    System.setProperty( "javax.xml.rpc.ServiceFactory", "weblogic.webservice.core.rpc.ServiceFactoryImpl");
    ServiceFactory serviceFactory = ServiceFactory.newInstance();
    // define qnames
    String targetNamespace = "http://learn.technologies.com/WS";
    QName serviceName = new QName(targetNamespace, "PersonalDataService");
    QName portName = new QName(targetNamespace, "PersonalDataInterface");
    QName operationName = new QName(targetNamespace, "Print");
    URL wsdlLocation = new URL("http://localhost:7001/simpleexample/PersonalDataInterface?WSDL");
    // create service
    Service service = serviceFactory.createService(wsdlLocation, serviceName);
    // create call
    Call call = service.createCall(portName, operationName);
    WSDL
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://learn.technologies.com/WS"
    targetNamespace="http://learn.technologies.com/WS">
    <types>
    <schema targetNamespace="http://learn.technologies.com/WS"
    xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <element name="PrintRequest">
    <complexType>
    <sequence>
    <element name="firstName" type="string"/>
    <element name="age" type="int"/>
    <element name="salary" type="double"/>
    </sequence>
    </complexType>
    </element>
    <element name="PrintResponse">
    <complexType>
    <sequence/>
    </complexType>
    </element>
    <element name="QueryRequest">
    <complexType>
    <sequence>
    <element name="id" type="double"/>
    </sequence>
    </complexType>
    </element>
    <element name="QueryResponse">
    <complexType>
    <sequence>
    <element name="return" type="tns:ArrayOfPersonalData"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="PersonalData">
              <sequence>
              <element name="name" type="string"/>
              <element name="age" type="int"/>
              <element name="salary" type="double"/>
              </sequence>
    </complexType>
    <complexType name="ArrayOfPersonalData">
              <sequence>
              <element maxOccurs="unbounded" minOccurs="0" name="Item" type="tns:PersonalData"/>
              </sequence>
    </complexType>
    </schema>
    </types>
         <message name="PrintRequestMessage">
         <part name="PrintRequest" element="tns:PrintRequest"/>
         </message>
         <message name="PrintResponseMessage">
         <part name="PrintResponse" element="tns:PrintResponse"/>
         </message>
         <message name="QueryRequestMessage">
         <part name="QueryRequest" element="tns:QueryRequest"/>
         </message>
         <message name="QueryResponseMessage">
         <part name="QueryResponse" element="tns:QueryResponse"/>
         </message>
         <portType name="PersonalDataInterface">
              <operation name="Print">
                   <input name="PrintRequestMessage" message="tns:PrintRequestMessage"/>
              <output name="PrintResponseMessage" message="tns:PrintResponseMessage"/>
              </operation>
              <operation name="Query">
                   <input name="QueryRequestMessage" message="tns:QueryRequestMessage"/>
                   <output name="QueryResponseMessage" message="tns:QueryResponseMessage"/>
              </operation>
         </portType>
         <binding name="PersonalDataIntfBinding" type="tns:PersonalDataInterface">
         <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
         <operation name="Print">
              <soap:operation/>
              <input> <soap:body use="literal"/> </input>
              <output> <soap:body use="literal"/> </output>
         </operation>
         <operation name="Query">
              <soap:operation/>
              <input> <soap:body use="literal"/> </input>
              <output> <soap:body use="literal"/> </output>
         </operation>
         </binding>
         <service name="PersonalDataService">
         <port name="PersonalDataInterface" binding="tns:PersonalDataIntfBinding">
              <soap:address location="http://localhost:7001/simpleexample/PersonalDataInterface"/>
         </port>
         </service>
    </definitions>

    Exception is coming on following line (forgot
    to paste in first post)
         Object result = call.invoke(new Object[] { "Shakeel", new Integer (30), new Double(2000) });

  • Index out of Bounds Exception in for loop.

    Occasionaly with the code below, i get an index out of bounds error, index 1, size 1, however the for loop should ensure that it never calls the getActorLocation method if the index is the same size as the arrayList size.
    Im having one of those days, and i just cant see what error i have made.
    Perhaps i need coffee? lol
    Cheers
    James
    private void checkMemoryIntegrity(){
            Actor actor = actorList.get(actorIndex);
            ArrayList<Integer> inRangeList = getActorsInMemoryRange(actor, actor.getRange());
            inRangeList.trimToSize();
            for (int i = 0; i < inRangeList.size();i++){
                if (inRangeList.size() != 0){
                    actor = brainState.getActorLocation(i); //<<<<<<<<< problem line
                    if (!actorList.contains(actor)){
                        brainState.actorLocations.remove(i);
    public ArrayList <Integer> getActorsInMemoryRange(Actor actor, int range){
            int i = 0;
            int x = actor.getX();
            int y = actor.getY();
            ArrayList <Integer> inRangeList = new ArrayList <Integer> ();
            Actor compActor;
            while (i< brainState.actorLocations.size())
                compActor = brainState.getActorLocation(i);
                int xDist = x - compActor.getX();
                if ( (xDist >= (-1) * range) && (xDist <= range) ){
                    int yDist = y - compActor.getY();
                    if ( (yDist >= (-1) * range) && (yDist <= range) ){
                        inRangeList.add(i);
                i++;
            return inRangeList;
        }

    I was thinking it might be easier to do it this way:
    Iterator<Actor> i = actorLocations.iterator();
    while(i.hasNext())
        if (!actorList.contains(i.next())) {
            i.remove();
    }It sounds like you have an equals() method which compares the x and y locations of the actor. If not then you will have to enclose the remove in an if block which compares the actor location. Does that make sense?
    Edit: contains uses the equals method.
    Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that
    (o==null ? e==null : o.equals(e)).Edited by: Edward_Kimber on May 23, 2008 11:43 AM

  • Can't Figure This Out....Need Help.

    I am attempting to add a line score from a minor league
    baseball team to a website of mine (it's an actual "in progrss"
    line score that updates itself). It looks like it uses a feed of
    somesort with a page refresher, but I can not identify what it is
    from looking at the source code.
    The format I really want looks like this website:
    http://web.minorleaguebaseball.com/clubs/ip_index.jsp?sid=milb&cid=t525
    However, I would be more than happy to get something that
    looks like the line score from this website (on the right above the
    standings):
    http://www.clippersbaseball.com/
    Any insight would be appreciated. Thanks in advance.
    MC

    you might want to explain what your problem is in the title
    of your post. a lot of people don't even look at ones that say
    something like "need help" without any explanation of what the
    actual problem is.
    that being said, from what i can tell from the code of those
    pages, it looks they created some kind of database or something for
    those stats thingies. which means it's probably not something that
    you can just copy and implement on your own site. you might have to
    create your own database.
    but maybe someone else will have some ideas. again, you might
    want to repost or change the name of this thread, if that's
    possible. i doubt you'll get many more responses to this
    one.

  • Array Index out of bound exception

    public Name[] getName() {
              Name[] retVal = new Name[0];
              retVal[0] = this.getNameInstance();
              return retVal;
         public void setName(Name[] theName) {
              theName[0]=this.getNameInstance();
         private Name myNameInstance = new Name();
         public void setNameInstance(Name theNameInstance) {
              if(isValidName(theNameInstance)){
              myNameInstance = theNameInstance;
         public Name getNameInstance() {
              return myNameInstance;
         }I am getting an array Index out of bound eception in the method setName, Can any one tell me where I am doing wrong?

    The array passed in must be empty. I suggest using the debugger for problems like these. If you don't know how to use the debugger, here's a start:
    (Assuming you have a debugger, any IDE you'd be using will)
    1. Set a breakpoint on or before your line of question. In this case, place it on the line of code in your setName() method. Set a breakpoint by either right clicking on that line and selecting "Add breakpoint," or simply click on the far left side of the editor window, right next to the line number. Either way, a little dot will appear to mark the breakpoint.
    2. Execute your code in Debug mode rather than release mode. This might mean clicking on the little bug-looking icon "Debug" rather than "Run."
    3. Your code will execute and you'll enter the debug perspective when that breakpoint is reached. There, in the variables window, you'll see your array and any information about it, particularly its size and contents.

  • How to register itunes with out credit card? need help

    i got mac but i don't have credit card what should i do to register with i tunes. can i link with paypal or debit card? need help cos i am new to mac thing cant use or download any stuff  since my itunes account is not fully active

    You can use an iTunes gift card to start an account. See the I do not have an iTunes Store account section of the How to redeem an iTunes Gift Card on a computer section of the following document:
    iTunes Store: How to redeem an iTunes Gift Card

  • Array out of bounds Exception

    this code :
      public void clearAroundTile (int row, int col) {
            //Checks if a tile is visited, has a hint and hintvalue == adjacent flagged tiles
           if(tiles[row][col].isVisited() && tiles[row][col].isHint() && tiles[row][col].getHint()<= getNumFlagsAround(tiles[row][col])){
             if(!tileAt(tiles[row][col], Direction.N).isFlagged()){
                 visitTile(tileAt(tiles[row][col], Direction.N));
             if(!tileAt(tiles[row][col], Direction.NE).isFlagged()){
                 visitTile(tileAt(tiles[row][col], Direction.NE));
             if(!tileAt(tiles[row][col], Direction.E).isFlagged()){
                 visitTile(tileAt(tiles[row][col], Direction.E));visits all the tiles on a board, around a base tile, now the problem is that sometimes, when if checks aorund a tile that is near the edge of a board i get an out of bounds exeption, i know why this happens, but i dont know what type of if statments i should use to correct it, i was thinking.. do if(row-1)>0) then it does not go out of the board, but then how would i do it for the edge of the board that does not relate to zero? any ideas.
    thanks

      if(row > 0 && tiles[row][col].isBlank()  )
                if(!tiles[row-1][col].isVisited()){
                    clearAroundTile(row-1, col);
                    visitTile(tileAt(tiles[row][col], Direction.N));
            if(row -1 > 0 && col + 1 < cols && tiles[row][col].isBlank()  )
                if(!tiles[row-1][col+1].isVisited()){
                    clearAroundTile(row-1, col+1);
                    visitTile(tileAt(tiles[row][col], Direction.NE));
                }i am using this to automatically clear the tiles that are blank, that is only for 2 directions, i did it for all, and for some reason i keep getting a stack overflow, damn

  • BeanUtils.populate exception (Need Help)

    Dear All,
    Am getting a strange exception when try to do a action in struts, below is my exception, please help me in solving this issue.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1190)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
         java.security.AccessController.doPrivileged(Native Method)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    root cause
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
         java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         java.security.AccessController.checkPermission(AccessController.java:427)
         java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
         java.lang.Class.checkMemberAccess(Class.java:2125)
         java.lang.Class.getDeclaredMethods(Class.java:1762)
         org.apache.commons.beanutils.MappedPropertyDescriptor$1.run(MappedPropertyDescriptor.java:386)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.commons.beanutils.MappedPropertyDescriptor.getPublicDeclaredMethods(MappedPropertyDescriptor.java:383)
         org.apache.commons.beanutils.MappedPropertyDescriptor.internalFindMethod(MappedPropertyDescriptor.java:453)
         org.apache.commons.beanutils.MappedPropertyDescriptor.findMethod(MappedPropertyDescriptor.java:527)
         org.apache.commons.beanutils.MappedPropertyDescriptor.<init>(MappedPropertyDescriptor.java:149)
         org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:865)
         org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:991)
         org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:865)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:343)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1188)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
         java.security.AccessController.doPrivileged(Native Method)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Thanks in advance,
    vyrav.

    Thanks for ur reply Ganesh.
    This is my JSP
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html:html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Uploaded File Details</title>
         <script>
              function logOut()
                        document.adminForm.action="upload.do?parameter=logout";
                        document.adminForm.submit();
              function download(temp)
                        document.adminForm.fileId.value = temp;
                        document.adminForm.action="download.do";
                        document.adminForm.submit();
         </script>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
         <table align="right">
                        <tr>
                             <td>
                                  <a href="javascript:logOut();">Logout</a>
                             </td>
                        </tr>
         </table>
         <%
                        if(session.getAttribute("name")!=null)
                                    String userName= (String) session.getAttribute("name");
         %>
                   <br /><br /><b>Welcome <%=userName%></b><br />
         <%
         %>
         <center>
              <html:form action="/download.do" name="adminForm" type="com.roots.AdminForm">
                   <br /><br />
                   <html:hidden property="fileId"/>
                   <table align="center" border="1">
                        <tr bgcolor="#FFCC66">
                             <td align="center">
                                  No
                             </td>
                             <td align="center">
                                  Name
                             </td>
                             <td align="center">
                                  Uploaded Date
                             </td>
                             <td align="center">
                                  File Name
                             </td>
                        </tr>
                        <logic:iterate name="adminForm" property="displayList" id="displayDto">
                             <tr>
                                  <td align="center">
                                       <bean:write name="displayDto" property="serialNo"/>
                                  </td>
                                  <td align="left">
                                       <bean:write name="displayDto" property="empName"/>
                                  </td>
                                  <td align="left">
                                       <bean:write name="displayDto" property="uploadedDate"/>
                                  </td>
                                  <td align="left">
                                       <a href="javascript:download('<bean:write name="displayDto" property="serialNo"/>');"><bean:write name="displayDto" property="fileName"/></a>
                                  </td>
                             </tr>
                        </logic:iterate>
                   </table>
              </html:form>          
         </center>
    </body>
    </html:html>This is my struts config
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
             "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
             "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
         <struts-config>
               <data-sources>
               </data-sources>
              <form-beans>
                   <form-bean name="loginForm" type="com.roots.LoginForm" />
                   <form-bean name="uploadForm" type="com.roots.UploadForm" />
                   <form-bean name="adminForm" type="com.roots.AdminForm" />
              </form-beans>
              <global-forwards></global-forwards>
              <action-mappings>
                   <action path="/login"
                        name="loginForm"
                        scope="request"
                        validate="true"
                        input="/login.jsp"
                        type="com.roots.LoginAction" >
                             <forward name="SUCCESS" path="/upload.jsp" />
                             <forward name="FAILURE" path="/login.jsp" />
                             <forward name="ADMIN" path="/admin.do" />
                   </action>
                   <action path="/upload"
                        name="uploadForm"
                        scope="request"
                        parameter="parameter"
                        input="/upload.jsp"
                        type="com.roots.UploadAction" >
                             <forward name="SUCCESS" path="/upload.jsp" />
                             <forward name="FAILURE" path="/login.jsp" />
                   </action>
                   <action path="/download"
                             type="com.roots.FileDownloadAction">
                   </action>
                   <action path="/admin"
                        name="adminForm"
                        scope="request"
                        validate="false"
                        type="com.roots.AdminAction" >
                        <forward name="DISPLAY" path="/admin.jsp" />
                        <forward name="FAILURE" path="/login.jsp" />
                   </action>
              </action-mappings>
              <message-resources parameter="application_fr"/>
            <message-resources parameter="application_es"/>
            <message-resources parameter="application_en"/>
            <message-resources parameter="application_de"/>
            <message-resources parameter="application" />
         </struts-config>this is my form package com.roots;
    import java.util.List;
    import org.apache.struts.action.ActionForm;
    public class AdminForm extends ActionForm {
         private List displayList = null;
         public String fileId;
         public String getFileId() {
              return fileId;
         public void setFileId(String fileId) {
              this.fileId = fileId;
         public List getDisplayList() {
              return displayList;
         public void setDisplayList(List displayList) {
              this.displayList = displayList;
    }Please let me know wat am doing wrong, this is killing me for the last two days.
    Thanks,
    vyrav.

Maybe you are looking for