struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: AW: Object field validation
Date Tue, 04 Jul 2006 19:26:30 GMT
If 'domain' is of type integer, this is expected behaviour. Struts uses 
BeanUtils under the covers to convert the form inputs and set them on 
the bean. The standard behaviour for an input that can't be converted to 
an integer is to return 0.

You have two choices: make 'domain' a String instead of an integer; or 
use the Integer wrapper-type. If you need to be able to re-display 
invalid input, using String-type properties is the only solution. An 
integer (or Integer) property simply can't hold a value of 'm' for 
redisplay.

L.

Halgurt Mustafa Ali wrote:
> Hi,
> 
> I have even thought that, but it still not work although taskDefinition is not null.
When I enter a valid value for domain, it works, but when I enter an unvalid value like "m",
the value of domain will be set to 0 without getting the validation message to tell the client,
that the value of domain was unvalid.
> 
> 
> Best regards,
> Halgurt
> -----Ursprüngliche Nachricht-----
> Von: Niall Pemberton [mailto:niall.pemberton@gmail.com]
> Gesendet: Montag, 3. Juli 2006 20:12
> An: Struts Users Mailing List
> Betreff: Re: Object field validation
> 
> 
> This is indicating that getTaskDefinition() from your form is
> returining null - so you need to ensure that the taskDefinition
> property is intialized first.
> 
> Niall
> 
> On 7/3/06, Halgurt Mustafa Ali <halgurt.mustafa@star-trac.de> wrote:
>> Hallo all,
>>
>> I posted yasterday the below message. I changed my formset to:
>>
>> <form name="TASKMANAGERform">
>>                <field property="taskDefinition.domain" depends="integer">
>>                        <arg position="0"  key="TASKMANAGERform.taskDefinition.domain"/>
>>                </field>
>>        </form>
>>
>> and now I am getting this error message:
>>
>> 16:55:35,332 ERROR [ValidatorAction] Unhandled exception thrown during validation:
Null property value for 'taskDefinition'
>> java.lang.IllegalArgumentException: Null property value for 'taskDefinition'
>>
>>
>>
>> I think the validator is not able to recognize taskDefinition as a property of type
"TaskDefinition" and then get the field "domian" of this type. Is there any way to do such
a validation? I appreciate your help :-)
>>
>> thanks a lot,
>> Halgurt
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Halgurt Mustafa Ali
>> Gesendet: Freitag, 30. Juni 2006 13:04
>> An: Struts Users Mailing List
>> Betreff: AW: Object field validation
>>
>>
>> Hi,
>>
>> Sorry, I tried that also, but it seems not to work, I am not sure if it is possible
to validate fields von objects, do you mean it works?
>>
>>
>> Regards,
>> Halgurt
>> -----Ursprüngliche Nachricht-----
>> Von: Truong Xuan Tinh [mailto:tinh.truong@pyramid-consulting.com]
>> Gesendet: Freitag, 30. Juni 2006 13:05
>> An: Struts Users Mailing List
>> Betreff: Re: Object field validation
>>
>>
>> Try
>>
>> <form name="TASKMANAGERform">
>>                <field property="taskDefinition.domain" depends="integer">
>>                        <arg position="0"  key="TASKMANAGERform.taskDefinition.domain"/>
>>                </field>
>>        </form>
>>
>> Hope this may help.
>> Halgurt Mustafa Ali wrote:
>>> Hi all,
>>>
>>> I have a form called TASKMANAGERform and in this form I have a field called taskDefinition
of type TaskDefinition. TaskDefinition has a field domain of type Integer. Is it possible
to validate this field? I meen to validate taskDefinition.domain? If aes, in which way? I
have tried this:
>>>
>>>       <form name="TASKMANAGERform">
>>>               <field property="TASKMANAGERform.taskDefinition.domain" depends="integer">
>>>                       <arg position="0"  key="TASKMANAGERform.taskDefinition.domain"/>
>>>               </field>
>>>       </form>
>>>
>>> but it doesn`t work..
>>>
>>> Many Thanks,
>>> Halgurt
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Jorge Martín Cuervo [mailto:jorge.martin@defactops.com]
>>> Gesendet: Freitag, 30. Juni 2006 10:33
>>> An: kindlerm@acm.org
>>> Cc: 'Struts Users Mailing List'
>>> Betreff: Re: AW: xhtml-mobile with Struts?
>>>
>>>
>>> thank.
>>>
>>> It looks good pretty!
>>>
>>> El vie, 30 de 06 de 2006 a las 10:14, Martin Kindler escribió:
>>>
>>>
>>>> Sorry for that! I sent the wrong URL (normally a Typo3/PHP-page is in front
>>>> of the main Struts-app, so to force XHTML MP I have to skip the T3 part).
>>>>
>>>> The correct one is:
>>>> http://www.cityexperience.net/cxpCat/Welcome.do?ua=MOBILE
>>>>
>>>> Martin
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Jorge Martín Cuervo [mailto:jorge.martin@defactops.com]
>>>> Gesendet: Freitag, 30. Juni 2006 09:33
>>>> An: kindlerm@acm.org
>>>> Cc: 'Struts Users Mailing List'
>>>> Betreff: Re: AW: xhtml-mobile with Struts?
>>>>
>>>>
>>>> El vie, 30 de 06 de 2006 a las 09:12, Martin Kindler escribió:
>>>>
>>>> I do not know, if there is a tool for XHTML MP, but we have done our mobile
>>>>
>>>> site with ordinary Struts and a set of XHTML MP JSPs.
>>>>
>>>> Very easy. If you want to look:  <http://www.cityexperience.net/>
>>>> http://www.cityexperience.net/. If you do
>>>>
>>>> use a "normal" browser and would like to see the mobile version, start at
>>>>
>>>>  <http://www.cityexperience.net/cxpCat/Catalog.do?ua=MOBILE>
>>>> http://www.cityexperience.net/cxpCat/Catalog.do?ua=MOBILE.
>>>>
>>>> this link doesn't work:
>>>>
>>>> HTTP Status 404 - /pages//catalog.jsp
>>>>
>>>>
>>>>
>>>>  (Sorry, only
>>>>
>>>> German at this moment).
>>>>
>>>>
>>>>
>>>> Martin
>>>>
>>>>
>>>>
>>>>
>>>>> -----Ursprüngliche Nachricht-----
>>>>>
>>>>> Von: Jose Benjamin Perez Soto [ <mailto:josebenjaminp@gmail.com>
>>>>>
>>>> mailto:josebenjaminp@gmail.com]
>>>>
>>>>
>>>>> Gesendet: Freitag, 30. Juni 2006 08:16
>>>>>
>>>>> An: user@struts.apache.org
>>>>>
>>>>> Betreff: xhtml-mobile with Struts?
>>>>>
>>>>> Hello!
>>>>>
>>>>> Good, my question is, if there is some tool to work with
>>>>>
>>>>> xhtml-mobile with the Struts, like the one of wml, but I need
>>>>>
>>>>> is something for xhtml-mobile.
>>>>>
>>>>> cheers,
>>>>>
>>>>> Ben
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>>
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>>
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message