Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

nullifying a bean value if a form field is empty  RSS feed

 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I got my bean working. Still not sure about all that case sensitivity stuff, but its working so I'm ok for now. Here's my next question on beans.
The first time I submit my form a value gets stuck into the bean. Now, if a field is empty it will be null. This is fine, it will work great for validation later. But, if I use the back button and submit a different search combination and blank out a field that previously had data in it the old value stays in the bean. How do I force it to blow away any old data in the bean upon each form submit? I need empty fields to go back to null and only retain values in the fields of the current search...

thanks a ton

Bryce
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed my scope to request instead of session and that worked. I have a feeling that later on i'll have to resave the data to a different session scope bean because i will need the data on later pages. But this will do for the time being.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bryce Martin:
Ok. I got my bean working. Still not sure about all that case sensitivity stuff

That's all standard JavaBean stuff. I'm sure there's ton of info on JavaBean conventions online or you can dive into the specification. Essentially the first letter of a JavaBean property is lowercased.

With regards to your other issue, I'm going to say this just one more time and then I'll shut up. You are doing yourself a great disservice by adhering to the Model 1 pattern and submitting to a processing JSP. You are just teaching yourself bad habits that you will need to unlearn later. I'd strongly advise starting out on the right foot learning the Model 2 pattern.

I'll be quiet now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!