aspose file tools
The moose likes Struts and the fly likes struts request values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts request values" Watch "struts request values" New topic

struts request values

jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
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?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31683

You could define them as String in the form and parse them to int/long in Java.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70

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

Joined: Dec 17, 2009
Posts: 70
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 !!!
I agree. Here's the link:
subject: struts request values