Why am I getting this error?  How do I add confirm message to button press?

Using Java Studio Creator.
I do not understand why I am getting the following page error:
Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
Exception Details: java.lang.IndexOutOfBoundsException
Index: 0, Size: 0
Possible Source of Error:
Class Name: java.util.ArrayList
File Name: ArrayList.java
Method Name: RangeCheck
Line Number: 546
======================================================================
I have a page that works.
It has a button that is created in the session bean code with the following java:
button = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
button.setActionListener( application.createMethodBinding("#{ScheduleEditSessionBean.mainApply}", new Class[]{ActionEvent.class} ));
button.setId( "applyUndates" );
button.setType( "submit" );
button.setTitle( "Apply updates.");
button.setValue( "Apply" );
button.setStyle(style);
children.add(button);
When the button is pushed, it calls the following session bean method:
public void mainApply(ActionEvent actionEvent)
updateScheduleData();
scheduleAdjustFlag = 1;
dataApplied = true;
dataSaved = false;
addControls();
This all works just fine - no errors
====================================================================
I wanted to add confirmation to the button press, so I removed the action listener for this button and added
a javascript function call for the onclick method
button = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
style = "text-align: center; font-family: 'Arial','Helvetica',sans-serif; " + font + " height: 22px; width: 115px";
// Commented out this line button.setActionListener( application.createMethodBinding("#{ScheduleEditSessionBean.mainApply}", new Class[]{ActionEvent.class} ));
button.setOnclick("confirmApply()"); // Added this line.
button.setId( "applyUndates" );
button.setType( "submit" );
button.setTitle( "Apply updates.");
button.setValue( "Apply" );
button.setStyle(style);
children.add(button);
I added a dummy button to the page that has the following call to execute the mainApply method in the sessioon bean.
The button action just calls the mainApply() method in the session bean
public String mainApplyBtn_action() {
seb.mainApply();
return null;
Added the javascript to the page that simply pushes the dummy button if confirmed.
function confirmApply()
if( confirm( 'Are you sure you want to Apply these changes?' ) )
form1["form1:mainApplyBtn"].click();
The session bean method looks like this it is the same method as before, but without the action event argument.
public void mainApply()
lsb.logMsg( "<ScheduleEditBean.mainApply> Main apply pushed" );
updateScheduleData();
scheduleAdjustFlag = 1;
dataApplied = true;
dataSaved = false;
addControls();
==================================================================================
Now, when I push the original 'Apply' button, I get the confirmation box just like I expected.
But when I confirm the question, I get the error at the top of this post.
If I push the 'dummy button' directly, I do not get the error.
I do not understand why I should be gettng this error.
Can anyone give me a clue as to why this change would cause the problem?
The error is related to an ArrayList.
I use several of these on the page, but they should be filled with data in the preRender method of the page.
Can anyone suggest a way that I can add confirmation to a button that is created under program control?
Thanks

Make use of the fact that when an onclick event of a button returns 'false', the action will not be taken.
Pseudocode:<h:commandButton value="submit" action="#{myBean.action}" onclick="return confirm('Are you sure?');" />

Similar Messages

  • More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library.

    I am able to pick 4 videos from the Photo library in my iPhoneAPP but when i try to pick 5th one it throws an error:
    "More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library."

    Hello Tate r Bulic
    I don't have any idea how to remove this error,can i pick more than 5 videos from the photo library...
    If it's then please help me and gimme idea..Thanks

  • Why am I getting this error message......."Adobe Reader could not open 'SBA 413.pdf' because it is e

    why am I getting this error message when I try to open a PDF file?  Adobe Reader could not open 'SBA 413.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

    It's difficult for anyone to say how to fix it. Try getting a new copy of it. Did you download it from a web site, as an email attachment, or something else?
    I donwloaded that form from the SBA web site and it worked fine for me. It is an XFA form created in LiveCycle Designer, but those should work fine with the desktop versions of Adobe Reader. So try downloading it: http://www.sba.gov/sites/default/files/SBA%20413_0.pdf

  • I get missing plug-in error when opening my online bill which is in PDF format. I am using a 2010 Macbook with the latest version of Safari and Adobe suite installed in my computer. Why do I get this error? What should I do?

    I get missing plug-in error when opening my online bill which is in PDF format. I am using a 2010 Macbook with the latest version of Safari and Adobe suite installed in my computer. Why do I get this error? What should I do?

    In relation to my previous inquiry regarding inability to view a pdf file using Safari...
    Is it possible that I can view other online bills from other website but not this particular bill from one specific website?
    Sorry if I missed any important point in this article -->Apple Safari 5.1 and Adobe Reader/Acrobat Advisory
    Thanks again!

  • Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue.  I have reinstalled the program to no avail.

    Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue. I have tried reinstalling the program but it made no difference to the error message.
    Could someone help please?  Steph

    Hi,
    Please give a try to Photoshop Elements (PSE) knowledge base. steps mentioned on this and see if it works.
    Regards
    Kishan

  • Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    I may have already resolved this issue buy removing the device from my computer and re-pairing it. It is currently working just fine.

  • According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"

    According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"
    Amysim/Optus support can not help.
    I can not check or change any network settings (no APN settings)
    I have synced phone using latest itunes (10.5.3).
    Phone software is up to date (5.0.1).
    Network settings have been reset.
    SIM card has been taken out and put back in.
    Phone has been switched off/on again.
    Another sim card from virgin works ok (hotspot option is visible and can be turned on/off as required)
    The Amaysim/Optus SIM card can be put into another phone (android) and tethering/hotspot works fine.
    Can anyone provide solution to this nightmare?

    I am having the same issue although i have an iphone 5. I have contacted Live connected numerous times an tried everything imaginable to solve the issue. Is it possibly a handset issue? I cant recieve any help from optus as im with live connected, they cant help me and apple keep telling me to contact your carrier ( live connected). Seems to make me want to switch providers pretty shortly..
    please let me know if you can solve your issue and maybe it can help me too..

  • Why am I getting this error?

    Hello,
    I am trying to call my Java class from a JSP page. I am getting this error:
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:82: Wrong number of arguments in constructor.
    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
    I don't understand why I am getting this error as I pass three paramters to the Java class, and I accept three parameters in the constructor.
    JSP:
    <!-- META TAG is necessary to ensure page recompiles--------------->
    <META Http-Equiv="Expires" Content="0">
    <META Http-Equiv="Pragma" Content="no-cache">
    <HTML>
    <!-- The two Java Classes used to build the AlphaBlox query -->
    <%@ page import="com.home.tool.reporting.*" %>
    <%@ page errorPage="run_error.jsp" %>
    <%@ page import="java.util.List,
                     java.util.Collection,
                java.net.URLDecoder" %>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE>Economic Model - Summary SBU Report</TITLE>
    <!--Run the onload here, re-retrieve params BM and Breport, pass to onload---------->
    <BODY bgcolor=#ffffff>
    <%
                    Collection strQuery = null;
                    String strEssUser = "test";
                    String strProcessingMonth = "JUL";
                    String strProcessingYear = "2002";
                    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
                    System.out.println(strQuery);
    %>
    </BODY>
    </HTML>Java class:
    package com.home.tool.reporting;
    import java.net.URL;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class ListReturn extends ReportQueryBuilder
            public void ListReturn()
            public Collection ListReturn(String userID, String pMonth, String pYear)
                throws ReportQueryBuilderException
                //declare Collection store Value-Object pairs
                Collection c = new ArrayList();
                //declare and initialize variables
                CallableStatement cs = null;
                ResultSet rs = null;
                // declare call for stored procedure to pass in three parameters
                String pass = "{Call dbo.p_rep_srSbuList(?, ?, ?)}";
                try
                    //open CallableStatement using JDBC connection to SQL database
                    cs = con.prepareCall(pass);
                    //set IN parameters
                    cs.setString(1, userID);
                    cs.setString(2, pMonth);
                    cs.setString(3, pYear);
                    //execute call and return result set
                    rs = cs.executeQuery();
                    //loop through result set storing each record as a Value-Object pair
                    while(rs.next())
                        c.add(new ListBoxValueObjects(rs.getString(1), rs.getString(2)));
                catch (SQLException sqle)
              throw new ReportQueryBuilderException(replaceToken("Problems executing query: "+sqle.getMessage(), "'", "\\'"));
                finally
                    try
                        //close the Result Set and CallableStatement
                        rs.close();
                        cs.close();
                    catch(Exception e)
                        System.out.print("\nFATAL   : " + e);
                        System.out.print("\nFATAL   : " + e);
                return c;
    }Does anyone see whay I am getting this error??
    I can't figure out the problem!

    change this:
    <%
         Collection strQuery = null;
         String strEssUser = "test";
         String strProcessingMonth = "JUL";
         String strProcessingYear = "2002";
         strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(strQuery);
    %>To this:
    <%
         Collection strQuery=null;
         String strEssUser="test";
         String strProcessingMonth="JUL";
         String strProcessingYear="2002";
         lr=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(lr.getQuery())
    %>Then make a new public method in your Java called getQuery()
    public Collection getQuery();Do what you need to do to process it and return the value in getQuery. You will also probably need to make private variables in you declaration to do the processing on.

  • Why am i getting this error? they are not the same?

    1021: Duplicate function definition.
    1021: Duplicate function definition.
    stop();
    import flash.events.MouseEvent;
    // home button definition \\
    // Portfolio button definition \\
    Portfolio_btn.addEventListener(MouseEvent.CLICK, pClick);
    function pClick(event:MouseEvent):void{
        gotoAndStop("getPortfolio");
    // Contact Me button defintion \\
    Contact_btn.addEventListener(MouseEvent.CLICK, cClick);
    function cClick(event:MouseEvent):void{
        gotoAndPlay("contactme");
    why am i getting this error the functions have different names... idk what to do they are for two different buttons I am using action script 3.0

    i did what u said and it said these two lines were the same
    // Portfolio button definition \\
    Portfolio_btn.addEventListener(MouseEvent.CLICK, pClick);
    function pClick(event:MouseEvent):void{                                                         <--------this one
        gotoAndStop("getPortfolio");
    // Contact Me button defintion \\
    Contact_btn.addEventListener(MouseEvent.CLICK, cClick);
    function cClick(event:MouseEvent):void{                                                           <--------and this one
        gotoAndPlay("contactme");
    it gave me the same error but they are not the same

  • Why am I getting this error message when I try to import? "The following files were not imported because they could not be read. (645)" I can see them :(

    Why am I getting this error message when I try to import? "The following files were not imported because they could not be read. (645)" I can see them
    Is was working this morning!

    Depends on your operating system
    Go to google, try typing in
    Change permissions Windows
    or
    Change permissions Mac

  • Your message was not sent. Tap "try again" to send this message. Why do i get this error?

    your message was not sent. Tap "try again" to send this message. Why do i get this error?

    Hi babychriss,
    Thanks for visiting Apple Support Communities.
    There are several possible reasons why a message might not send. I'd recommend starting with the troubleshooting steps in this article:
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Regards,
    Jeremy

  • When I want to scroll through My picks why do I get this Error message (A necessary data reference could not be resolved."

    When I want to scroll through My pictures  why do I get this Error message (A necessary data reference could not be resolved)

    Before anyone can help, they need information to work with. Basic stuff:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. What were you doing when the problem arose?
    - Did it ever work properly?
    - Are there error messages?
    - What steps have you tried already to solve the issue.
    Anything else you can think of that might allow someone else to understand your issue.
    With this kind of information somebody can develop a starting point for troubleshooting the issue.
    Posts that consist of "iPhoto doesn't work. Help" or "iPhoto won't print" or "Suddenly I have no photos!!!!!!!!!!" mean that any helper is simply guessing. With information, s/he may be able to get your issue resolved sooner.

  • GetLastError: 1392 - why do I get this error message when I try to uninstall Acrobat XI Pro?

    GetLastError: 1392 - why do I get this error message when I try to uninstall Acrobat XI Pro?

    Hi uckldag,
    Please try uninstalling using Acrobat Cleaner tool ( Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs ) and check.
    Regards,
    Rave

  • Why do I get this Error Code:6

    Why do I get this Error Code:6 When I try to open my CC Photoshop CS5?
    I uninstall and I reinstall the product,But this problem continues occurs.Why?

    Run CC Cleaner and try to install again
    CS Cleaner Tool for installation problems | CCM, CS6, CS5.5, CS5, CS4, CS3
      http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

  • Why do I get this error when I want to run a test using Ant?

    Why do I get this error when I run the Ant build file?
    Testsuite: JUnit
    Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    Caused an ERROR
    JUnit
    java.lang.ClassNotFoundException: JUnit
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

    Abder-Rahman wrote:
    In the "XML" file, I was giving the name of the test as JUnit ---> <test name="JUnit">Well, do you have a class called just "JUnit" that contains a test?

Maybe you are looking for

  • Why isnt my iphone charging or being recognized on my computer?

    i just bought the 3gs 2 days ago and it was working totally fine untill today. I went to charge it and nothing showed up. so i plugged it in to my computer to see if i could reset it or something but it dosnt show on itunes. There is a message displa

  • Saving to PDF with hyperlink sections

    I've saved a 200 page PDF document from Word. The Word document contains hyperlinks on the contents page to jump to the relevant section in the document. Is there a way to do with for the PDF I've created? I've received large PDFs in the past which a

  • Interview questions.......help me

    what is the main difference between move and move-corresponding? what is default join when ur using join for two internal tables? what is field group?where we can use this? what is data analasys concept? what is client concept? give me some best site

  • Clean Access Server is unavailable on the network

    I have an issue where randomly (about 4 or 5 users per week out of about 150 concurrent users) people are getting "Clean Access Server is unavailable on the network".  We are using the full client v4.7.0.  Certs and DNS look good, and everything work

  • Problem in calling fm in smartforms

    Hi Friends, I m modified one form & i got the value in my internal table. but the problem is that when i m executing my print prog i got the runtime error. In dump analysis it is showing error in my fm. Anybody will help me regarding this???