What is the exception?
Subject: Re: int type property in javaBean

According to what you said,I modified the method.
---------------------------following error code---------------------
int age;
///the following method can't reutrn Int,otherwise error occurs
com.sabrina.javabean.PersonInfo.setAge(Ljava/lang/String;)V
 
public void setAge(int person_age){ 
    age=person_age;
}
 
///the following method can't reutrn Int,otherwise error occurs
com.sabrina.javabean.PersonInfo.getAge()Ljava/lang/String; Start server side stack trace: java.lang.NoSuchMethodError: com.sabrina.javabean.PersonInfo.getAge()Ljava/lang/String; at jsp_servlet._otherjsp.__person_info._jspService(__person_info.java:119) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2456) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) End server side stack trace
 
public int getAge(){ 
   
    return age;
}
 
-----------------------------end-- -------------------------
 
The exception was still throwed  out unless I write code as following:
 
int age;
public void setAge(String son_age){ ///must use the string type param,
                                        ///otherwise error occurs
    age=Integer.parseInt(person_age);
}
public String getAge(){  ///can't reutrn Int,otherwise error occurs
    return String.valueOf(age);
}
------------------------------------------------------------------
 
 

Reply via email to