Lai:

I ran into the same problem since int is an atomic datatype and not an
object.
As one possible sollution, you may want to store the value as an Integer
object
then retrieve it in the following manner:

Integer myInt = (Integer) polVoteCount.elementAt(i);
intVoteCount = myInt.intValue();


Shane
____________________________________________
Shane Stene                            Phone: (605) 594-6876
Raytheon STX Corporation      Fax:      (605) 594-6940
EROS Data Center                  Email:  [EMAIL PROTECTED]
Sioux Falls, SD 57198
____________________________________________




                    "Lai, Kenny"
                    <[EMAIL PROTECTED]        To:     [EMAIL PROTECTED]
                    T>                       cc:
                    Sent by: A               Subject:     vector cast to int
                    mailing list
                    about Java Server
                    Pages
                    specification and
                    reference
                    <JSP-INTEREST@JAV
                    A.SUN.COM>


                    02/28/02 12:03 AM
                    Please respond to
                    A mailing list
                    about Java Server
                    Pages
                    specification and
                    reference





i'm trying to do an explicit cast from vector object to int..

if you look at the below stripped out code, where tempTotal is defined,
that
(int) conversion doesnt work..

ultimately i'm trying to perform a division computation w/ totalVotes.
anyone have a solution???

----
java.sql.ResultSet regularPoll = null;
try {
  regularPoll = db.execSQL(" select votecount from sometable where
id=someid");
} catch (SQLException e) {
        System.err.println(e.toString());
}
Vector pollVotecount = new Vector();
while(regularPoll.next()) {
   pollVotecount.addElement(regularPoll.getString("votecount"));
}
int totalNum = 100;
int tempTotal = (int) pollVotecount.elementAt(i);
int tempNum = tempTotal / totalVotes);

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to