• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts request values

 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a form which has Id field text boxes I had to declare them as long in my form bean because database will store values long data type but in db those are integer type. here my problem is when the id fields are empty you submit the page you will get '0' instead of null so finally database will be updated with '0' but I want to update it as null.

Can anybody help me in this scenario?

Thanks,
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34870
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could define them as String in the form and parse them to int/long in Java.
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks for your response. I have that in my mind I wonder is there any other way with out parsing again this would be extra work right? that is what my concern is.
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could any one please help in this?

Actually when I declared it as string I get empty string but when I need to store it into database that perticular field declared as number.

So if try to convert the string value to Long or Integer it throws me an exception. How to handle this situation?

Please help me !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic