ClassCastException for java.lang.Integer in JSF

Hi,
I am a newbie, i am working on adding 2 numbers in jsf.
Where i have a addNumber.jsp:-
Number1:<h:inputText value"#{AddBean.num1)}"/>
Number2:<h:inputText value"#{AddBean.num2)}"/>
<h:commandButton value="Add" action="#{AddBean.sum}"/>
In AddBean.java
I have getters and setters for num1 & num2 property whose datatype is int.
public int sum(){
System.out.println("Inside sum");
return (num1+num2);
Here when i click the Add button the sum() is fired where it is printing "Inside sum" after that i am getting a "ClassCastException saying that java.lang.Integer". Which means i can only use Integer object for calculation rather than using primitive datatype(int)?
What is the problem here? Pls. do explain?
Thanks

The action method should be declared void or return a String. It is to be used for the navigation-case entries in the faces-config.xml. If you want a postback to the same page, just declare it void. It should not return the intented "result" of the action. Store the result somewhere as a bean property.
The following example should work:<h:form>
    <h:inputText value="#{addBean.number1}" />
    <h:inputText value="#{addBean.number2}" />
    <h:commandButton value="Add" action="#{addBean.sum}" />
    <h:outputText value="#{addBean.result}" />
</h:form>AddBeanprivate int number1; // + getter + setter
private int number2; // + getter + setter
private int result; // + getter only
public void sum() {
    result = number1 + number2;
}And I'd rather to use Integer instead of int, but that's more a design choice.

Similar Messages

  • Uow registerObject: Missing descriptor for java.lang.Integer

    I get this message on uow.registerObject
    Missing descriptor for java.lang.Integer.
    Any help greatly appreciated,
    Thanks,
    Vivek

    Are you trying to register an Integer with the UOW? You don't have to register primitives. Odds are you're not doing this, but this exception will still be thrown if you have accidentally mapped a DTF as a 1-1 (i.e, if an Order has a price that is an Integer and you accidentally have it as a 1-1 mapping). Or, if you have a 1-M relationship and an Integer gets into the collection. Etc.
    In a nutshell, this error is saying that somehow you have an Integer where TopLink is expecting some sort of business class mapped.
    - Don

  • Dyna Form +Validator Framework--- peculair problem with java.lang.Integer

    In my struts application , i m using Dyna Action form,and Validator framework
    <form-bean
    name="myDynaForm"
    type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="name" type="java.lang.String"/>
    <form-property name="phoneNo" type="java.lang.Integer"/>
    </form-bean>
    Now if user does not enter name , then a error meassage is dispalyed,
    and aslo this time phoneNo shows 0.
    why 0 is displayed here?
    Can anybody tell me

    Hi all,
    If my memory serves me well, the exception is thrown because the application needs a working calendar for a person provided in time mangement. Make sure the correct infotypes are used. Also the organization structure needs to be set up correctly. The manager needs someone to approve and the employee needs someone to get approved by.
    Regards, Marcel.

  • Can't convert int to java.lang.Integer.

    Hi everyone.
    I'm working on an auction site at the moment and have problems gaining a bidID number. This is part of my code and my error.
    AuctionFacade aHse = (AuctionFacade) application.getAttribute("AuctionFacade");
    String strTraderName = (String)session.getAttribute("traderName");
    String strPassword = (String)session.getAttribute("password");
    String strIDNum = request.getParameter("auctionID");
    Integer intID = Integer.valueOf(strIDNum);
    Integer [] bids = aHse.getAllBids(intID);
    float fltYourBid = aHse.getBidPrice(bids.length);
    ^
    Can't convert int to java.lang.Integer.
    can anyone help please?

    So, does "aHse.getBidPrice" expect an int or an Integer as its parameter? And does it return an int, or an Integer, or what? The answer to those questions may lead to your solution -- look at what you are actually using as the parameter, for example.

  • Integer and java.lang.Integer?

    hi
    I'm using DefaultTableModel method getValueAt which takes 2 integers as parameters
    i have the vector colnumbers which has integers in it. Im trying to get these integers back out again to use in the getValue at method but the compilercomplains that i need int,int nad not int, java.lang.Integer.
    Why are there 2 different integers? and how do i just get it back as int????
    thanks
    Vector unsorted = new Vector();
    for(int j=0; j<colnumbers.size(); j++)
    for(int i=0; i<=max_rows; i++)
         unsorted.add(tm.getValueAt(i,(Integer)colnumbers.elementAt(j)));     
    }

    unsorted.add(
      tm.getValueAt(
        i,
        ((Integer) colnumbers.elementAt( j )).intValue()
    );you just needed to parenthesize to indicate that intValue() gets called on the result of casting colnumbers.elementAt( j ) to type Integer.

  • Java.lang.Integer behaviour

    Hi all,
    While preparing for my SCJP6 i was playing with the java.lang.Integer integer wrapper. I found some behaviour which I could not explain. Below is the code and output on jre6.
    public void test(){
              Integer int1 = 100;
              Integer int2 = 100;
              System.out.println(int1!=int2);
              System.out.println(int1==int2);
              System.out.println(int1.equals(int2));
         }OUTPUT:
    false
    true
    true
         public void test(){
              Integer int1 = 1000;
              Integer int2 = 1000;
              System.out.println(int1!=int2);
              System.out.println(int1==int2);
              System.out.println(int1.equals(int2));
         }OUTPUT:
    true
    false
    true
    As you can see the == and != operators behave differently for values 100 and 1000.
    Please let me know why is it so.
    Thanks.

    Thanks for the post,
    again i'd stress on the fact that I want to be able to determine the behavior of == and != operator regardless of whether i should use them or not.
    Some place i have read that == actually Unboxes the object and compares the values and not the Object ref where as != always compares the obj ref only.
    The behavior i have found is that both operators work on the actual object reference. If the Object value is >-129 and <128 then the JVM uses the same underlying object(cached one) and if the value is out of this range then new object is created.
    So
    Integer i=1000,i2=1000;
    i==i2 OUTPUT false
    i!=i2 OUTPUT true.
    Integer i=100,i2=100;
    i==i2 OUTPUT true
    i!=i2 OUTPUT false.
    I just want a web link where I can confirm my findings.
    Edited by: rishabhchandra on Jun 20, 2009 7:30 PM

  • Java.lang.Integer defaulting to zero

    I am using JAXB for several years, but never dived into details.
    I am not using a schema.
    When I am unmarshalling a XML file, JAXB always defaults my java.lang.Integer attributes to zero instead to null, when the attribute is not given in the XML file.
    How can I change this? I like the Integers to be null, just like in a "normal" Java program.
    Thanks
    Markus

    mkarg wrote:
    When I am unmarshalling a XML file, JAXB always defaults my java.lang.Integer attributes to zero instead to null, when the attribute is not given in the XML file.I am using JAXB 2.1.3 in JDK 1.6. It uses java.math.BigInteger instead of java.lang.Integer for xs:integer types in schema.
    It assigns null when attribute is not given in XML, this is similar to your need.
    Which version of JAXB are you using?

  • Required: java.lang.Integer

    This is test.java:
    import java.lang.Integer;
    class Testit {
    Integer ix = (Integer)1;
    This is the result of the javac:
    javac ca\test.java
    ca\test.java:4: inconvertible types
    found : int
    required: java.lang.Integer
    Integer ix = (Integer)1;
    ^
    1 error
    Can anyone explain this?
    Java is mysterious.
    Thanks,
    Grant Head

    This is because 1 is not object in Java. Any integer is primitive type. They are not object. So you cannot cast them into object. If you want to creat Integer object from integer. Simply do following...
    import java.lang.Integer;
    class Testit {
    Integer ix = new Integer(1);
    }However, in C#, everything is object. Any integer, floating points are all object. That's one of difference between Java and C#.
    Hope this help. :)
    mrbabe

  • Test suites for Java.lang, java.util ?

    Does anyone known a good (free) test suite for java.lang and java.util ?
    I heard about "Mauve project" and was wondering how good it is...
    any others equivalent projects ?
    Thanks a lot !
    Eg\\*

    Hi,
    because I will have to test a specific implementation of these package (on an embedded device).
    Eg\\*

  • How to convert from java.lang.Integer to int

    Could you please show me
    how to convert from java.lang.Integer to int?
    and how to convert from java.lang.Integer to String?
    Thanks,
    Minh

    Could you please show me
    how to convert from java.lang.Integer to int?
    and how to convert from java.lang.Integer to String?Tip: always keep a browser open on the API docs; if you've got a
    couple of MBs to spare, download the docs; it's very convenient.
    kind regards,
    Jos

  • Maximum capacity for java.lang.StringBuilder

    What is the maximum capacity allowed for java.lang.StringBuilder ? Is it the maximum size of an 'int' ?

    My guess is that the data model for StringBuilder is based on an array of characters (I'm not on my home computer so I can't look at the java source code for this). If so, then the capacity for it is the same as the capacity for any java array. This I know to be JVM specification specific. So the answer would vary depending on which JVM you are using.

  • Solution needed  for java.lang.ClassCastException

    My code+_
    public class EmployeeResultsCO extends OAControllerImpl
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"empCreateTxn", false))
    am.invokeMethod("rollbackEmployee");
    TransactionUnitHelper.endTransactionUnit(pageContext, "empCreateTxn");
    // This controller is associated with the table.
    OATableBean table = (OATableBean)webBean;
    table.prepareForRendering(pageContext);
    DataObjectList columnFormats = (DataObjectList)table.getColumnFormats();
    DictionaryData columnFormat = null;
    int childIndex = pageContext.findChildIndex(table, "DeleteSwitcher");
    columnFormat =(DictionaryData)columnFormats.getItem(childIndex);
    columnFormat.put(COLUMN_DATA_FORMAT_KEY, ICON_BUTTON_FORMAT);
    // Implement the bound value for the Status Image
    OAImageBean statusImageBean =
    (OAImageBean)table.findIndexedChildRecursive("EmpStatus");
    if (statusImageBean == null)
    MessageToken[] tokens = { new MessageToken("OBJECT_NAME",
    "EmpStatus") };
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", tokens);
    // Define the OA Framework image directory
    FixedBoundValue imageDirectory =
    new FixedBoundValue(APPS_MEDIA_DIRECTORY);
    // Define a binding between the image bean and the view object attribute
    // that it will reference to get the appropriate .gif image value name.
    // Note that the corresponding attribute values are obtained using a
    // decode() in the EmployeeSummaryVO view object.
    OADataBoundValueViewObject statusBinding = new OADataBoundValueViewObject
    (statusImageBean, "EmployeeStatus");
    // Concatenate the image directory with the actual image name (as retrieved
    // from the view object attribute decode() statement)
    ConcatBoundValue statusCBV = new ConcatBoundValue(new BoundValue[]
    {imageDirectory, statusBinding});
    // Tell the image bean where to get the image source attribute
    statusImageBean.setAttributeValue(SOURCE_ATTR, statusCBV);
    // For accessibility compliance, you always specify the alternate text for an
    // image. Note that you should never use static text as shown (always source
    // translatable text from Message Dictionary when setting display text values
    // programmatically), and ideally, the alternate text should in this case
    // should clearly indicate the status the image represents.
    // Generally, we would recommend that you use a Switcher as shown for the
    // Delete column to easily show different images with associated alternate
    // text, but we wanted to show how to use a bound value also in this lab.
    statusImageBean.setAttributeValue(SHORT_DESC_ATTR, "Employee status indicator");
    Error
    oracle.apps.fnd.framework.OAException: java.lang.ClassCastException
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:597)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1133)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:937)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:904)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:937)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:904)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2318)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1717)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
         at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
         at OA.jspService(OA.jsp:45)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.lang.ClassCastException
         at kumarkris.oracle.apps.ak.employee.webui.EmployeeResultsCO.processRequest(EmployeeResultsCO.java:59)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:581)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1133)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:937)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:904)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:937)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:904)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2318)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1717)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
         at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
         at OA.jspService(OA.jsp:45)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    java.lang.ClassCastException
         at kumarkris.oracle.apps.ak.employee.webui.EmployeeResultsCO.processRequest(EmployeeResultsCO.java:59)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:581)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1133)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:937)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:904)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:937)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:904)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2318)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1717)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
         at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
         at OA.jspService(OA.jsp:45)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)

    ## Detail 0 ##
    java.lang.ClassCastException
    at kumarkris.oracle.apps.ak.employee.webui.EmployeeResultsCO.processRequest(EmployeeResultsCO.java:59)What is the code at line no. 59 ?
    -Anand

  • Is there a forName() for java.lang.reflect.Type?

    Is there an equivelant to Class.forName() for all types?
    For example:forName("java.util.List<java.lang.Sring>");
    //or
    forName("int");Such a method would return a java.lang.reflect.Type, instead of return a java.lang.Class
    See also
    Field.getGenericType()
    Method.getGenericReturnType()

    incidentally, getGenericType() will give you the
    generic type of the member being examined, not the
    parameterized type.
    that is, if I declare a method like this:
    public <T extends MyInterface> T getStuff() {
    }I won't be able to reflectively find out what types
    of T are being used at runtime, only that it's of
    type 'T'. of limited use really
    Java's implementation of Generics isn't as good as it
    could be, mainly to maintain backwards compatibiityYou are right in that case because that is not a ParameterizedType that is a TypeVariable.
    Type can encompass both Types.

  • Java.lang.Integer in JSP

    why when i use
    <%.... Integer i= Integer(String) %>
    it causes error
    java.lang.NumberFormatException: null get
    and in ,
    <%!.... Integer i= Integer(String) %>
    it is O'k

    In the class named Students_jsp.java, your code is...
    ResultSet rs = student.viewPeople(1);
    But you have defined viewPeople() to take an argument of type Integer. 1 is an int, not an Integer. This should cure that problem.
    ResultSet rs = student.viewPeople(new Integer(1));

  • Improvement suggestion for java.lang.Iterable

    The current design limits each container to one collection. Wouldn't it be better to define java.lang.Iterable as
    interface Iterable<T> {
    Iterator<T> iterator(Class<T> class)
    Then a conainer could hold multiple collections, as long as each collection contains different types.
    Then I could write
    class Zoo
    implements Iterable<Tiger>,
    implements Iterable<Elephant> {
    Iterator<Tiger> iterator(Class<Tiger> class) ...
    Iterator<Elephant> iterator(Class<Elephant> class) ...
    and the compiler would be able to handle this:
    for (Tiger tiger : zoo) .. give me all Tigers
    for (Elephant elephant : zoo) .. give me all Tigers

    The current design limits each container to one collection. Wouldn't it be better to define
    java.lang.Iterable as
    interface Iterable<T> {
    Iterator<T> iterator(Class<T> class)
    }If you were to do that, none of the existing Collection types could implement it without breaking backward compatibility.
    Then I could write
    class Zoo
    implements Iterable<Tiger>,
    implements Iterable<Elephant> {Unfortunately it's not possible to implement the same interface twice with different type arguments. I say unfortunately because I believe one of my own API designs would benefit from that capability, if it were possible.
    and the compiler would be able to handle this:
    for (Tiger tiger : zoo) .. give me all Tigers
    for (Elephant elephant : zoo) .. give me all TigersYou can still do this:
    class Zoo {
        Collection<Tiger> tigers() { ... }
        Collection<Elephant> elephants { ... }
    for (Tiger tiger : zoo.tigers())  ...
    for (Elephant elephant : zoo.elephants()) ...Mark

Maybe you are looking for