You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sh...@ubs.com on 2002/11/19 14:55:40 UTC
RE: Query regarding initialization of jsp form
If you are sure that 0 or 0.0 is never a valid value, one way of avoiding this
will be to use struts logic:notEqual tag.
<logic:notEqual name="FromBeanA" property="age" value="0">
Age = <html:text name="FromBeanA" property="age" />
<logic:notEqual>
-----Original Message-----
From: kpbhat [mailto:kpbhat@india.hp.com]
Sent: Tuesday, November 19, 2002 2:48 PM
To: struts-user
Cc: kpbhat
Subject: Query regarding initialization of jsp form
Hi,
I am facing the following issue with regard to jsp form initialization by
struts
When a primitive data type such as int or double is used in the form bean ,
the corresponding jsp shows the
form elment initialized to 0 or 0.0 as the case may be.
How do i prevent this from happening ?
However if the form bean attribute carries a valid value (say 5 or 6.56 etc)
, then the same must be displayed on the jsp.
Let me enumerate with an example
Suppose the form bean look like this
FromBeanA.java
{
double age ;
public void setAge(double age)
{
this.age = age;
}
public double getAge()
{
return this.age
}
}
--- And the jsp has the following
<html:form action="/xyz.do" >
--------------
-----------
<!-- here form bean is assumed to be appropriately configured -->
Age = <html:text name="FromBeanA" property="age" />
<html:form/>
then the display of the jsp will look like this
Age = 0.0
I do not want 0.0 to appear
Thanks in advance,
Prakash
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>