Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange struts behavior

 
N Nanda
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic