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" %>

<html:html locale="true">
<head>
   <html:base/>
   <title><bean:message key="index.title"/></title>
</head>
<body bgcolor="white">
<h2>Test</h2>

<html:errors/>

<html:form action="test.do" method="GET">
        Name:<html:text property="name" /> <br/>
        Age:<html:text property="age" /> <br/>

        <html:submit property="submit"/>
</html:form>

</body>
</html:html>




-----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)<br>
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]>

Reply via email to