Hashtables: What on earth is wrong with the following code!?

I'm loosing my mind here:
[jdk1.4.2]
//random code...
        Hashtable threads = new Hashtable(20);
        threads.put(portNum, ipThread); //portNum is of type int
                                        //ipThread is of type ThreadX, ThreadX extends Thread
//other code...
        ThreadX t;
        t = (ThreadX)threads.get(packet.getPort());  //packet.getPort() returns an INTAnd the compiler returns this:
path>javac *.java
IPServer.java:58: cannot resolve symbol
symbol : method put (int,ThreadX)
location: class java.util.Hashtable
threads.put(destinationPort, ipThread);
^
IPServer.java:67: cannot resolve symbol
symbol : method get (int)
location: class java.util.Hashtable
t = (ThreadX)threads.get(packet.getPort());
^
2 errors
Thanks ahead of time.

From the JDK 1.4.2 documentation
"This class implements a hashtable, which maps keys to values. Any non-null object can be used as a key or as a value.
To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method. "
I assumed from that an int or double or any other primitive, which implements both the hashCode and equals method, would work.

Similar Messages

  • What's wrong with the following code?

    What's wrong with the following code?
    Circle cir1;
    double rad = cir1.radius

    The circle Object was never instantiated.
    In other words, you have set a declaring of a Circle, but it has not been created in memory yet.
    You will create it using the " = new Circle( PARAMETERS_HERE ); "
    Or some other method that returns a circle.

  • Whats wrong with the following code?

    if currencyName =( "Euros" )
              amount = amount * 1.02;
          else if currencyName =( "Yen" )
              amount = amount * 1.20;
          else if currencyName =( "Pesos" )
              amount = amount * 10;I get error that a ( is needed
    I tried the following:
    if (currencyName =( "Euros" ))
              amount = amount * 1.02;
          else if (currencyName =( "Yen" ))
              amount = amount * 1.20;
          else if (currencyName =( "Pesos" ))
              amount = amount * 10;
          }This gave me error required boolean with arrow pointing to the equals sign.

    Now it's not putting the changed number into amount (I think)
    when I run it gives me the orginal number instead of the mutilpied number.
    I must be missing something rather obvious here.
           // get dollar amount
          double amount =
            Double.parseDouble( dollarJTextField.getText() );
          // get currencty name
          String currencyName = dollarJTextField.getText() ;
          // perform currency conversion
          if (currencyName.equals( "Euros" ))
              amount*= 1.02;
          else if (currencyName.equals( "Yen" ))
              amount*= 1.20;
          else if (currencyName.equals( "Pesos" ))
              amount*= amount * 10;
          //display converted amount
          convertedJTextField.setText( String.valueOf( amount) );

  • What is wrong with the idl code generated by packager.exe?

    Hello everybody,
    I am trying to figure out what is wrong with the idl code generated by packager.exe. In the evaluation for the bug posted at http://developer.java.sun.com/developer/bugParade/bugs/4964563.html it says that the IDispatch interface is not exposed correctly and thus early binding of java objects is not possible using the current activex bridge implementation.
    As I am no idl expert I have no idea what that means. However, I managed to dig out the idl code generated by packager.exe for the following example bean:
    package test;
    public class MyBean
         protected int value;
         public MyBean()
         public void setMyValue(int _value)
              value = _value;
         public int getMyValue()
              return value;
         public MyBean getSelfReference()
              return this;
    }The corresponding idl code generated by packager.exe is
    uuid(81B0BF63-2A55-11D8-A73E-000475EBF021),
    version(1.0)
    library MyBean
    importlib("Stdole2.tlb");
    dispinterface MyBeanSource;
    dispinterface MyBeanDispatch;
    uuid(81B0BF64-2A55-11D8-A73E-000475EBF021),
    version(1.0)
    dispinterface MyBeanSource {
    properties:
    methods:
    uuid(81B0BF65-2A55-11D8-A73E-000475EBF021),
    version(1.0)
    dispinterface MyBeanDispatch {
    properties:
    [id(4097)]
    int myValue;
    methods:
    [id(32768)]
    VARIANT_BOOL equals(IDispatch* arg0);
    [id(32769)]
    IDispatch* getClass();
    [id(32770)]
    int getMyValue();
    [id(32771)]
    IDispatch* getSelfReference();
    [id(32772)]
    int hashCode();
    [id(32773)]
    void notify();
    [id(32774)]
    void notifyAll();
    [id(32775)]
    void setMyValue(int arg0);
    [id(32776)]
    BSTR toString();
    [id(32779)]
    VARIANT wait([optional] VARIANT var0, [optional] VARIANT var1);
    uuid(81B0BF62-2A55-11D8-A73E-000475EBF021),
    version(1.0)
    coclass MyBean {
    [default, source] dispinterface MyBeanSource;
    [default] dispinterface MyBeanDispatch;
    };Does anyone know what is wrong with this code and maybe how to fix the idl code? Generating the dll should then be easy (I already tried several variations of the idl code but as my idl knowledge is limited it didn't really do what I wanted).

    Then the question is why it does work with visual controls (even if you set them to non-visible)?

  • What's wrong with the following result_cache hint?

    Dear all,
    I try to use result_cache hint in the following sql aggregate function statement, but the explain plan doesn't show any difference between non-result_cached and with result_cached:
    SQL> set autot on explain stat
    SQL> select account_mgr_id,count(*) from customers group by account_mgr_id;
    ACCOUNT_MGR_ID      COUNT(*)
            147            76
            149            74
            148            58
            145           111
    Execution Plan
    Plan hash value: 1577413243
    | Id  | Operation        | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |            |     4 |    16 |     6     (17)| 00:00:01 |
    |   1 |  HASH GROUP BY        |            |     4 |    16 |     6     (17)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| CUSTOMERS |   319 |  1276 |     5      (0)| 00:00:01 |
    Statistics
           0  recursive calls
           0  db block gets
          16  consistent gets
           0  physical reads
           0  redo size
         689  bytes sent via SQL*Net to client
         524  bytes received via SQL*Net from client
           2  SQL*Net roundtrips to/from client
           0  sorts (memory)
           0  sorts (disk)
           4  rows processed
    SQL> select /*+ result_cache */ account_mgr_id,count(*) from customers group by account_mgr_id;
    ACCOUNT_MGR_ID      COUNT(*)
            147            76
            149            74
            148            58
            145           111
    Execution Plan
    Plan hash value: 1577413243
    | Id  | Operation         | Name                | Rows  | Bytes | Cost (%CPU)| Time      |
    |   0 | SELECT STATEMENT    |                     |     4 |    16 |     6  (17)| 00:00:01 |
    |   1 |  RESULT CACHE         | 3s3bugtq0p5bm71mhmqvvw0x7y |      |      |           |       |
    |   2 |   HASH GROUP BY     |                     |     4 |    16 |     6  (17)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| CUSTOMERS            |   319 |  1276 |     5   (0)| 00:00:01 |
    Result Cache Information (identified by operation id):
       1 - column-count=2; dependencies=(OE.CUSTOMERS); name="select /*+ result_cache */ account_mgr_id,
    count(*) from customers group by account_mgr_id"
    Statistics
           1  recursive calls
           0  db block gets
          16  consistent gets
           0  physical reads
           0  redo size
         689  bytes sent via SQL*Net to client
         524  bytes received via SQL*Net from client
           2  SQL*Net roundtrips to/from client
           0  sorts (memory)
           0  sorts (disk)
           4  rows processedAnything wrong with the hint?
    Best regards,
    Val

    Two executions required to benefit from result cache (two executions of the statement with the result cache hint).
    First to populate, Second to benefit.
    Can offer good benefits particularly with poor code - e.g. functions in SQL, row-by-row function calls, etc.
    Optimal solution may be to refactor to more efficient approach.
    But result cache can deliver significant short term tactical gain.
    Not a no-brainer though.
    There were scalability issues with a single latch protecting the result cache - I believe this has changed in 11gR2.
    There are also issues with concurrent executions were the result needs to be recalculated and takes x time to regenerate that result.
    See http://uhesse.wordpress.com/2009/11/27/result-cache-another-brilliant-11g-new-feature/#comment-216
    SQL> drop table t1;
    Table dropped.
    SQL>
    SQL> create table t1
      2  as
      3  select rownum col1
      4  from   dual
      5  connect by rownum <= 100000;
    Table created.
    SQL> set autotrace traceonly explain statistics
    SQL> select col1
      2  from   t1
      3  where  col1 >= 99997;
    Execution Plan
    Plan hash value: 3617692013
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |    10 |   130 |    58   (9)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| T1   |    10 |   130 |    58   (9)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("COL1">=99997)
    Note
       - dynamic sampling used for this statement (level=4)
    Statistics
             10  recursive calls
              0  db block gets
            220  consistent gets
            153  physical reads
              0  redo size
            379  bytes sent via SQL*Net to client
            334  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              4  rows processed
    SQL> select col1
      2  from   t1
      3  where  col1 >= 99997;
    Execution Plan
    Plan hash value: 3617692013
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |    10 |   130 |    58   (9)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| T1   |    10 |   130 |    58   (9)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("COL1">=99997)
    Note
       - dynamic sampling used for this statement (level=4)
    Statistics
              0  recursive calls
              0  db block gets
            158  consistent gets
              0  physical reads
              0  redo size
            379  bytes sent via SQL*Net to client
            334  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              4  rows processed
    SQL>
    SQL>
    SQL> select /*+ result_cache */ col1
      2  from   t1
      3  where  col1 >= 99997;
    Execution Plan
    Plan hash value: 3617692013
    | Id  | Operation          | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                            |    10 |   130 |    58   (9)| 00:00:01 |
    |   1 |  RESULT CACHE      | 4p777jcbdgjm25xy3502ypdb5r |       |       |            |          |
    |*  2 |   TABLE ACCESS FULL| T1                         |    10 |   130 |    58   (9)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter("COL1">=99997)
    Result Cache Information (identified by operation id):
       1 - column-count=1; dependencies=(RIMS.T1); name="select /*+ result_cache */ col1
    from   t1
    where  col1 >= 99997"
    Note
       - dynamic sampling used for this statement (level=4)
    Statistics
              4  recursive calls
              0  db block gets
            216  consistent gets
              0  physical reads
              0  redo size
            379  bytes sent via SQL*Net to client
            334  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              4  rows processed
    SQL>
    SQL>
    SQL> select /*+ result_cache */ col1
      2  from   t1
      3  where  col1 >= 99997;
    Execution Plan
    Plan hash value: 3617692013
    | Id  | Operation          | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                            |    10 |   130 |    58   (9)| 00:00:01 |
    |   1 |  RESULT CACHE      | 4p777jcbdgjm25xy3502ypdb5r |       |       |            |          |
    |*  2 |   TABLE ACCESS FULL| T1                         |    10 |   130 |    58   (9)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter("COL1">=99997)
    Result Cache Information (identified by operation id):
       1 - column-count=1; dependencies=(RIMS.T1); name="select /*+ result_cache */ col1
    from   t1
    where  col1 >= 99997"
    Note
       - dynamic sampling used for this statement (level=4)
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            379  bytes sent via SQL*Net to client
            334  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              4  rows processed
    SQL>

  • What am I doing wrong with the _ visibility property?

    I have an object that is a movie clip, and I want this object to disappear when you click on him, but also the button that makes the object to appear to make also the object to disappear.Either way, when you click on the object or on the button the second time, the same object to disappear.  I managed to do that, but the first time when you click the button in order to make the object appear it dosen't work, you have to click twice.What am I doing wrong? The object it's a movie clip named frez1, and the button is named fr1. I put this codes in the main timeline:   for the movie clip :           frez1.onPress = function(){                                      _root.frez1.gotoAndStop(2);                                      _root.frez1.gotoAndStop(1);                                           }  for the button:          frez1._visible = false;                                     fr1.onRelease = function(){                                  frez1._visible = !frez1._visible;                              }   The button and the object are on different layers.  Thank you for your help.

    Oh sorry, only now I have seen how it has been displayed. The codes are like this:  for the movie clip:  frez1.onPress = function(){                                     
                                                                                                                                                                _root.frez1.gotoAndStop(2);
                                                                                                                                                                _root.frez1.gotoAndStop(1);   
                                                                                                                                      for the button:   frez1._visible = false;                                   
                                                                                                                                                             fr1.onRelease = function(){                                 
                                                                                                                                                             frez1._visible = !frez1._visible;                             
    Yes the movie clip switching between frames and 1-2 it is turning  him invisible.
    So in order to make him go between this two frames I have to put  the visibity property and not the root ?
    Thank you

  • How to display rectangles with the following code in a JPanel?

    I am trying to make a bunch of random rectangles appear inside a JPanel on a GUI form. Im not sire how to display the form and panel with random rectangles. I have in my package the MyRectangle class, a blank JForm class called RectGUI and the class for the panel RectGUIPanel. The following code is from my panel and it should create random rectangles okay but how do I display them inside of a Panel on my RectGUI form? Thanks for the assistance.
    //Declare variables
        private int x;
        private int y;
        private int width;
        private int height;
        private Color color;
        Random rand = new Random();
        public class RectanglePanel extends JPanel
            public void displayRectangles()
                // Declare an arraylist of MyRectangles
                ArrayList<MyRectangle> myArray = new ArrayList<MyRectangle>();
                int maxNumber = 300;
               // Declare Frame and Panel
                JFrame frame = new JFrame();
                Container pane = frame.getContentPane();
                RectanglePanel rect = new RectanglePanel();
                // Set Frame attributes
                frame.setSize(700, 500);
                frame.setLocation(100,100);
                frame.setAlwaysOnTop(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setTitle(" Rectangle Program");
                frame.setVisible(true);
                for (int i = 0; i < maxNumber; i++)
                    MyRectangle rec = createRandomRec();
                    myArray.add(rec);
                    rect.repaint();
            public MyRectangle createRandomRec()  
                   x = rand.nextInt();
                   y = rand.nextInt();
                   width = rand.nextInt();
                   height = rand.nextInt();
                   color = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
                   return new MyRectangle(x, y , width, height, color);
        }

    I am trying to make a bunch of random rectangles appear inside a JPanel on a GUI form. Im not sire how to display the form and panel with random rectangles. I have in my package the MyRectangle class, a blank JForm class called RectGUI and the class for the panel RectGUIPanel. The following code is from my panel and it should create random rectangles okay but how do I display them inside of a Panel on my RectGUI form? Thanks for the assistance.
    //Declare variables
        private int x;
        private int y;
        private int width;
        private int height;
        private Color color;
        Random rand = new Random();
        public class RectanglePanel extends JPanel
            public void displayRectangles()
                // Declare an arraylist of MyRectangles
                ArrayList<MyRectangle> myArray = new ArrayList<MyRectangle>();
                int maxNumber = 300;
               // Declare Frame and Panel
                JFrame frame = new JFrame();
                Container pane = frame.getContentPane();
                RectanglePanel rect = new RectanglePanel();
                // Set Frame attributes
                frame.setSize(700, 500);
                frame.setLocation(100,100);
                frame.setAlwaysOnTop(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setTitle(" Rectangle Program");
                frame.setVisible(true);
                for (int i = 0; i < maxNumber; i++)
                    MyRectangle rec = createRandomRec();
                    myArray.add(rec);
                    rect.repaint();
            public MyRectangle createRandomRec()  
                   x = rand.nextInt();
                   y = rand.nextInt();
                   width = rand.nextInt();
                   height = rand.nextInt();
                   color = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
                   return new MyRectangle(x, y , width, height, color);
        }

  • Need help with the following code (Want an input popup with numeric pad)

    Hello,
    I put the following code in an event :
    import javax.swing.JOptionPane;
    value = javax.swing.JOptionPane.showInputDialog("Price", "");
    try {
    Double newPrice = new Double(value);
    line.setPriceTax(newPrice);
    } catch (NumberFormatException e) {
    JOptionPane.showMessageDialog(null, "Not valid number: " + value, "Error", JOptionPane.PLAIN_MESSAGE);
    But this only gives an input popup screen and then i have to use a keyboard instead of my touchscreen to give the input,
    i would rather like it to be a popup input screen with a numeric pad attached.
    Is this possible, and how??
    Thanks in advance.
    Jeroen

    hii,
    set321go wrote
    make your own. Create a custom OptionPane and add --->
    // global def.
    private final JLabel amountLabel = new JLabel(" Input Trades Amount : ");
    private JFormattedTextField amountTextField;
    private double amount = 0.00;
    private NumberFormat amountFormat;
    // in panel class add --->
    amountFormat = NumberFormat.getNumberInstance();
    amountFormat.setMinimumFractionDigits(2);
    amountFormat.setMaximumFractionDigits(2);
    amountFormat.setRoundingMode(RoundingMode.HALF_EVEN);
    amountLabel.setFont(new Font("Serif", Font.BOLD, 16));
    amountLabel.setForeground(KopikSalesTest.textColor);
    amounTextField = new JFormattedTextField(amountFormat);
    amountTextField.setValue(0.00);
    amountTextField.setFont(new Font("Serif", Font.BOLD, 20));
    amountTextField.setForeground(Color.someColor);
    amountTextField.setBackground(Color.someColor);
    amountTextField.addFocusListener(new FocusListener() {
                public void focusGained(FocusEvent e) {
                    amountTextField.requestFocus();
                    amountTextField.setText(amountTextField.getText());
                    amountTextField.selectAll();
                public void focusLost(FocusEvent e) {
                    //on exit
    somePanel.add(amountLabel);
    somePanel.add(amountTextField); ... kopik

  • Can anyone tell me what on earth is wrong with iPhoto

    I have been having this issue ever since I bought my new macbook. A Late 2011 13" Macbook Pro with Intel HD 3000 graphics. Please checkout this link below, it is a short video that shows something terribly wrong with iPhoto. I am trying to Edit pictures while all sorts of weirdness is going on with iPhoto. Recently my images are also being coruppted. I have contacted Apple care but have yet to hear from them. Their inital answer was that it seems to be a software issue. My question is that if it is a software issue then why other people are not affected by it. I am running Lion 10.7.3 and this is iPhoto 9.2.2. Everything is upto date on the Mac. If this is a software bug then its very strange its only happening to one machine.
    http://www.youtube.com/watch?v=ApRTLF4J47A&context=C474ed56ADvjVQa1PpcFMdYQ2iZ85 -pMzp4cJ5w3Q8W5UCh8VCIGE=
    Thanks All in Advance. Hope to get some replies from the iPhoto community.

    Try this:  make a temporary, backup copy (if you don't already have a backup copy) of the library and do the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    Click to view full size
    3 - launch iPhoto and try again. 
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    I'm skeptical the above will help since trying iPhoto in a new user account would essentially do the same thing.
    If that doesn't help boot into Safe Mode and try iPhoto again.  If iPhoto performs correctly in Safe Mode then reboot and try again.  If it still is messed up I think there maybe something wrong with some system components.. 
    If iPhoto performs the same in Safe Mode then it's probably hardware related since you've reinstalled the system and iPhoto. Take it to an Apple store and have them look at it.
    OT

  • What on EARTH is up with the autocorrect on iOS5? "If" to "of", "so" to "do"

    This drives me NUTS!!! For example, the iPhone will AC "I want to know if you want to go to the movies" to "I want to know of you want to go to the movies"!!!!  What the heck?!? I even tried added the word "if" to the phrases or whatever, and it still doesn't stop it. I know there are three other people that I am friends with, with this same exact problem

    Maybe I'm not understanding what you're saying. Because why would the iPhone have added the words if, of, so, and do? These are all real words that shouldn't need added to a dictionary. Why would the iPhone autocorrect (or even provide a SUGGESTION) to any of those words? What you're saying just doesn't seem to make sense to me. Because a) all of those words should already be in the dictionary, and b) why would it suggest something anyhow for one of those words? For example, why would the iPhone suggest a replacement for "Hey, do you want to do something?" with "Hey, so you want to so something?"  That just makes no sense. This is some sort of problem with the iPhone iOS.

  • What is wrong with the following Java servlet code that downloads files?

    Hi,
    I need urgent help.
    This is the issue. I have a JSP code that calls a Java servlet class. This class is used to download files from the JSP page. The following is the piece of code that does the file download.
    String pathOfFile = gsPath + "/" + gsFileName.substring(gsFileName.indexOf("~")+1);
    File F = new File(pathOfFile);
    res.setContentType("application/stream");
    res.setHeader("Content-Disposition", "attachment; filename=" +gsFileName.trim());
    This code works just fine with IE. However, when this is used with Netscape, the class name gets added to the original file name extension. For example, if the class name is 'FileRetriever' and the file being downloaded is originally named 'a.doc', the file gets a name of 'a.doc.FileRetriever' after download using Netscape or Mozilla.
    One way to solve this is by adding the appropriate file type in the MIME settings in browser preference. However, this not a permanent solution.
    Can somebody let me know the correct code to fix this issue?
    Thanks for your time.

    We loose control of the file name once we pass the original file name to the input stream. When our code instructs Netscape to write the file on the local disk using an output stream, that is when Netscape/Mozilla adds this additional extension to the original file. So, essentially, we do not know about this additional extension.
    Any ideas on how to resolve this?
    Thanks.

  • CS3 Crashing with the following code

    Try this in CS3.
    1) Open a new page.
    2) Paste the following between the body tags.
    <cfoutput>
    <form>
    <select name="whatever">
    <cfloop index="x" from="1" to="12">
    <option value="#x#">#x#</option>
    </cfloop>
    </select>
    </form>
    </cfoutput>
    3) Save the file using a cfm extension
    4) in design mode click on the dropdown.
    5) That's crash-tastic!
    wtf adobe. This only works if the file extension is .cfm
    which leads me to believe it's some cf parsing code that DW uses
    when coding in Coldfusion.

    mikechyu wrote:
    > Try this in CS3.
    Try this
    http://www.adobe.com/go/kb402776
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • What am I doing wrong with the isNew() method?  and why do I need the other methods?

    I have coded an include jsp like this.
              <%@page language="Java"%>
              <%@page import="javax.servlet.http.HttpSession"%>
              <%!
              String iContextPath;
              String iCommonPath;
              String iImagesPath;
              %>
              <%
              iContextPath = request.getContextPath();
              iCommonPath = iContextPath + "/common";
              iImagesPath = iCommonPath + "/images";
              System.err.println(" here ");
              HttpSession thisSession = request.getSession( false );
              if( thisSession.isNew() ){
              System.err.println("isnew");
              response.sendRedirect( iContextPath + "/common/login.jsp" );
              %>
              Now I also have a redirect.jsp in the root of an application that contains
              this.
              <html>
              <body>
              <%
              System.err.println("Redirecting at this time from the root");
              response.sendRedirect( request.getContextPath() + "/secureArea/");
              %>
              </body>
              </html>
              And I have a logout.java servlet that looks like this.
              package com.pch.epics;
              import java.io.IOException;
              import javax.servlet.ServletException;
              import javax.servlet.http.HttpServlet;
              import javax.servlet.http.HttpServletRequest;
              import javax.servlet.http.HttpServletResponse;
              import weblogic.servlet.security.ServletAuthentication;
              public class Logout extends HttpServlet{
              private static final String CONTENT_TYPE = "text/html";
              //Initialize global variables
              public void init() throws ServletException{
              //Process the HTTP Get request
              public void doGet( HttpServletRequest request, HttpServletResponse
              response ) throws ServletException, IOException{
              String username = "";
              if( request.getUserPrincipal() == null ){
              username = "Unknown";
              } else {
              username = request.getUserPrincipal().getName();
              System.err.println( "ePics logging out '" + username + "'" );
              request.getSession( false ).invalidate();
              ServletAuthentication.logout( request );
              ServletAuthentication.invalidateAll( request );
              ServletAuthentication.killCookie( request );
              response.sendRedirect( request.getContextPath() );
              //Process the HTTP Post request
              public void doPost( HttpServletRequest request, HttpServletResponse
              response ) throws ServletException, IOException{
              doGet( request, response );
              //Clean up resources
              public void destroy(){
              First of all, why won't the isNew() report a new session in the server log?
              EVERY request coming in says it's an old request (ie it's not new). The
              J2EE Applications and BEA WebLogic Server book from BEA says this should
              work.
              My second question is why do I need to do those three lines from
              ServletAuthentication to logout a user? Ok, maybe I'm from the MS world,
              but that seems excessive, especially since I've already done a
              session.invalidate() right before it, but the bea docs say I'm required to
              do all four!
              

    When you invalidate a session. You invalidate the session of the web
              application that your jsp/servlet is part of. It is possible to have more
              than one web application on WLS and have them share a authentication info.
              While these applications share authentication they do not share their
              sessions so because of that calling session invalidate does not kill all the
              sessions. ServletAuthentication is needed to kill all the sessions and do a
              complete logout from WLS.
              "Flip" <[remove][email protected]> wrote in message
              news:[email protected]...
              > I have coded an include jsp like this.
              >
              > <%@page language="Java"%>
              > <%@page import="javax.servlet.http.HttpSession"%>
              > <%!
              > String iContextPath;
              > String iCommonPath;
              > String iImagesPath;
              > %>
              > <%
              > iContextPath = request.getContextPath();
              > iCommonPath = iContextPath + "/common";
              > iImagesPath = iCommonPath + "/images";
              >
              > System.err.println(" here ");
              > HttpSession thisSession = request.getSession( false );
              > if( thisSession.isNew() ){
              > System.err.println("isnew");
              > response.sendRedirect( iContextPath + "/common/login.jsp" );
              > }
              >
              > %>
              >
              > Now I also have a redirect.jsp in the root of an application that contains
              > this.
              > <html>
              > <body>
              > <%
              > System.err.println("Redirecting at this time from the root");
              > response.sendRedirect( request.getContextPath() + "/secureArea/");
              > %>
              > </body>
              > </html>
              >
              > And I have a logout.java servlet that looks like this.
              > package com.pch.epics;
              >
              > import java.io.IOException;
              > import javax.servlet.ServletException;
              > import javax.servlet.http.HttpServlet;
              > import javax.servlet.http.HttpServletRequest;
              > import javax.servlet.http.HttpServletResponse;
              > import weblogic.servlet.security.ServletAuthentication;
              >
              > public class Logout extends HttpServlet{
              > private static final String CONTENT_TYPE = "text/html";
              > //Initialize global variables
              > public void init() throws ServletException{
              > }
              >
              > //Process the HTTP Get request
              > public void doGet( HttpServletRequest request, HttpServletResponse
              > response ) throws ServletException, IOException{
              > String username = "";
              > if( request.getUserPrincipal() == null ){
              > username = "Unknown";
              > } else {
              > username = request.getUserPrincipal().getName();
              > }
              > System.err.println( "ePics logging out '" + username + "'" );
              > request.getSession( false ).invalidate();
              > ServletAuthentication.logout( request );
              > ServletAuthentication.invalidateAll( request );
              > ServletAuthentication.killCookie( request );
              > response.sendRedirect( request.getContextPath() );
              > }
              >
              > //Process the HTTP Post request
              > public void doPost( HttpServletRequest request, HttpServletResponse
              > response ) throws ServletException, IOException{
              > doGet( request, response );
              > }
              >
              > //Clean up resources
              > public void destroy(){
              > }
              > }
              >
              > First of all, why won't the isNew() report a new session in the server
              log?
              > EVERY request coming in says it's an old request (ie it's not new). The
              > J2EE Applications and BEA WebLogic Server book from BEA says this should
              > work.
              >
              > My second question is why do I need to do those three lines from
              > ServletAuthentication to logout a user? Ok, maybe I'm from the MS world,
              > but that seems excessive, especially since I've already done a
              > session.invalidate() right before it, but the bea docs say I'm required to
              > do all four!
              >
              >
              >
              

  • Importing - Exporting Tables, What is best to do with the following;

    This is purely down to my general interest, I can do both but just wondered which is best to do?
    Export a table / import table / drop table
    Export table (truncated)/ import table
    Any adverse effects?
    To Truncate or not Truncate?
    Any advice or comments gratefully received.
    Message was edited by:
    Jamie Gadong

    Hi,
    If your table is going to be the same, you may go for the TRUNCATE approach.
    Pros: all blocks assigned to the segment/table are not released (DROP releases space)
    that will free the DB of that activity when loading data.
    Cons: importing data reorganizes data, usually defragmenting space allocated...therefore you may get some empty extents (that may be used later), this is not preciselly a minus if your table is going to grow: you'll have space preallocated.
    Regards
    Ignacio
    http://oracledisect.blogspot.com

  • Please help me on a form i push the submit button and all i get is a page with the following code wh

    <?php
    //--------------------------Set these paramaters--------------------------
    // Subject of email sent to you.
    $subject = 'Results from Contact form';
    // Your email address. This is where the form information will be sent.
    $emailadd = '[email protected]';
    // Where to redirect after form is processed.
    $url = 'http://www.karenwebster.info/confirmation.html';
    // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
    $req = '1';
    // --------------------------Do not edit below this line--------------------------
    $text = "Results from form:\n\n";
    $space = ' ';
    $line = '
    foreach ($_POST as $key => $value)
    if ($req == '1')
    if ($value == '')
    {echo "$key is empty";die;}
    $j = strlen($key);
    if ($j >= 20)
    {echo "Name of form element $key cannot be longer than 20 characters";die;}
    $j = 20 - $j;
    for ($i = 1; $i <= $j; $i++)
    {$space .= ' ';}
    $value = str_replace('\n', "$line", $value);
    $conc = "{$key}:$space{$value}$line";
    $text .= $conc;
    $space = ' ';
    mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
    echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    ?>
    where do i put this and what am imissing

    I don't know why but after about an hour the tool bar you rferred to came on its self jsut as the support solution and you have advised and it is now working, but the toolbar just disappears and that is why I could not find the link or correct store link. Weird! But thanks, Gordon

Maybe you are looking for

  • IBAN update for vendor bank details using  rfbikr00

    Hello, I am trying to update the IBAN details of vendor using standard upload program rfbikr00.While doing the same, the IBAN is not updated to the corresponding bank details line, rather it is creating a new line with IBAN only. I am using the below

  • IDOC is created with status 51( application document not posted)

    Hi experts iam working on File-IDOC scenario, when i test the process the XML message is created with no errors and but the IDOC is created with status 51( application document not posted) the details error shows: An error occurred in CALL TRANSACTIO

  • Is it possible to save a HashMap in a Database

    Hi there, I have this method which stores some actions that have change a text in a JTextPane   private void createActionTable(JTextComponent textComponent) {         actions = new HashMap();         Action[] actionsArray = textComponent.getActions()

  • TS1702 my app store keeps crashing

    After the update that was made today my app store continues to crash more than normal. I tried restoring my ipod and it still does it. Is this problem with my ipod or with the update what has issues?

  • Read reviews for all markets?

    Is there some way to read the reviews of an app at appstore for all markets? In Itunes I only see the reviews for the market my itunes are connected to and not the whole world. Message was edited by: martymart