Hi,
I have a problem with my application. I use the struts framework, and on a click of a link, I call a javascript function that sets values in the forms hidden fields, and then submit it. Once I arrive in the struts action, I get some of the parameters and add them in the session for later access.
When using a browser, everything works fine, but when I use HTTPUnit, for some reason, when I reach the struts action, the value in the form is always set to 0.... any clue on what could be the reason for this? I'm not assigning any default value in the struts form, (so I guess, being an int, it sets it to 0 as default), so I'm kind of lost as to what can cause it to work with a browser and not in httpunit.
TIA!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-02-12
I just found out a bit more on this issue.
If I'm using an int type parameter in my Struts form, on a submit, when using httpunit, it sets the value of the parameter to xx.0 , so when I try to use this as an int, it does'nt work. If I change every parameter to be a string and that I convert it to an integer, things seems to be working correctly. Should'nt an int parameter be supported?? it works fine with my system in a simple browser, but not with httpunit who set xx.0 when passing by Javascript... very strange behaviour.. I hope this help find what's causing this.
TIA!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-02-12
Ok, I've re-read myself and it's not that clear.. ;)
The int parameter is set by an href="javascript:someMethod(xx);" where xx is the id that will be set in the form parameter value
(with this line -> document.myForm.id.value = id).
for some reason, when the system goes in this method, instead of simply using the id (which is definitely an integer), it puts a .0 at the end in the HTML hidden field, but when I reach the action class, the value is now 0. I assume there is some conversion done by the struts servlet, but no error are shown.. anyways..
if I change my parameter to a String, I receive the xx.0 value, but I can convert it to an int. This should'nt have to be done.. since the other way worked fine with my application. The error might be in the javascript utility classes... but it still should'nt behave like this.
now.. I hope this will help solve the problem.. or maybe find what I'm doing wrong if it's not a problem with httpunit...
TIA
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a problem with my application. I use the struts framework, and on a click of a link, I call a javascript function that sets values in the forms hidden fields, and then submit it. Once I arrive in the struts action, I get some of the parameters and add them in the session for later access.
When using a browser, everything works fine, but when I use HTTPUnit, for some reason, when I reach the struts action, the value in the form is always set to 0.... any clue on what could be the reason for this? I'm not assigning any default value in the struts form, (so I guess, being an int, it sets it to 0 as default), so I'm kind of lost as to what can cause it to work with a browser and not in httpunit.
TIA!!
I just found out a bit more on this issue.
If I'm using an int type parameter in my Struts form, on a submit, when using httpunit, it sets the value of the parameter to xx.0 , so when I try to use this as an int, it does'nt work. If I change every parameter to be a string and that I convert it to an integer, things seems to be working correctly. Should'nt an int parameter be supported?? it works fine with my system in a simple browser, but not with httpunit who set xx.0 when passing by Javascript... very strange behaviour.. I hope this help find what's causing this.
TIA!
Ok, I've re-read myself and it's not that clear.. ;)
The int parameter is set by an href="javascript:someMethod(xx);" where xx is the id that will be set in the form parameter value
(with this line -> document.myForm.id.value = id).
for some reason, when the system goes in this method, instead of simply using the id (which is definitely an integer), it puts a .0 at the end in the HTML hidden field, but when I reach the action class, the value is now 0. I assume there is some conversion done by the struts servlet, but no error are shown.. anyways..
if I change my parameter to a String, I receive the xx.0 value, but I can convert it to an int. This should'nt have to be done.. since the other way worked fine with my application. The error might be in the javascript utility classes... but it still should'nt behave like this.
now.. I hope this will help solve the problem.. or maybe find what I'm doing wrong if it's not a problem with httpunit...
TIA