DO NOT REPLY [Bug 11050] - No way to properly validate form properties of types other than String

2002-07-23 Thread bugzilla

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050

No way to properly  validate form properties of types other than String





--- Additional Comments From [EMAIL PROTECTED]  2002-07-23 06:25 ---
How are you handling the user input of date fields into nested beans of any 
type other than string?.  Anything other than a perfectly formatted String will 
puke all over the page.  Even if you gracefully handle the exception, you can't 
redisplay and ask for corrections.  This must be handled within your own action 
or actionform.

I vote +1 to close this issue as Invalid or Won't Fix.

It has been made clear in several threads over the course of the last year that 
the current functionality is the desired approach.

If someone needs different behaviour, please consider a customized copy of the 
distribution.

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




DO NOT REPLY [Bug 11050] - No way to properly validate form properties of types other than String

2002-07-23 Thread bugzilla

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050

No way to properly  validate form properties of types other than String

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||WONTFIX



--- Additional Comments From [EMAIL PROTECTED]  2002-07-23 16:47 ---
OK, I agree, form properties should be Strings.

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




DO NOT REPLY [Bug 11050] - No way to properly validate form properties of types other than String

2002-07-22 Thread bugzilla

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050

No way to properly  validate form properties of types other than String

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX



--- Additional Comments From [EMAIL PROTECTED]  2002-07-22 18:56 ---
The best, and recognised, practice is to using Strings for all of your form 
bean properties. Apart from the problems you are seeing, using an Integer also 
results in incorrect feedback being given to the user when validation fails. If 
the user typed abc into a field that was supposed to be numeric, using an 
Integer property would result in 0 being displayed, along with a message 
saying that the value they entered was not numeric. Clearly, what you want is 
to redisplay the original, invalid, value they entered, instead of 0. To do 
that, you need to use a String property.

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




DO NOT REPLY [Bug 11050] - No way to properly validate form properties of types other than String

2002-07-22 Thread bugzilla

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050

No way to properly  validate form properties of types other than String





--- Additional Comments From [EMAIL PROTECTED]  2002-07-22 20:39 ---
I understand what you are saying. My main intention was to reuse existing data
beans as a nested properties of the form bean. 
For example, consider a User bean with name, password and age properties.
Age is numeric property. Now I can define a form bean, which will contain user
property of type User. I can even easily define form as dynamic with dynamic
user property:

form-bean name=createUserForm 
   type=org.apache.struts.validator.DynaValidatorForm dynamic=true
form-property name=user type=User/
/form-bean

Now I can have the following in my JSP pages:

...
html:form action=/createuser
nested:nest property=user
table
tr
thbean:message key=user.name//th
tdnested:text property=name//td
/tr
tr
thbean:message key=user.password//th
tdnested:password property=password redisplay=false//td
/tr
tr
thbean:message key=user.age//th
tdnested:text property=age//td
/tr
/table
/nested:nest
/html:form

... and validation rules:

form-validation
formset
form name=createUserForm
field property=user.name
depends=required
arg0 key=user.name/
/field
field property=user.password
depends=required, minlength
arg0 key=user.password/
arg1 name=minlength key=${var:minlength} resource=false/
var
var-nameminlength/var-name
var-value5/var-value
/var
/field
field property=user.age
depends=required, integer
arg0 key=user.age/
/field
form name=createUserForm
formset
form-validation
...

Everything works fine except age validation, like I described before.

One of the reasons of resusing existing bean is that I can copy it back and
forth between the form and buisness logic objects using
PropertyUtils.copyProperties() or similar methods:

public class CreateUserAction extends Action
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException, WorkitemException
{
CreateUserCommand = new CreateUserCommand(); // business logic

if (form != null)
ActionHelpier.copyProperties(command, form);

comand.execute();
   ...
}

I could have used Strings for form bean properties, but struts tags will fail to
resolve nested properties. For example, I could have defined my form bean as
follows:

form-bean name=createUserForm 
   type=org.apache.struts.validator.DynaValidatorForm dynamic=true
form-property name=user.name type=java.lang.String/
form-property name=user.password type=java.lang.String/
form-property name=user.age type=java.lang.String/
/form-bean

Form properties would be converted from String into native User bean property
types, but I can't make struts tag libraries work with nested forms properties
defined as above...

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




DO NOT REPLY [Bug 11050] - No way to properly validate form properties of types other than String

2002-07-22 Thread bugzilla

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11050

No way to properly  validate form properties of types other than String

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|WONTFIX |



--- Additional Comments From [EMAIL PROTECTED]  2002-07-22 20:40 ---
I'm reopening this bug just to draw other's attention to my previous comments :-)

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