Decode vs (parseInt or valueOf) ?

What's the difference between the decode and parseInt methods of the Integer class?
Josh

There are actually two valueOf methods, one without a base and one with. So:
Integer.valueOf("0x11"); // throws NumberFormatException
Integer.valueOf("11", 16); // Integer with value of 17
Integer.decode("0x11"); // Integer with value of 17
Integer.valueOf("11"); // Integer with value of 11
Integer.valueOf("0x11", 16); // throws NumberFormatException

Similar Messages

  • Have a challenge (at least to me) for a challenger

    i got a new screenname so i could give away the 25 dukes to whoever does it, not too sure if its much of an incentive. out of the past 48 hours i have been up about 40 of those hours, and i am so burned out on java right now i dont care about the stupid bet i did this for, but i know i do (know what i mean?!). anyway, i thought i'd let some very gracious and smart person(s) to help out a not-so-good rookie java programmer. i have already received help, and could always use more!! so, i have the first part of this program finished. all i need left to do is decrypt it. the instructions that were given to me are below (the decryption is the reverse of the instructions). the code i have is below that. i have case 1 finished, i just need the method for case 2. i appreciate whoever helps me out, it will be returned. thank u!!!! now im going to bed.
    1. Swap digits 1 and 7, 2 and 6, and 3 and 5 of the original number
    2. Using the output of phase 1, replace each digit with the sum of that digit plus 9 modulo 10
    3. Using the output of phase 2, swap digits 1 and 2, 3 and 4, and 5 and 6
    import javax.swing.*;
    public class Program3{
    public static int array;
    public static void main( String args [ ] )
    String num, num1, num2;
    int number, number1, number2;
    num = showMenu ( );
    number = Integer.parseInt( num );
    if( number < 4 )
    switch ( number ){        
    case 1:
    num1 = JOptionPane.showInputDialog("Please enter a seven digit number : ");
    number1 = Integer.parseInt( num1 );
    swapDigit( num1 );
    break;
    case 2:
    num2 = JOptionPane.showInputDialog("Enter an encrypted number : ");
    number2 = Integer.parseInt( num2 );
    break;
    case 3:
    System.exit ( 0 );
    else
    JOptionPane.showMessageDialog(null, "Enter another number. Choose ONLY numbers 1, 2, or 3 !!! GOT IT!!!\nGood, now let's try this again Einstein.", "HEY!!!!", JOptionPane.INFORMATION_MESSAGE);
    showMenu ( );
    public static String showMenu ( )
    return JOptionPane.showInputDialog("Please enter the number corresponding to your choice : \n\n1. Encryption\n2. Decryption\n3. Exit\n");
    public static void swapDigit ( String num1 )
    int nums[ ] = new int[7];
    char[ ] c = num1.toCharArray( );
    int digit = 0;
    for ( int k = 6; k >= 0; k--) {
    nums [ digit++ ] = (Integer.parseInt (String.valueOf (c [ k ] )) + 9) % 10;
    StringBuffer finaloutput = new StringBuffer( );
    finaloutput.append( nums [1]);
    finaloutput.append( nums [0]);
    finaloutput.append(nums [3]);
    finaloutput.append(nums [2]);
    finaloutput.append(nums [5]);
    finaloutput.append(nums [4]);
    finaloutput.append(nums [6]);
    array = Integer.parseInt( finaloutput.toString());
    JOptionPane.showMessageDialog( null, finaloutput, "encrypted number", JOptionPane.INFORMATION_MESSAGE);

    This site has problem with the posting of code...here is an unformatted version:
    import javax.swing.*;
    public class Program3 {
       public static int array;
       public static void main( String args [ ] ) {
          String num, num1, num2;
          int number=0;
          boolean repeat=true;
          while (repeat) {
          num = showMenu ();
          number = Integer.parseInt( num );
          if (number < 4 ) {
             switch (number ) {
                case 1:
                   num1 = JOptionPane.showInputDialog("Please enter a seven digit number : ");
                   num1=step1(num1);
                   num1=step2(num1);
                   num1=step3(num1);
                   JOptionPane.showMessageDialog( null, num1, "encrypted number", JOptionPane.INFORMATION_MESSAGE);
                   break;
                case 2:
                   num2 = JOptionPane.showInputDialog("Enter an encrypted number : ");
                   num2=step3(num2);
                   num2=step2r(num2);
                   num2=step1(num2);
                   JOptionPane.showMessageDialog( null, num2, "decrypted number", JOptionPane.INFORMATION_MESSAGE);
                   break;
                case 3:
                   repeat=false;
                   break;
          } else JOptionPane.showMessageDialog(null, "Enter another number. Choose ONLY numbers 1, 2, or 3 !!! GOT IT!!!\nGood, now let's try this again Einstein.","HEY!!!!",
               JOptionPane.INFORMATION_MESSAGE);
          System.exit (0 );
       public static String showMenu () {
          return JOptionPane.showInputDialog("Please enter the number corresponding to your choice : \n\n1. Encryption\n2. Decryption\n3. Exit\n");
       public static String step1(String num1) {
          String ret="";
          for (int i=6;i>=0;i--) ret+=num1.charAt(i);
          return ret;
       public static String step2(String num1) {
          String ret="";
          for (int i=0;i<7;i++) ret+=((num1.charAt(i)-'0') + 9) % 10;
          return ret;
       public static String step2r(String num1) {
          String ret="";
          for (int i=0;i<7;i++) ret+=((num1.charAt(i)-'0') + 10) % 9;
          return ret;
       public static String step3(String num1) {
          String ret="";
          ret+=num1.charAt(1);
          ret+=num1.charAt(0);
          ret+=num1.charAt(3);
          ret+=num1.charAt(2);
          ret+=num1.charAt(5);
          ret+=num1.charAt(4);
          ret+=num1.charAt(6);
          return ret;
    }Better?
    V.V.

  • How to change the size of the caret in a JTextPane

    I have text of different font sizes and the default caret height is the height of the text with the maximum font size. How do I change the caret height so that it matches the height of the text with the specified font size ?

    This has been a real pain in the butt to figure out, but I think I finally got it. If you create your own caret (subclass of DefaultCaret) then you override its paint() and damage() methods. I was having all kinds of problems with this though. I was getting pieces of carets left behind when I moved with the arrow keys, etc... from the helps I found. The arrow keys were my big problem.
    I think I finally figured out that the damage() simply does need to specify an area a little bigger than the old caret so it can blank it out. Then I think others had a logic problem, and Sun does not make this problem clear. What happens it that I think repaint() calls paint() who then uses the bigger x, y, height and width parameters that got set in damage(), which was causing my problems because the damage size was bigger than the size I wanted to create my caret with. What I do is figure out my area from the font I am using (another trick) and make them (the charWd and charHt) variables class variables. I calculate them in damage, use a bigger area to blank out my old caret in damage, and then used the correct caret size I calculated in damage() in paint(), instead of the rectangle values that seem to get passed from damage() to paint(). That was the problem in other examples.
    Here is my code:
    run with java caretPain
    run with java caretPain -1 to see my fixed version
    run with java caretPain -2 to see some problems
    // written by: Stan Towianski
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Hashtable;
    import java.util.ArrayList;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    import javax.swing.undo.*;
    import javax.swing.plaf.basic.*;
    import javax.swing.text.*;
    import javax.swing.plaf.*;
    import java.net.URL;
    import java.io.*;
    import java.beans.*;
    public class caretPain extends JFrame {
    static caretPain CRTP2;
    JPanel contentPane;
    JTextPane textPane;
    JTextPane textPane2;
    JScrollPane scrollPane;
    JSplitPane splitPane;
    String newline = "\n";
    static final int MAX_CHARACTERS = 300100;
    static int FrameWidth = 500;
    static int FrameHeight = 300;
    String caretType = "blockOutline";
    static int useSpecialCaret = 0;
    DefaultCaret useCaret = new MyCaret();
    public caretPain() {
    textPane = new JTextPane( new DefaultStyledDocument() );
    textPane2 = new JTextPane( new DefaultStyledDocument() );
    if ( useSpecialCaret == 1 )
    System.out.println( "using special caret 1" );
    textPane.setCaret( useCaret );
    else if ( useSpecialCaret == 2 )
    System.out.println( "using special caret 2" );
    textPane.setCaret( new WsCaret() );
    textPane.setCaretPosition(0);
    textPane.setMargin(new Insets(5,5,5,5));
    scrollPane = new JScrollPane(textPane);
    textPane.setPreferredSize(new Dimension(FrameWidth, FrameHeight));
    JScrollPane scrollPane = new JScrollPane(textPane);
    //Create a split pane for the change log and the text area.
    splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT,
    textPane, textPane2 );
    splitPane.setOneTouchExpandable(true);
    //Add the components to the frame.
    contentPane = new JPanel(new BorderLayout());
    contentPane.add(splitPane, BorderLayout.CENTER);
    setContentPane(contentPane);
    class MyCaret extends DefaultCaret
    int charWd = 30;
    int charHt = 30;
    // draw the caret
    public void paint(Graphics g)
    System.err.println( "entered MyCaret.paint()" );
    if ( ! isVisible() )
    System.err.println( "exiting because not visible" );
    return;
    try {
    JTextComponent c = getComponent();
    int dot = getDot();
    Rectangle r = c.modelToView(dot);
    System.err.println("caret: text position: " + dot +
    ", view location = [" +
    r.x + ", " + r.y + "]" +
    newline);
    g.setColor(c.getCaretColor());
    //g.drawLine(r.x, r.y + r.height - 1, r.x + 14, r.y + r.height - 1);
    System.err.println( "caretType =" + caretType ); //+ " component =" + c.toString() );
    if ( caretType.equals( "blockOutline" ) )
    g.drawRect( r.x, r.y, charWd, charHt );
    else if ( caretType.equals( "block" ) )
    g.fillRect( r.x, r.y, charWd, charHt );
    else if ( caretType.equals( "bar" ) )
    g.drawLine( r.x, r.y, r.x, r.y + charHt );
    catch (BadLocationException e) {
    System.err.println( "bad caret loc" + e);
    // specify the size of the caret for redrawing
    // and do repaint() -- this is called when the
    // caret moves
    //protected synchronized void damage(Rectangle r)
    public synchronized void damage(Rectangle r)
    System.err.println( "entered MyCaret.damage()" );
    System.err.println("caret.damage(): text position: " + getDot() +
    ", view location = [" +
    r.x + ", " + r.y + "]" +
    newline);
    //FontMetrics fm = g.getFontMetrics();
    //System.out.println( "textPane getfont =" + textPane.getFont() );
    //System.out.println( "\n\n read in attribs font size =" + textPane.getInputAttributes().getAttribute(StyleConstants.FontSize) + "\n\n" );
    //int ii = Integer.parseInt( (String) textPane.getInputAttributes().getAttribute( StyleConstants.FontSize ) );
    int ii = Integer.parseInt( String.valueOf( textPane.getInputAttributes().getAttribute( StyleConstants.FontSize ) ) );
    //System.out.println( "textPane input attrib font size =" + ii );
    Font f = new Font( "ff", Font.PLAIN, ii );
    //System.out.println( "textPane input attrib font =" + f );
    FontMetrics fm = getFontMetrics( f );
    //FontMetrics fm = g.getFontMetrics();
    //FontMetrics fm = getFontMetrics( textPane.getInputAttributes().getAttribute( StyleConstants.FontSize ) );
    //MutableAttributeSet inputAttributes = getInputAttributes();
    //String fs = textPane.getAttribute( "FontSize" );
    //System.out.println( "\n\n read font size =" + textPane.getCharacterAttributes().getAttribute(StyleConstants.FontSize) + "\n\n" );
    charWd = fm.charWidth( 'k' );
    charHt= fm.getHeight();
    //System.out.println( "font width =" + charWd + " font height =" + charHt + " font =" + fm.toString());
    if ( r == null )
    System.err.println( "caret.damage() return on rectangle == null" );
    return;
    x = r.x - 2;
    y = r.y - 2; // + r.height - 2;
    width = charWd + 4; //textPane.getColumnWidth();
    height = charHt + 4; //textPane.getRowHeight();
    System.err.println("caret.damage(): set caret width, height, x, y =" + width + "," + height + "," + x + "," + y );
    repaint();
    //repaint();
    public class WsCaret extends DefaultCaret {
    transient private int[] flagXPoints = new int[3];
    transient private int[] flagYPoints = new int[3];
    public WsCaret() {
    this.setBlinkRate(500);
    public void paint(Graphics g) {
    if(isVisible()) {
    JTextComponent component = this.getComponent();
    TextUI mapper = component.getUI();
    Rectangle r = null;
    try {
    r = mapper.modelToView(component, this.getDot());
    catch(BadLocationException exc) {}
    //System.out.println( "rect r =" + r.toString() );
    //g.drawLine(r.x, r.y, r.x, r.y + r.height - 1);
    //g.drawLine(r.x+1, r.y, r.x+1, r.y + r.height - 1);
    g.drawRect( r.x, r.y, 10, r.height );
    Document doc = component.getDocument();
    if (doc instanceof AbstractDocument) {
    Element bidi = ((AbstractDocument)doc).getBidiRootElement();
    if ((bidi != null) && (bidi.getElementCount() > 1)) {
    // there are multiple directions present.
    flagXPoints[0] = r.x;
    flagYPoints[0] = r.y;
    flagXPoints[1] = r.x;
    flagYPoints[1] = r.y + 4;
    flagYPoints[2] = r.y;
    flagXPoints[2] = (true) ? r.x + 5 : r.x - 4;
    System.out.println( "going g.fillPolygon" );
    g.fillPolygon(flagXPoints, flagYPoints, 3);
    protected synchronized void damage(Rectangle r) {
    if (r != null) {
    this.x = r.x - 4;
    this.y = r.y;
    //there must be a better way to doing this, but for now you
    //just increase the width so that it will cover the new caret's size
    this.width = 20; // the original width is 10
    this.height = r.height;
    //this.height = r.height + 20;
    //this.height = 10;
    repaint();
    //The standard main method.
    public static void main(String[] args) {
    if ( args.length > 0 )
    System.out.println( "found arg so will use special caret." );
    if ( args[0].equals( "-1" ) )
    useSpecialCaret = 1;
    else if ( args[0].equals( "-2" ) )
    useSpecialCaret = 2;
    else
    System.out.println( "found no arg so will standard caret." );
    System.out.println( "give arg: -1 to get Stan\'s working caret" );
    System.out.println( "give arg: -2 to get another example\'s caret" );
    try
    CRTP2 = new caretPain();
         catch (Exception ex)
    System.out.println("Error creating CRTP2: " + ex);
    ex.printStackTrace();
    System.exit(0);
    CRTP2.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void windowActivated(WindowEvent e) {
    CRTP2.textPane.requestFocus();
    CRTP2.setTitle( "This is my title you" );
    CRTP2.pack();
    CRTP2.setVisible(true);

  • User-Defined Function and Context Manipulation

    Hi Mapping Gurus, I need your help.
    I have a user-defined function and one of my input parameter (c) is in a loop (EDI segment).  So one, if I execute my function I get:
    Exception:[java.lang.ArrayIndexOutOfBoundsException: 0]
    If I change the context or use the remove context node function it’s working but it’s always taking the first row in consideration since I'm using c[0] .  Here is the logic:
    String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[0]"'";
    So since c is an array [], I have tried different logic to get to the right row.
    1- I tried using another parameter (e) to pass a counter or an index to my function.  So each time it's looping, it's passing a new value to the function but I’m still getting the first row and I’m not to sure why?
    int G = Integer.parseInt(e[0]);  // e[] = My counter field
    String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
    2- I tried using a parameter stored in the container:
    String Num;
    Num = (String)getParameter(“counter”);
    if (Num == null)  G = 0;
    else
    G = Integer.parseInt(Num);
    G = G + 1;
    String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
    Num = "" + G;
    setParameter(e[0], Num);
    and I’m still getting the first one, look like it’s using a different container each time it’s looping so the Value is always the same?
    4- I created a new user-defined function with the container logic, then it’s working but I’m back to the same problem in my main function, it’s only looking at e[0] for my counter all the time.
    5- I tried using the Seeburger Java Variables and guess what in the main fonction, as new UDF,... and guess what, same result!
    So anybody out there that was able to get UDF's working into a multiple context scenario?
    Am I missing something?
    I will reward points and beer for any help!

    This is one of the text with passing a counter to the function to try to go to the right row in the array since I'm doing a remove context and I'm getting all the d_234's:
    public void ReadTable(String[] a,String[] b,String[] c,String[] d,String[] e,ResultList result,Container container){
    int G = Integer.parseInt(e[0]); // My counter
    String var;
    String DBTABLE = a[0];
    String lookUpField = d[0];
    String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
    Now this one was with the internal container logic:
    int G;
    String DBTABLE = a[0];
    String lookUpField = d[0];
    String Num;
    Num = (String)getParameter(e[0]);
    if (Num == null)  G = 0;
    else
    G = Integer.parseInt(Num);
    G = G + 1;
    Num = "" + G;
    setParameter(e[0], Num);
    String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
    And now with the Seeburger Variables:
    int G;
    try {
    VariableBean be=VariableFactory.getVariableInstance("");
    G = Integer.parseInt(String.valueOf(be.getStringVariable("yves")));
    } catch (Exception f) {
    throw new RuntimeException(f);
    String DBTABLE = a[0];
    String lookUpField = d[0];
    String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
    try {
    G = G + 1;
    Num = "" + G;
    VariableBean be=VariableFactory.getVariableInstance("");
    be.setStringVariable("yves",Num);
    catch (Exception f) {
    throw new RuntimeException(f);
    All 3 logics were returning always the first row or a counter of 1 if the logic is in the main ReadTable function.

  • Row is not deleted when check box is selected urgent please

    my problem is, i am creating number of rows dynamicaly and storing the values in the database. I do have one delete check box. if the user checked that box that row should be deleted. I am using array to return the check box values. It is working fine when there is multiple rows.. suppose if i do have only one row and trying to delete that row i am getting an exception. Please help me to solve this issue, here ismy jsp
    <%@page language="java" import="java.lang.*, java.sql.*, java.io.*,
    java.util.*"%>
    <%@ page import="DatabaseConnection"%>
    <%@ page import="AdjustmentsBean"%>
    <%@ page import="AdjustmentTransactionInfo"%>
    <%@ page import="CustomerLocationInfo"%>
    <%@ page import="EmersonGlobalConstants"%>
    <%@ page import="CallPLSQLFunc"%>
    <%@include file="Security.jsp" %>
    <%
    AdjustmentsBean adjustments = new AdjustmentsBean();
    String userName=(String)session.getAttribute("user_name");
    String divisionCode=(String)session.getAttribute("division_code");
    String divisionName=(String)session.getAttribute("division_code_name");
    if(userName==null){userName="";}
    if(divisionCode==null){divisionCode="";}
    if(divisionName==null){divisionName="";}
    GregorianCalendar calendar = (GregorianCalendar)Calendar.getInstance();
    CallPLSQLFunc callPLSQLFunc = new CallPLSQLFunc();
    Vector months = callPLSQLFunc.getMonths(divisionCode);
    String cMonth = callPLSQLFunc.getCurrentMonth(divisionCode);
    System.out.println("%%%%%%%%%" +months);
    //int mm = calendar.get(Calendar.MONTH) + 1;
    //int yyyy = calendar.get(Calendar.YEAR);
    if(months ==null){
    months=new Vector();
    int mmst=0;
    int yyst=0;
    if(months.size()>=1){
    //mmst=Integer.parseInt(new String(((String)months.get(0)).charAt(0)));
    mmst=Integer.parseInt(String.valueOf(((String)months.get(0)).charAt(0)));
    yyst=Integer.parseInt(((String)months.get(0)).substring(3,6));
    StringTokenizer token1 = new StringTokenizer(cMonth,"-");
    yyst=Integer.parseInt(token1.nextToken());
    mmst=Integer.parseInt(token1.nextToken());
    int ddst = Integer.parseInt(token1.nextToken());
    String currentDate= (mmst<10?"0"+mmst:mmst+"") + "/" + yyst;
    System.out.println("The current date is" + currentDate);
    String slectedMonth = request.getParameter("selectedMonth");
    String selectedDate=currentDate;
    if(slectedMonth != null && slectedMonth.trim().length()>0){
    selectedDate=slectedMonth;
    boolean modifyAllowed=false;
    if(selectedDate.equalsIgnoreCase(currentDate)){
    modifyAllowed=true;
    String admin=(String)session.getAttribute("admin");
    if(admin==null){admin="false";}
    if(admin.equalsIgnoreCase("true") ){
    modifyAllowed=true;
    %>
    <%
    Vector transactions = adjustments.getTransactionsOfMonth(selectedDate,divisionCode);
    Vector customers = adjustments.getAllCustomers();
    System.out.println("customers : "+customers.size());
    %>
    <html>
    <head>
    <script>
    var modifyAllowed;
    if(<%=modifyAllowed%> == true){
    modifyAllowed = '';
    }else{
    modifyAllowed = 'disabled';
    var EAS_Cust_Loc_Num_Key = new Array(<%=customers.size()%>);
    var EAS_Cust_Num_Key = new Array(<%=customers.size()%>);
    var EAS_Cust_Num = new Array(<%=customers.size()%>);
    var EAS_Cust_Name = new Array(<%=customers.size()%>);
    var customerWiseLocationNumKey = new Array(<%=customers.size()%>);
    var customerWiseLocationName = new Array(<%=customers.size()%>);
    <%
    for(int i=0;i<customers.size();i++){
    CustomerLocationInfo cl = (CustomerLocationInfo)customers.get(i);
    %>
    EAS_Cust_Loc_Num_Key[<%=i%>] = "<%=cl.getEAS_Cust_Loc_Num_Key()%>";
    EAS_Cust_Num_Key[<%=i%>] = "<%=cl.getEAS_Cust_Num_Key()%>";
    EAS_Cust_Num[<%=i%>] = "<%=cl.getEAS_Cust_Num()%>";
    EAS_Cust_Name[<%=i%>] = "<%=cl.getEAS_Cust_Name()%>";
    var locationNumKey = new Array(<%=cl.getLocations().size()%>);
    var locationName = new Array(<%=cl.getLocations().size()%>);
    <%
    int j=0;
    Enumeration enum = cl.getLocations().keys();
    while(enum.hasMoreElements()){
    String s = (String)enum.nextElement();
    String name = (String)cl.getLocations().get(s);
    %>
    locationNumKey[<%=j%>]="<%=s%>";
    locationName[<%=j%>]="<%=name%>";
    <%
    j=j+1;
    %>
    customerWiseLocationNumKey[<%=i%>] = locationNumKey;
    customerWiseLocationName[<%=i%>] = locationName;
    <%
    %>
    function changeMonth(){
    window.document.adjustmentForm.action="Adjustments.jsp";
    adjustmentForm.submit();
    function populateLocation(id){
    var table = document.getElementById('myTable');
    var rows = table.rows.length-2;
    var theForm = document.forms[0];
    var wRow = theForm["location"];
    var wCustRow = theForm["customer"];
    var len;
    var locobj ;
    var custobj ;
    if(rows ==1){
    locobj =wRow;
    }else{
    locobj =wRow[id];
    if(rows ==1){
    custobj =wCustRow;
    }else{
    custobj =wCustRow[id];
    len = locobj.options.length;
    locobj.selectedIndex=0;
    for(z=0;z<len;++z){
    locobj.options[z] = null;
    locobj.options.length=0;
    locobj.options[0] = new Option("Select Any Location");
    var cIndex = custobj.selectedIndex;
    if(cIndex !=0){
    for(i=1;i<=customerWiseLocationName[cIndex-1].length;i++){
    locobj.options = new Option(customerWiseLocationName[cIndex-1][i-1],customerWiseLocationNumKey[cIndex-1][i-1]);
    function addRow(id){
    var table = document.getElementById(id);
    var sHTML = new Array() ;
    var cus = "<select name=customer onChange='javascript:populateLocation("+(table.rows.length-2)+")'"+modifyAllowed+"><OPTION VALUE=''>Select Any Customer</OPTION>";
    var options;
    for(i=0;i<EAS_Cust_Num.length;i++){
    options = options+"<OPTION VALUE='" + EAS_Cust_Num +"'>" + EAS_Cust_Name + "</OPTION>";
    cus=cus+options+"</select>";
    sHTML[0] = "<input type=checkbox name=chk "+modifyAllowed+" onClick=changedisable("+(table.rows.length-2)+")><input type=hidden name=adid value='' ><input type=hidden name=isdelete value='false'>";
    sHTML[1] = cus;
    sHTML[2] = "<select name='location'"+modifyAllowed+"><OPTION VALUE=''>Select Any Location</OPTION>";
    sHTML[3] = "<input type=text size=10 maxlength=40 name=sku"+modifyAllowed+"> <input type=button value=Search onClick=window.open('SearchSKU.jsp?cnt="+(table.rows.length-2)+"','SearchSKU','width=350,height=350,top=150,left=150,scrollbars=yes')>";
    sHTML[6] = "<input type=hidden name=shipnotbilled "+modifyAllowed+" onClick=changeisshipnotbilled("+(table.rows.length-2)+")><input type=hidden name=isshipnotbilled value='false'>";
    sHTML[4] = "<input type=text size=10 maxlength=40 name=units "+modifyAllowed+">";
    sHTML[5] = "<input type=text size=10 maxlength=40 name=amount "+modifyAllowed+">";
    var newRow = table.insertRow(-1);
    var sHTMLIndex = sHTML.length ;
    for(i=0;i<sHTMLIndex;i++) {
    var newCellSelect = newRow.insertCell(-1);
    newCellSelect.innerHTML = sHTML;
    function validate(){
    var table = document.getElementById('myTable');
    var theForm = document.forms[0];
    var wRow = theForm["amount"];
    var custRow = theForm["customer"];
    var locRow = theForm["location"];
    var quantityRow = theForm["units"];
    var count = table.rows.length;
    var rows = table.rows.length-2;
    var obj;
    if(rows==1){ //only one row..
    if(wRow.value==""){
    alert("Amount field is mandatory. Please fill in amount");
    return false;
    if(custRow.selectedIndex==0){
    alert("Customer is mandatory. Please select the customer");
    return false;
    if(locRow.selectedIndex==0){
    alert("Location is mandatory. Please select the location");
    return false;
    if(! isAmount(wRow.value) ){
    alert("Amount is numeric. Please enter numeric value for amount");
    return false;
    if(!isQuantity(quantityRow.value)){
    alert("Quantity is numeric. Please enter numeric value for quantity");
    return false;
    }else{ //this means more than one rows..
    for(i=0;i<count-2;i++){
    if(wRow.value==""){
    alert("Amount field is mandatory. Please fill in amount for transaction no "+(i+1));
    return false;
    if(wRow.value== 0){
    alert("Please fill non zero value for Amount "+(i+1));
    return false;
    if(custRow.selectedIndex==0){
    alert("Customer is mandatory. Please select the customer for transaction no "+(i+1));
    return false;
    if(locRow.selectedIndex==0){
    alert("Location is mandatory. Please select the location for transaction no "+(i+1));
    return false;
    if(! isAmount(wRow.value) ){
    alert("Amount is numeric. Please enter numeric value for amount of transaction no "+(i+1));
    return false;
    if(!isQuantity(quantityRow.value)){
    alert("Quantity is numeric. Please enter numeric value for quantity of transaction no "+(i+1));
    return false;
    if(quantityRow.value== 0){
    alert("Please fill non zero value for Units "+(i+1));
    return false;
    return true;
    function isQuantity(value){
    for (k=0;k<value.length;k++){
    if(k==0){
    if(!(value.charAt(k)>=0 && value.charAt(k)<=9) ){
    if(value.charAt(k)!='-'){
    break;
    }else{
    if(!(value.charAt(k)>=0 && value.charAt(k)<=9)){
    break;
    if(k == value.length){
    return true;
    }else{
    return false;
    function isAmount(value){
    for (k=0;k<value.length;k++){
    if(k==0){
    if(!(value.charAt(k)>=0 && value.charAt(k)<=9) ){
    if(value.charAt(k)!='-'){
    break;
    }else{
    if((!(value.charAt(k)>=0 && value.charAt(k)<=9)) ){
    if(value.charAt(k) !='.'){
    break;
    if(k == value.length){
    return true;
    }else{
    return false;
    function changedisable(index){
    if(document.adjustmentForm.chk[index].checked){
    document.adjustmentForm.isdelete[index].value='true';
    }else{
    document.adjustmentForm.isdelete[index].value='false';
    function changeisshipnotbilled(index){
    if(document.adjustmentForm.shipnotbilled[index].checked){
    document.adjustmentForm.isshipnotbilled[index].value='true';
    }else{
    document.adjustmentForm.isshipnotbilled[index].value='false';
    function backtoHome(){
    window.document.adjustmentForm.action="Welcome.jsp";
    adjustmentForm.submit();
    function setData(cnt,num){
    var table = document.getElementById('myTable');
    var rows = table.rows.length-2;
    if(rows==1){
    window.document.adjustmentForm.sku.value=num;
    }else{
    window.document.adjustmentForm.sku[cnt].value=num;
    </script>
    <link rel="stylesheet" type="text/css" href="main.css" />
    <%= EmersonGlobalConstants.TITLE %>
    </head>
    <body class="trAppId1" alink="blue" vlink="blue" link="blue">
    <form name="adjustmentForm" method="get" action="AdjustmentServlet"
    target="display">
    <center>
    <br>
    Manual Sales Application
    <br>User Name: <%=userName%>, Division Code: <%=divisionCode%>,
    Division Name: <%=divisionName%>
    <br>
    <br><br><br>
    <b>Date: </b>
    <Select name="selectedMonth" onChange="javascript:return changeMonth();">
    <%
    for(int i=0;i<months.size();i++){
    String mon = (String)months.get(i);
    System.out.println("mon *********** : "+mon);
    //mmst=Integer.parseInt(new String(((String)months.get(i)).charAt(0)));
    mmst=Integer.parseInt(String.valueOf(((String)months.get(i)).charAt(0)));
    yyst=Integer.parseInt(((String)months.get(i)).substring(3,6));
    out.println("<option value='"+ (mmst<10?"0"+mmst:mmst+"") + "/" + yyst+"' "+(selectedDate.equalsIgnoreCase((mmst<10?"0"+mmst:mmst+"") + "/" + yyst)?"selected":"") +">"+getMonth(mmst) + ", " + yyst+"</option>");
    for(int i=0;i<months.size();i++){
    String mon = (String)months.get(i);
    StringTokenizer token = new StringTokenizer(mon,"/");
    String mmm= token.nextToken();
    String yyy= token.nextToken();
    System.out.println("mon *********** : "+mon);
    mmst=Integer.parseInt(mmm);
    yyst=Integer.parseInt(yyy);
    System.out.println("selectedDate**** "+selectedDate);
    out.println("<option value='"+ (mmst<10?"0"+mmst:mmst+"") + "/" + yyst+"' "+(selectedDate.equalsIgnoreCase((mmst<10?"0"+mmst:mmst+"") + "/" + yyst)?"selected":"") +">"+getMonth(mmst) + ", " + yyst+"</option>");
    %>
    </select>
    <br><br>
    </center>
    <table id="myTable" class="tableForm" border="1" cellpadding="1" cellspacing="1" width="100%" align="center">
    <tr class="trFormHead"><td colspan="7"> Adjustment Transactions</td></tr>
    <tr>
    <td width = 2%><b>Delete</b></td>
    <td width = 25% align=center><b>Customer<font color=red> *</font></td>
    <td width = 25% align=center><b>Location<font color=red> *</font></td>
    <td width = 20% align=center><b>SKU<font color=red> *</font></td>
    <!-- <td width = 5% align=center><b>SNB</td> -->
    <td width = 9% align=center><b>Units<font color=red> *</font></td>
    <td width = 9% align=center><b>Amount<font color=red> *</font></td>
    </tr>
    <%
    int index=0;
    AdjustmentTransactionInfo transacrionInfo;
    for(;index<transactions.size();index++){
    transacrionInfo = (AdjustmentTransactionInfo)transactions.get(index);
    %>
    <input type=hidden name=adid value='<%=transacrionInfo.getAdjustmentId()%>' >
    <TR>
    <td><input type=checkbox name=chk <%=modifyAllowed?"":"disabled"%> onClick=changedisable(<%=index%>) >
    <input type=hidden name=isdelete value='false'></td>
    <td >
    <select name=customer <%=modifyAllowed?"":"disabled"%> onChange='javascript:populateLocation(<%=index%>)' >
    <OPTION VALUE="">Select Any Customer</OPTION>
    <%
    for(int i=0;i<customers.size();i++){
    CustomerLocationInfo cl =(CustomerLocationInfo)customers.get(i);
    //this is done considering that EASCustLocNum of transaction is same as EAS_Cust_Loc_Num_Key of customer table.
    String selected = cl.getLocations().containsKey(transacrionInfo.getEASCustLocNum())?"selected":"";
    out.println ("<OPTION VALUE='" + cl.getEAS_Cust_Num() + "'"+selected+">" + cl.getEAS_Cust_Name() + "</OPTION>");
    %>
    </select>
    </td>
    <td>
    <select name="location" <%=modifyAllowed?"":"disabled"%> >
    <OPTION VALUE="">Select Any Location</OPTION>
    <%
    for(int i=0;i<customers.size();i++){
    CustomerLocationInfo cl = (CustomerLocationInfo)customers.get(i);
    if(cl.getLocations().containsKey(transacrionInfo.getEASCustLocNum())){
    Hashtable locations = cl.getLocations();
    Enumeration enum = locations.keys();
    while(enum.hasMoreElements()){
    String key =(String)enum.nextElement();
    out.println ("<OPTION VALUE='" + key +"'"+(key.equalsIgnoreCase(transacrionInfo.getEASCustLocNum())?"selected":"")+">"+ locations.get(key) + "</OPTION>");
    %>
    </select>
    </td>
    <td>
    <script>
    function openURL(URL,windowName){
    </script>
    <input type=text size=10 maxlength=40 name=sku value="<%=transacrionInfo.getProductionSKUNum()%>"<%=modifyAllowed?"":"disabled"%> >
    <input type=button value="Search"onclick="javascript:window.open('SearchSKU.jsp?cnt=<%=index%>', 'SearchSKU', 'width=350,height=350,top=150,left=150,scrollbars=yes');">
    </td>
    <!--
    <td>
    <input type="checkbox" name="shipnotbilled" <%=transacrionInfo.getShipNotBilled()?"checked":""%><%=modifyAllowed?"":"disabled"%> onClick=changeisshipnotbilled(<%=index%>)><input type=hidden name=isshipnotbilled value='<%=transacrionInfo.getShipNotBilled()?"true":"false"%>'>
    </td>
    -->
    <input type=hidden name="shipnotbilled" <%=transacrionInfo.getShipNotBilled()?"checked":""%> <%=modifyAllowed?"":"disabled"%> onClick=changeisshipnotbilled(<%=index%>) ><input type=hidden name=isshipnotbilled value='<%=transacrionInfo.getShipNotBilled()?"true":"false"%>'>
    <td>
    <input type="text" size="10" name="units" value="<%=transacrionInfo.getAdjustmentQty()%>"<%=modifyAllowed?"":"disabled"%> >
    </td>
    <td>
    <input type="text" size="10" name="amount" value="<%=transacrionInfo.getAdjustmentAmt()%>" <%=modifyAllowed?"":"disabled"%> >
    </td>
    </tr>
    <%
    /*if(transactions== null || transactions.size()==0){
    out.println ("<tr><td></td><td colspan=6 align =
    center><b> Transactions not available</b></td></tr>");
    %>
    </Table>
    <br>
    <br>
    <%
    if(modifyAllowed){
    %>
    <b>AddTransaction</b>
    <br><b>Transactions marked will be deleted on submit</b>
    <br>
    <b>Fields marked with <font color=red>*</font> are mandatory.</b>
    <%
    %>
    <center>
    <br>
    <%
    if(modifyAllowed){
    %>
    <input type=submit value="Submit Form!" onClick='javascript:return validate()'>
    <%
    }else{
    %>
    <input type=button value="Back to Home Page" onClick='javascript:backtoHome()'>
    <%
    %>
    </center>
    </form>
    <br><hr>
    </body>
    </html>
    <%!
    String getMonth(int month){
    switch(month){
    case 1:
    return "JAN";
    case 2:
    return "FEB";
    case 3:
    return "MAR";
    case 4:
    return "APR";
    case 5:
    return "MAY";
    case 6:
    return "JUN";
    case 7:
    return "JUL";
    case 8:
    return "AUG";
    case 9:
    return "SEP";
    case 10:
    return "OCT";
    case 11:
    return "NOV";
    case 12:
    return "DEC";
    return "JAN";
    %>

    I haven't read your code, but can make a guess at what's going wrong. Checkboxes do behave in a weird manner depending upon whether you have selected one or many.
    Assuming this is the statement where you are generating the checkbox :
    <input type="checkbox" name="checkBoxName" value="<%= someValue %>">
    What you could do is read the checked checkBoxes in an array :
    String[] values = request.getParameterValues("checkBoxName");
    int sizeOfValues = values.length;
    Then use the sizeOfValues to perform your delete action :
    if (sizeOfValues==1)
         performDelete();
    else
         for (int i=0; i<sizeOfValues(); i++)
              performDelete();
    Hope this technique works.

  • PLEASE HELP ME!!! java.lang.IllegalStateException

    I need Help, im encountering this Exception and i dont know what to do, can any Help me to resolve this problem.... Any help is greatly appreciated
    /HERE'S MY CODE-----------------------------------------
    String fileName = "Sample";
    System.out.println("Download Word Document");
    System.out.println(session.getAttribute("data"));
    // set the header details
    int id = Integer.parseInt(String.valueOf(session.getAttribute("data")));
    System.out.println("ID is: " + id);
    try {//set the header details
    ph.gov.da.finalstandards.daos.DAOFacade.file(id);
    response.setContentType("application/msword");
    //response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    //set the content type to related file
    javax.servlet.ServletOutputStream o = response.getOutputStream();
    InputStream inStream = new BufferedInputStream(new FileInputStream(
    "c:\\tempWordOutput.doc"));
    // set buffer size. Each attempt to read the file will use
    // specified number of bytes
    byte[] buf = new byte[4 * 1024];
    int bytesRead = 0;
    while ((bytesRead = inStream.read(buf)) != -1) {
    o.write(buf, 0, bytesRead);
    o.write(id);
    o.flush();
    o.close();
    } catch (Exception e) {
    e.printStackTrace();
    %>
    [4/20/07 9:26:13:265 CST] 7f007f0 SystemErr R java.lang.IllegalStateException
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at java.lang.Throwable. (Throwable.java)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.impl.PortletResponseImpl.setHeader(PortletResponseImpl.java:475)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at org.apache.jsp._finalPage._jspService(finalPage.jsp :63)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:531 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:546 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1030)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.struts.base.BaseImplUtil.include(BaseImplUtil.java:1229)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsUtil.include(WpsStrutsUtil.java:1888)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsViewJspCommand.includeURL(WpsStrutsViewJspCommand.java:170)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsViewJspCommand.execute(WpsStrutsViewJspCommand.java:145)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsUtil.executeCommand(WpsStrutsUtil.java:1223)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsUtil.executeCommand(WpsStrutsUtil.java:1141)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsUtil.executeSavedCommand(WpsStrutsUtil.java:1067)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsPortlet.doService(WpsStrutsPortlet.java:1121)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.portlets.struts.WpsStrutsPortlet.doView(WpsStrutsPortlet.java:1162)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.PortletAdapter.service(PortletAdapter.java:154)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.Portlet._dispatch(Portlet.java:744)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.Portlet.access$100(Portlet.java:88)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.Portlet$Context.callPortlet(Portlet.java:899)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.cmpf.impl.PortletFilterManager.doFilter(PortletFilterManager.java:253)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.Portlet.dispatch(Portlet.java:636)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.Portlet.doGet(Portlet.java:510)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.cache.CacheablePortlet.service(CacheablePortlet.java:352)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at org.apache.jetspeed.portlet.Portlet.service(Portlet.java:491)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:562 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1030)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletInvokerImpl.callMethod(PortletInvokerImpl.java:466)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletInvokerImpl.render(PortletInvokerImpl.java:135)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.PortletContainerImpl.callPortletMethod(PortletContainerImpl.java:1378)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.legacy.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:386)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.PortletContainerImpl.doRenderPortlet(PortletContainerImpl.java:428)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:102)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.pe.pc.PortletContainer.renderPortlet(PortletContainer.java:95)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.PortletHolder.render(PortletHolder.java:87)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.tags.PortletRenderTag.doStartTag(PortletRenderTag.java:151)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at org.apache.jsp._Control._jspService(Control.jsp :176)
    [4/20/07 9:26:13:578 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1025)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.skins.Default.render(Default.java:70)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:75)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.elements.Component.render(Component.java:906)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.elements.Control.render(Control.java:210)
    [4/20/07 9:26:13:593 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.Composition.render(Composition.java:2747)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at org.apache.jsp._UnlayeredContainer_2D_V._jspService(UnlayeredContainer-V.jsp :12)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1025)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:625 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.skins.Default.render(Default.java:70)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:75)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.elements.Component.render(Component.java:906)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.elements.SingleEntryContainer.render(SingleEntryContainer.java:207)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.tags.CompositionRenderTag.doStartTag(CompositionRenderTag.java:318)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at org.apache.jsp._LayeredContainer._jspService(LayeredContainer.jsp :176)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1025)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.skins.Default.render(Default.java:70)
    [4/20/07 9:26:13:640 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:75)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.elements.Component.render(Component.java:906)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.composition.elements.SingleEntryContainer.render(SingleEntryContainer.java:207)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.tags.CompositionRenderTag.doStartTag(CompositionRenderTag.java:318)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at org.apache.jsp._Home._jspService(Home.jsp :2)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1025)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.screens.Default.render(Default.java:73)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.ScreenTemplate.render(ScreenTemplate.java:64)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.tags.ScreenRenderTag.doStartTag(ScreenRenderTag.java:69)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at org.apache.jsp._Default._jspService(Default.jsp :572)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:656 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:700)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:798)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1025)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:251)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:89)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:50)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:44)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.themes.Default.render(Default.java:129)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.templates.ThemeTemplate.render(ThemeTemplate.java:71)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:817)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.wps.engine.Servlet.doGet(Servlet.java:484)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/20/07 9:26:13:671 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
    [4/20/07 9:26:13:687 CST] 7f007f0 SystemErr R at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:186)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1021)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:566)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:198)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:80)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:214)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java)
    [4/20/07 9:26:13:703 CST] 7f007f0 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)

    Regarding with downloading of file, do i need to use apache's HWPF to generate Word File???

  • Problems with binary files

    Hello everybody!
    I'm having deep trouble with reading from binary files.
    I have opened a DataInputStream with a FileInputStream to read the data (which consists of a lot of short-Variables) into my program.
    Then I wondered why the data read is always wrong, until I discovered the core of the problem yesterday night. It seems as if Java reads everything correct, but the 16bit unsigned int data from the file has a problem.
    It seems as if the second byte is written first, that means i.e. the decimal 2352 (Hex: 09 30) is written 30 09, and that wreaks havoc upon my program, because Java interprets this as dec 12297.
    Now I have the following questions:
    1. Is this a kind of one- or two-complement problem?
    2. Is it possible to read this in a byte array (yes), and convert this byte array afterwards into a short variable?
    3. Is it possible to read this kind of data with a Java class?
    Thank you very much in advance,
    Hans Munzel

    Thank you for your quick reply!
    I already thought that this is the right way to solve this. Now I have already looked it up:
    - I have found no class that is able to transform a byte array into a basic data type.
    - The class Integer is able to convert int variables into a Hex string, making it possible to concatenate the Strings in the correct order and convert it.
    - The class Byte is unfortunately NOT able to do this.
    So, I have tried to make a conversion via combinations of toString(), decode(), and parseInt() (and a lot of other methods, too), but this is a) very complicated and b) prone to errors which result normally in a fatal exception.
    So, am I missing something? I am using JDK 1.3.1, and have looked through the java.lang and java.math packages, but I found nothing I can use.
    The only thing close to converting a couple of bytes to a Java datatype is the DataInputStream with its readShort() etc. methods, but is is causing the problem in the first place ...

  • Getting a character at a given index in a String and returing as a String

    Hello,
    How do I simply grab one character in a string and return it as a string? I saw the substring() method but it does not like when I invoke:
    String test = "abcd";
    test = test.substring(0,0);
    **Above produces a runetime error. ***I need something that does this:
    String test = "abcd"
    test.needtodo(0) returns String "a".
    test.needtodo(1) returns String "b".
    ETC.
    ---- Thanks for the help.

    Ok I used Kaj's method, but what I am trying to do still inst working properly. Here is what I am trying to do:
    public String stringToBinaryStringWithLeadingZeroz(String input) {
         String binaryString="";
         int sizeOf = input.length();
         for(int i=0; i < sizeOf; i++)
              int intRepresentation = Integer.parseInt(String.valueOf(input.charAt(i)), 16);
              binaryString += Integer.toBinaryString(intRepresentation);
         return binaryString;
    }I am trying to take in a String that is Hex and return a string that is binary with leading zeros.
    So if the input is: stringToBinaryStringWithLeadingZeroz("3");
    It should be returning 0011 but its still only returning 11. It shouldnt be returning 0011 though. I am passing each character indivudally into the method toBinaryString() which just returns the result and appends onto the result.
    ** SCRATCHING MY HEAD **

  • Application startup at the center of the screen

    Is there any method in the Java API that will startup a window at the center of the screen?
    Is not, how do I get the desktop resolutions?
    Thanks in advance.

    JFrame frame = new JFrame("Hey, I'm a JFrame") ;
    Rectangle rect = new Rectangle(600, 400) ;
    frame.setBounds(rect) ;
    Dimension screen = Toolkit.DefaultToolkit().getScreenDimension() ;
    int xPos = Integer.parseInt(String.valueOf(Math.round((screen.getWidth() - frame.getWidth())/2))) ;
    int yPos = Integer.parseInt(String.valueOf(Math.round((screen.getHeight() - frame.getHeight())/2))) ;
    frame.setLocation(xPos, yPos) ;There you go ...

  • Signing applets/ access controll violations

    I have just created a fairly simple game (much like that marble jumping solitare game), that is nice, fine, and works. But, however I run it in applet viewer, which automaticly gives it full power and stuff. If i try to run it in it's webpage, it says that it is not allowed to access the reasource default.txt (the default map file). How can I make it run in a webpage? Would it run on a server? Would it run on a completely seperate folder on a person's computer (aka family)? Can I use other files destributed later for new maps(withough more steps, just read the plain text file--It has the ablity to customise the file loaded)?
    To sum it up: can I give something to my mum, so that she can click a shortcut and have it just work?

    thawte? I haven't herd of it.
    also: this is the code that reads the file:
    public void resetBoard() {
      try {
       theFileReader = new FileReader(fileName);
       theReader = new BufferedReader(theFileReader);
       String temp;
       for(int i = 0; i<X_BOXES; i++) {
        temp = theReader.readLine();
        for(int j = 0; j<Y_BOXES; j++) {
         if(temp.charAt(j) == ' ') {
          board[j] = -1;
    } else {
    board[j][i] = Integer.parseInt(String.valueOf(temp.charAt(j)));
    } catch(Exception e) {
    System.out.println(e);
    by the way, theFile can be changed, to load other files

  • Incompatible type error

    I am receiving the following errors:
    incompatible types
    found: int
    required: boolean
    if (accessCode = 8345)
    if (accessCode = 55875)
    if (accessCode = 999909)
    I do not understand why I am getting the errors. accessCode is of type int.
    Thanks in advance for any input.
    int accessCode = Integer.parseInt( String.valueOf(
      securityCodeJPasswordField.getPassword() ) );
         int code;
         if (accessCode >= 1645 && accessCode <= 1689)
             code = 1;
         else
         if (accessCode  = 8345)
                code = 2;
         else
         if (accessCode = 55875)
             code = 3;
         else
         if (accessCode = 999898)
             code = 4;
         else
         if (accessCode >= 1000006 && accessCode <= 1000008)
             code = 5;
         else
         if (accessCode < 1000)
             code = 6;
         else
                        code = accessCode;

    Thanks !! I am stuck in the coding syntax that I use in my job: SAS

  • Elevator Simulation using GUI... HELP!

    I need immediate help on how to make the elevator move from floor to floor... this is not using java applet... I'll paste the program that I have done so far... I don't know how to use timers and listeners in order to make the Elevator move.... Wat should I do...
    Here is my program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //The main class
    public class Elevator_Simulation extends JFrame
         public JLabel state; // display the state of the elevator
    private JLabel id; //your name and group
    public ButtonPanel control; //the button control panel
    private Elevator elevator; // the elevator area
    //constructor
         public Elevator_Simulation()
         // Create GUI
              setTitle("Elevator Simulation");
              getContentPane().add(new ButtonPanel(), BorderLayout.WEST);
              id = new JLabel(" Name: Abinaya Vasudevan Group:SE3");
              getContentPane().add(id, BorderLayout.NORTH);
    // Main method
    public static void main(String[] args)
         // Create a frame and display it
    Elevator_Simulation frame = new Elevator_Simulation();
    frame.setSize(800,800);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new Elevator(frame));          
              //Get the dimension of the screen
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              int x = (screenWidth - frame.getWidth())/2;
              int y = (screenHeight - frame.getHeight())/2;
              frame.setLocation(x,y);
              frame.setVisible(true);
    } //the end of Elevator_Simulation class
    //The ButtonPanel class receives and handles button pressing events
    class ButtonPanel extends JPanel implements ActionListener
         public JButton b[] = new JButton[8]; // 8 Buttons
    public boolean bp[] = new boolean[8]; // the state of each button, pressed or not
    //constructor
    public ButtonPanel()
         //create GUI
              setLayout(new GridLayout(8,1));
              for (int i=1; i<=8; i++)
                   b[8-i] = new JButton("F"+(8-(i-1)));
                   b[8-i].addActionListener(this);
                   add(b[8-i]);
    public void actionPerformed(ActionEvent e)
         //handle the button pressing events
              bp[8-((int)(e.getActionCommand().charAt(1)))] = true;
    } //the end of ButtonPanel class
    // The elevator class draws the elevator area and simulates elevator movement
    class Elevator extends JPanel implements ActionListener
         //Declaration of variables
    private Elevator_Simulation app; //the Elevator Simulation frame
    private boolean up; // the elevator is moving up or down
    private int width; // Elevator width
         private int height; // Elevator height
    private int xco;     // The x coordinate of the elevator's upper left corner
    private int yco; // The y coordinate of the elevator's upper left corner
    private int dy0; // Moving interval
    private int topy; //the y coordinate of the top level
    private int bottomy; // the y coordinate of the bottom level
    private Timer tm; //the timer to drive the elevator movement
    //other variables to be used ...
    //constructor
    public Elevator(Elevator_Simulation app)
         //necessary initialization
              tm = new Timer(1000, this);
              tm.setInitialDelay(300);
              tm.start();
    // Paint elevator area
    public void paintComponent(Graphics g)
              //obtain geometric values of components for drawing the elevator area
              xco = getWidth()/2-10;
              yco = getHeight()/2-20;
              width = 10;
              height = 20;
              //clear the painting canvas
              super.paintComponent(g);
    //start the Timer if not started elsewhere
              if(!tm.isRunning())
                   tm.start();
    //draw horizontal lines and the elevator
              g.setColor(Color.magenta);
              g.drawLine(0,0,getWidth(), 0);
              g.drawLine(0,93,getWidth(), 93);
              g.drawLine(0,186,getWidth(), 186);
              g.drawLine(0,279,getWidth(), 279);
              g.drawLine(0,372,getWidth(), 372);
              g.drawLine(0,465,getWidth(), 465);
              g.drawLine(0,558,getWidth(), 558);
              g.drawLine(0,651,getWidth(), 651);
              g.drawLine(0,744,getWidth(), 744);
              g.drawLine(0,837,getWidth(), 837);
              g.setColor(Color.black);
              g.fill3DRect(getWidth()/2 - 50, 93, 100, 93, true);
              g.setColor(Color.magenta);
              g.drawLine(getWidth()/2, 93, getWidth()/2, 186);     
    //Handle the timer events
    public void actionPerformed(ActionEvent e)
         //loop if the elevator needs to be stopped for a while
    //adjust Y coordinate to simulate elevetor movement
    //change moving direction when hits the top and bottom
    //repaint the panel
    //update the state of the elevator
    } //the end of Elevator class
    The skeleton was provided but I am still not sure how to do it... So pls help... asap....

    I've figured out the movement part... But why doesnt my variable state get set into the new String values? And how do I make it stop at the respective floors when the buttons are pressed?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //The main class
    public class Elevator_Simulation extends JFrame
         public JLabel state; // display the state of the elevator
       private JLabel id;  //your name and group
       public ButtonPanel control = new ButtonPanel(); //the button control panel
       private Elevator elevator; // the elevator area
       //constructor
         public Elevator_Simulation()
            // Create GUI
              setTitle("Elevator Simulation");
              getContentPane().add(control, BorderLayout.WEST);
              id = new JLabel("                                                                                      Name: Abinaya Vasudevan  Group:SE3");
              state = new JLabel("");
              getContentPane().add(state, BorderLayout.SOUTH);
              getContentPane().add(id, BorderLayout.NORTH);
       // Main method
       public static void main(String[] args)
            // Create a frame and display it
          Elevator_Simulation frame = new Elevator_Simulation();
          frame.setSize(800,800);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new Elevator(frame));          
                //Get the dimension of the screen
              Dimension  screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              int screenWidth = screenSize.width;
              int screenHeight = screenSize.height;
              int x = (screenWidth - frame.getWidth())/2;
              int y = (screenHeight - frame.getHeight())/2;
              frame.setLocation(x,y);
              frame.setVisible(true);       
    } //the end of Elevator_Simulation class
    //The ButtonPanel class receives and handles button pressing events
    class ButtonPanel extends JPanel implements ActionListener
         public JButton b[] = new JButton[8];  // 8 Buttons
       public boolean bp[] = new boolean[8]; // the state of each button, pressed or not
       //constructor
       public ButtonPanel()
            //create GUI
              setLayout(new GridLayout(8,1));
              for (int i=1; i<=8; i++)
                   b[8-i] = new JButton("F"+(8-(i-1)));
                   b[8-i].addActionListener(this);
                   add(b[8-i]);
              for(int j=0; j<=7; j++)
                   bp[j] = false;
       public void actionPerformed(ActionEvent e)
            int buttonNumber = Integer.parseInt(String.valueOf(e.getActionCommand().charAt(1)));
              bp[8 - buttonNumber] = true;
    } //the end of ButtonPanel class
    // The elevator class draws the elevator area and simulates elevator movement
    class Elevator extends JPanel implements ActionListener
         //Declaration of variables
       private Elevator_Simulation app; //the Elevator Simulation frame
       private boolean up; // the elevator is moving up or down
       private int width;  // Elevator width
         private int height; // Elevator height
       private int xco;     // The x coordinate of the elevator's upper left corner
       private int yco; // The y coordinate of the elevator's upper left corner
       private int dy0; // Moving interval
       private int topy; //the y coordinate of the top level
       private int bottomy; // the y coordinate of the bottom level
       private Timer tm; //the timer to drive the elevator movement
         private int offset;
         private ButtonPanel button;
       //other variables to be used ...
       //constructor
       public Elevator(Elevator_Simulation app)
            //necessary initialization
              tm = new Timer(0, this);
              tm.start();
              up = true;
              offset = 0;
       // Paint elevator area
       public void paintComponent(Graphics g)
              //obtain geometric values of components for drawing the elevator area
              width = getWidth()/8;
              height = getHeight()/8;
              xco = getWidth()/2 -50;
              yco = (height * 7) + offset;
              topy = 0;
              bottomy = height * 7;
              //clear the painting canvas
              super.paintComponent(g);
          //start the Timer if not started elsewhere
              if(!tm.isRunning())
                   tm.start();
          //draw horizontal lines and the elevator
              g.setColor(Color.magenta);
              g.drawLine(0,0,getWidth(), 0);
              g.drawLine(0,height,getWidth(), height);
              g.drawLine(0,(height*2),getWidth(), (height*2));
              g.drawLine(0,(height*3),getWidth(), (height*3));
              g.drawLine(0,(height*4),getWidth(), (height*4));
              g.drawLine(0,(height*5),getWidth(), (height*5));
              g.drawLine(0,(height*6),getWidth(), (height*6));
              g.drawLine(0,(height*7),getWidth(), (height*7));
              g.drawLine(0,(height*8),getWidth(), (height*8));
              g.setColor(Color.black);
              g.fill3DRect(xco, yco, width, height, true);
              g.setColor(Color.magenta);
              g.drawLine(xco+(width/2), yco, xco+(width/2), (yco+height));
       //Handle the timer events
       public void actionPerformed(ActionEvent e)
            //loop if the elevator needs to be stopped for a while
              //adjust Y coordinate to simulate elevetor movement
          //change moving direction when hits the top and bottom
          //repaint the panel
          //update the state of the elevator
              if(up && yco > topy)
                   offset--;
              if(!up && yco < bottomy)
                   offset++;
              if(yco == topy)
                   up = false;
                   app.state.setText("The elevator is going down");
              if(yco == bottomy)
                   up = true;
                   app.state.setText("The elevator is going up");
              repaint();          
    } //the end of Elevator class

  • WindowListener is being a pain

    I'm trying to be able to detect when the little x button is pressed:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Tictactoe  extends JPanel
                   implements WindowListener,
                           WindowFocusListener,
                           WindowStateListener
         private JButton buttons[][] = null;
         private String name1;
         private String name2;
         private boolean okToGo = false;
         private String turn = "X";
         private int turnNum = 1;
         private int rows;
         private int cols;
         private int cat = 0;
         private String series;
         private int name1wins;
         private int name2wins;
         JFrame frame;
         public Tictactoe()
              frame = new JFrame("Jacob's Tic Tac Toe");
              frame.addWindowListener(this);
              JPanel panel = new JPanel(new GridLayout(3,3));
              buttons = new JButton[3][3];
              for (int r=0; r<3; r++)
                   for (int c=0; c<3; c++)
                        buttons[r][c] = new JButton(" ");
                        buttons[r][c].setBackground(Color.black);
                        buttons[r][c].addActionListener(this);
                        buttons[r][c].setActionCommand("" +(3*r+c));
                        panel.add(buttons[r][c]);
              frame.setContentPane(panel);
              frame.pack();
              frame.setVisible(true);
              name1 = JOptionPane.showInputDialog(null, "What is Player X's name?");
              name2 = JOptionPane.showInputDialog(null, "What is Player O's name?");
              frame.setTitle("Jacob's Tic Tac Toe - " + name1 + "'s turn");
              System.out.println ("Ctrl+C quits the program if quit from x button");
              JOptionPane.showMessageDialog(null, "Please check whoose turn it is (look at the top bar)");
         public static void main (String[] args)
              Tictactoe sa = new Tictactoe();
         public void changeLabel()
              if (turn.equals("X"))
                   frame.setTitle("Jacob's Tic Tac Toe - " + name1 + "'s turn - " + series);
              else
                   frame.setTitle("Jacob's Tic Tac Toe - " + name2 + "'s turn - " + series);
         public void actionPerformed(ActionEvent e)
              String ac = e.getActionCommand();
              int decoded = Integer.parseInt(ac);
              int row = decoded / 3;
              int col = decoded % 3;
              rows = row;
              cols = col;
              okToGo = false;
              if (name1wins > name2wins)
                   series = name1 + " is winning " + name1wins + " to " + name2wins;
              else if (name1wins < name2wins)
                   series = name2 + " is winning " + name2wins + " to " + name1wins;
              else if (name1wins == name2wins)
                   series = "Tied " + name1wins + " to " + name2wins;
              if (buttons[rows][cols].getBackground() == Color.black)
                   okToGo = true;
              else
                   JOptionPane.showMessageDialog(null, "You can't go there.");
              if (okToGo == true)
                   if (turn.equals("X"))
                        buttons[rows][cols].setBackground(Color.orange);
                        buttons[rows][cols].setLabel("X");
                   else
                        buttons[rows][cols].setBackground(Color.blue);
                        buttons[rows][cols].setLabel("O");
                   if (((buttons[0][0].getLabel() == turn) && (buttons[0][1].getLabel() == turn) && (buttons[0][2].getLabel() == turn)) || ((buttons[1][0].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[1][2].getLabel() == turn)) || ((buttons[2][0].getLabel() == turn) && (buttons[2][1].getLabel() == turn) && (buttons[2][2].getLabel() == turn)) || ((buttons[0][0].getLabel() == turn) && (buttons[1][0].getLabel() == turn) && (buttons[2][0].getLabel() == turn)) || ((buttons[0][1].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[2][1].getLabel() == turn)) || ((buttons[0][2].getLabel() == turn) && (buttons[1][2].getLabel() == turn) && (buttons[2][2].getLabel() == turn)) || ((buttons[0][0].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[2][2].getLabel() == turn)) || ((buttons[0][2].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[2][0].getLabel() == turn)))
                        if (turn.equals("X"))
                             JOptionPane.showMessageDialog(null, name1 + " wins the match!!!");
                             name1wins = name1wins+1;
                             Cleanup();
                        else
                             JOptionPane.showMessageDialog(null, name2 + " wins the match!!!");
                             name2wins = name2wins+1;
                             Cleanup();
                   for (int a = 0; a<3; a++)
                        for (int b = 0; b<3; b++)
                             if (buttons[a].getBackground() != Color.black)
                                  cat++;
                                  if (cat == 9)
                                       JOptionPane.showMessageDialog(null, "Cat's Game!");
                                       Cleanup();
                   cat = 0;
                   if (turn.equals("X"))
                        turn = "O";
                        changeLabel();
                   else
                        turn = "X";
                        changeLabel();
         public void Cleanup()
              int quit;
              quit = JOptionPane.showConfirmDialog(null, "Do you want to play again?", "Do you want to play again?", JOptionPane.YES_NO_OPTION);
              if (quit == 0)
                   for (int r=0; r<3; r++)
                        for (int c=0; c<3; c++)
                             buttons[r][c].setLabel(" ");
                             buttons[r][c].setBackground(Color.black);
                   boolean okToGo = false;
                   turn = "X";
                   changeLabel();
              else
                   System.exit(0);
         public void windowClosing(WindowEvent e)
              int quitBox = JOptionPane.showConfirmDialog(null, "Quit?", "Are you sure you want to quit?", JOptionPane.YES_NO_OPTION);
              if (quitBox == 1)
                   System.exit(0);
              else
    I get two errors:
    Tictactoe.java:5: Tictactoe is not abstract and does not override abstract method windowDeactivated(java.awt.event.WidowEvent) in java.awt.event.WindowListenter
    public class Tictactoe extends JPanel
    ^
    Tictactoe.java:36: addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton cannot be applied to (Tictactoe)
    buttons[r][c].addActionListener(this);
    ^
    Note: Tictactoe.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    2 errors
    Those notes at the end are about changing the button color, it hates me for that.
    If somebody could help me that would be great.
    And, I've already looked at the WindowEventDemo tutorial code, and my importing looks the same and stuff.

    You did not implement action listener
    so this statement
    buttons[r][c].addActionListener(this);gives an error because the parameter "this" is not an action listener.
    in this case you could probably do this
    ActionListener l = new ActionListener(){
       public void actionPerformed(ActionEvent ae){
         //do stuff
    });then inside the loop you could add this listener to all of the buttons.
    buttons[r][c].addActionListener(l);

  • How to find string range

    Say i have a string array from aa0 to aa100. Now how do i write a condition to check that this string lies between aa0 to aa100. please help

    This is the code what i have typed. Its working but when i enter a value which is less then 0 and greater than 99, it still works, where as it shouldnt. Please help
        public void focusLost(FocusEvent evt) {
                    if(evt.getSource() == mytextfield) {
                  System.out.println("Inside focuslost");
                  String text = mytextfield.getText();
                  if(text.startsWith("aa")) {
                       int value;
                       try {
                            value = Integer.parseInt(String.valueOf(text.charAt(text.length() - 1)));
                       }catch(NumberFormatException nfe) {JOptionPane.showMessageDialog(null,"textfield should be \n in the range of aa0 - aa99","Test",JOptionPane.ERROR_MESSAGE);return;}
                       if(value < 0 || value > 99) {
                            System.out.println("Inside if condition");
                            JOptionPane.showMessageDialog(null,"textfield should be \n in the range of aa0 - aa99","Test",JOptionPane.ERROR_MESSAGE);
                            mytextfield.transferFocus();
                            return;
                  else {
                        JOptionPane.showMessageDialog(null,"Invalid entry","Test",JOptionPane.ERROR_MESSAGE);
                        return;
        }

  • Close Button

    I have a question about that little x box in the upper right corner of the window.
    How do you have it bring up a JOptionPane.showConfirmDialog asking if you want to quit???
    I know how to quit and everything, I just don't know what the event is when the X button is pressed.
    Thanks in advance :)

    I get an error when I even use action listener:
    game.java:5: game is not abstract and does not override abstract method windowDeactivated(java.awt.event.WindowEvent) in java.awt.event.WindowListener
    public class game extends JPanel
    ^
    1 error
    here's my code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class game extends JPanel
                implements WindowListener,
                        ActionListener
         private JButton buttons[][] = null;
         private String name1;
         private String name2;
         private boolean okToGo = false;
         private String turn = "X";
         private int turnNum = 1;
         private int rows;
         private int cols;
         private int cat = 0;
         private String series;
         private int name1wins;
         private int name2wins;
         JFrame frame;
         public game()
              frame = new JFrame("Jacob's Tic Tac Toe");
              JPanel panel = new JPanel(new GridLayout(3,3));
              buttons = new JButton[3][3];
              for (int r=0; r<3; r++)
                   for (int c=0; c<3; c++)
                        buttons[r][c] = new JButton(" ");
                        buttons[r][c].setBackground(Color.black);
                        buttons[r][c].addActionListener(this);
                        buttons[r][c].setActionCommand("" +(3*r+c));
                        panel.add(buttons[r][c]);
              frame.setContentPane(panel);
              frame.pack();
              frame.setVisible(true);
              name1 = JOptionPane.showInputDialog(null, "What is Player X's name?");
              name2 = JOptionPane.showInputDialog(null, "What is Player O's name?");
              frame.setTitle("Jacob's Tic Tac Toe - " + name1 + "'s turn");
              JOptionPane.showMessageDialog(null, "Please check whoose turn it is (look at the top bar)");
         public static void main (String[] args)
              game sa = new game();
         public void changeLabel()
              if (turn.equals("X"))
                   frame.setTitle("Jacob's Tic Tac Toe - " + name1 + "'s turn - " + series);
              else
                   frame.setTitle("Jacob's Tic Tac Toe - " + name2 + "'s turn - " + series);
         public void actionPerformed(ActionEvent e)
              String ac = e.getActionCommand();
              int decoded = Integer.parseInt(ac);
              int row = decoded / 3;
              int col = decoded % 3;
              rows = row;
              cols = col;
              okToGo = false;
              if (name1wins > name2wins)
                   series = name1 + " is winning " + name1wins + " to " + name2wins;
              else if (name1wins < name2wins)
                   series = name2 + " is winning " + name2wins + " to " + name1wins;
              else if (name1wins == name2wins)
                   series = "Tied " + name1wins + " to " + name2wins;
              if (buttons[rows][cols].getBackground() == Color.black)
                   okToGo = true;
              else
                   JOptionPane.showMessageDialog(null, "You can't go there.");
              if (okToGo == true)
                   if (turn.equals("X"))
                        buttons[rows][cols].setBackground(Color.orange);
                        buttons[rows][cols].setLabel("X");
                   else
                        buttons[rows][cols].setBackground(Color.blue);
                        buttons[rows][cols].setLabel("O");
                   if (((buttons[0][0].getLabel() == turn) && (buttons[0][1].getLabel() == turn) && (buttons[0][2].getLabel() == turn)) || ((buttons[1][0].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[1][2].getLabel() == turn)) || ((buttons[2][0].getLabel() == turn) && (buttons[2][1].getLabel() == turn) && (buttons[2][2].getLabel() == turn)) || ((buttons[0][0].getLabel() == turn) && (buttons[1][0].getLabel() == turn) && (buttons[2][0].getLabel() == turn)) || ((buttons[0][1].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[2][1].getLabel() == turn)) || ((buttons[0][2].getLabel() == turn) && (buttons[1][2].getLabel() == turn) && (buttons[2][2].getLabel() == turn)) || ((buttons[0][0].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[2][2].getLabel() == turn)) || ((buttons[0][2].getLabel() == turn) && (buttons[1][1].getLabel() == turn) && (buttons[2][0].getLabel() == turn)))
                        if (turn.equals("X"))
                             JOptionPane.showMessageDialog(null, name1 + " wins the match!!!");
                             name1wins = name1wins+1;
                             Cleanup();
                        else
                             JOptionPane.showMessageDialog(null, name2 + " wins the match!!!");
                             name2wins = name2wins+1;
                             Cleanup();
                   for (int a = 0; a<3; a++)
                        for (int b = 0; b<3; b++)
                             if (buttons[a].getBackground() != Color.black)
                                  cat++;
                                  if (cat == 9)
                                       JOptionPane.showMessageDialog(null, "Cat's Game!");
                                       Cleanup();
                   cat = 0;
                   if (turn.equals("X"))
                        turn = "O";
                        changeLabel();
                   else
                        turn = "X";
                        changeLabel();
         public void Cleanup()
              int quit;
              quit = JOptionPane.showConfirmDialog(null, "Do you want to play again?", "Do you want to play again?", JOptionPane.YES_NO_OPTION);
              if (quit == 0)
                   for (int r=0; r<3; r++)
                        for (int c=0; c<3; c++)
                             buttons[r][c].setLabel(" ");
                             buttons[r][c].setBackground(Color.black);
                   boolean okToGo = false;
                   turn = "X";
                   changeLabel();
              else
                   System.exit(0);

Maybe you are looking for