RE: ClassCastException:java.lang.Integer

2002-09-06 Thread Galbreath, Mark

You cannot pass values as ints, only as strings.  This is basic to HTTP.

-Original Message-
From: Vijeth R Naik [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 6:59 AM
To: 'Strut User'
Subject: ClassCastException:java.lang.Integer


Hi 
I am a newbie using struts.
I have a simple jsp which has 2 fields, a String and a Number(eg: Name and
Age)
When I try displaying the jsp, I get this exception,
ClassCastException:java.lang.Integer

I am using Tomcat-3.3.1 and Struts-1.0.2 

I have a form bean, where "Name" is a String and "Age" is an int.

In my ActionClass, I  set the bean values..

String age_str=request.getParameter("age");
int age_int=(new Integer(age_str)).intValue();

beanClass.setAge(age_int);

Kindly let me know what is the error..


TIA

Vijeth



--
To unsubscribe, e-mail:

For additional commands, e-mail:


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: ClassCastException:java.lang.Integer

2002-09-06 Thread Miguel Angel Mulero Martinez

With this code, Struts try to initialize the values to getName() and
getAge() of the bean that you have chosed in your struts-config.xml file, in
the definition of the action test.do

I think that getAge() must return a String, not a number, but I'm not sure.
Make a toString() to the value in the getAge().


-Mensaje original-
De: Vijeth R Naik [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 06 de septiembre de 2002 13:13
Para: 'Struts Users Mailing List'
Asunto: RE: ClassCastException:java.lang.Integer


This is my jsp...

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>



   
   


Test




Name: 
Age: 










-Original Message-
From: Miguel Angel Mulero Martinez
[mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 4:29 PM
To: Struts Users Mailing List
Subject: RE: ClassCastException:java.lang.Integer


You can show me the part of your JSP when you use the values?


-Mensaje original-
De: Vijeth R Naik [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 06 de septiembre de 2002 12:59
Para: 'Strut User'
Asunto: ClassCastException:java.lang.Integer

Hi
I am a newbie using struts.
I have a simple jsp which has 2 fields, a String and a Number(eg: Name and
Age)
When I try displaying the jsp, I get this exception,
ClassCastException:java.lang.Integer

I am using Tomcat-3.3.1 and Struts-1.0.2

I have a form bean, where "Name" is a String and "Age" is an int.

In my ActionClass, I  set the bean values..

String age_str=request.getParameter("age");
int age_int=(new Integer(age_str)).intValue();

beanClass.setAge(age_int);

Kindly let me know what is the error..


TIA

Vijeth



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: ClassCastException:java.lang.Integer

2002-09-06 Thread Vijeth R Naik


This is my jsp...

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>



   
   


Test




Name: 
Age: 





   




-Original Message-
From: Miguel Angel Mulero Martinez
[mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 4:29 PM
To: Struts Users Mailing List
Subject: RE: ClassCastException:java.lang.Integer


You can show me the part of your JSP when you use the values?


-Mensaje original-
De: Vijeth R Naik [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 06 de septiembre de 2002 12:59
Para: 'Strut User'
Asunto: ClassCastException:java.lang.Integer

Hi
I am a newbie using struts.
I have a simple jsp which has 2 fields, a String and a Number(eg: Name and
Age)
When I try displaying the jsp, I get this exception,
ClassCastException:java.lang.Integer

I am using Tomcat-3.3.1 and Struts-1.0.2

I have a form bean, where "Name" is a String and "Age" is an int.

In my ActionClass, I  set the bean values..

String age_str=request.getParameter("age");
int age_int=(new Integer(age_str)).intValue();

beanClass.setAge(age_int);

Kindly let me know what is the error..


TIA

Vijeth



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: ClassCastException:java.lang.Integer

2002-09-06 Thread Kidd, Polly

I think the thing to point out here is that you shouldn't have to do any of
this sort of code because struts takes care of this for you. If the input
fields in your jsp are defined with struts tags, eg.




and you have methods in your form bean called getAge()/setAge() and
getName()/setName(), when you submit your jsp struts will magically populate
the bean fields for you!

-Original Message-
From: Vijeth R Naik [mailto:[EMAIL PROTECTED]]
Sent: 06 September 2002 11:59
To: 'Strut User'
Subject: ClassCastException:java.lang.Integer


Hi 
I am a newbie using struts.
I have a simple jsp which has 2 fields, a String and a Number(eg: Name and
Age)
When I try displaying the jsp, I get this exception,
ClassCastException:java.lang.Integer

I am using Tomcat-3.3.1 and Struts-1.0.2 

I have a form bean, where "Name" is a String and "Age" is an int.

In my ActionClass, I  set the bean values..

String age_str=request.getParameter("age");
int age_int=(new Integer(age_str)).intValue();

beanClass.setAge(age_int);

Kindly let me know what is the error..


TIA

Vijeth



--
To unsubscribe, e-mail:

For additional commands, e-mail:


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: ClassCastException:java.lang.Integer

2002-09-06 Thread Miguel Angel Mulero Martinez

You can show me the part of your JSP when you use the values?


-Mensaje original-
De: Vijeth R Naik [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 06 de septiembre de 2002 12:59
Para: 'Strut User'
Asunto: ClassCastException:java.lang.Integer

Hi
I am a newbie using struts.
I have a simple jsp which has 2 fields, a String and a Number(eg: Name and
Age)
When I try displaying the jsp, I get this exception,
ClassCastException:java.lang.Integer

I am using Tomcat-3.3.1 and Struts-1.0.2

I have a form bean, where "Name" is a String and "Age" is an int.

In my ActionClass, I  set the bean values..

String age_str=request.getParameter("age");
int age_int=(new Integer(age_str)).intValue();

beanClass.setAge(age_int);

Kindly let me know what is the error..


TIA

Vijeth



--
To unsubscribe, e-mail:

For additional commands, e-mail:



--
To unsubscribe, e-mail:   
For additional commands, e-mail: