Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Strange struts behavior Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Strange struts behavior" Watch "Strange struts behavior" New topic
Author

Strange struts behavior

N Nanda
Ranch Hand

Joined: Feb 09, 2004
Posts: 62
Hi to all... I am using struts to develop a web application. I am using mySQL as my backend database. I have a form namely "testForm" which has 2 fields (1 primary key field). When I am saving something into that database from my form with primary key field as blank, it is saved. But logically it should throw an exception (may be SQLException). In database that blank field value is entered as "". Kindly help me to resolve this problem if anybody has a good explanation.

Thanks all in advance.

Niranjan Nanda
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Niranjan,
In the validate() method of your form, check that the primary key is not an empty string. If it is, you return an ActionError and the original form is redisplayed.


[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
 
wood burning stoves
 
subject: Strange struts behavior