JSP bean methods -- PLEASE HELP IF YOU CAN?
I have a JSP page that has one text box with name "BOX1" and another one named "BOX2". I already have get/set methods in a bean for BOX1 but do not for BOX2. I want to have it so that if the user types something in BOX2, then that value will replace BOX1's value that is used in the bean. If nothing is entered, then the value of BOX1 should be used.
Will I have to define get/set methods for BOX2, then retrieve both values in the bean and do the logic there where I check if BOX2 is null, and if so use the value of BOX1, if not use the value of BOX2?
What is the best method of going about this?
[625 byte] By [
CHEERS] at [2007-9-26 2:39:22]

> I have a JSP page that has one text box with name
> "BOX1" and another one named "BOX2". I already have
> get/set methods in a bean for BOX1 but do not for
> BOX2. I want to have it so that if the user types
> something in BOX2, then that value will replace BOX1's
> value that is used in the bean. If nothing is
> entered, then the value of BOX1 should be used.
>
> Will I have to define get/set methods for BOX2, then
> retrieve both values in the bean and do the logic
> there where I check if BOX2 is null, and if so use the
> value of BOX1, if not use the value of BOX2?
>
> What is the best method of going about this?
IMHO, the best way to go about this is to have get the value entered in BOX2 using get method and use the value obtained to set the value of BOX1. This is not too code intensive so it does not matter if u have the code in the JSP page itself...where you retrieve the value from BOX2 for null etc....ideally though, as far as possible you must have code in the beans that support a JSP..leaving the JSP to do the "presentation".
Hope this helps
BOX1 does not allow the user to enter anything as it is a dropdown menu where the user can make a selection. If the user does type in a value in BOX2, then I want to use the value from BOX2 in my bean method and not the selected value of BOX1.
I hope this clarifies a little more as I am still not clear on what you suggested in your response to me.
If anyone knows of how to best go about this, I would really appreciate it.
Thank you!
CHEERS at 2007-6-29 10:11:49 >
