This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts request values" Watch "struts request values" New topic
Author

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?

Thanks,
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30586
    
154

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


[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
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

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 !!!
 
GeeCON Prague 2014
 
subject: struts request values