Hi there. I need help learning how to deal with string variables that may or may not be null in a JSP page.I have a program which (in simplified form) looks like this...
Main.jsp
(1) Goes to class where several users are selected. Each user's user info is put into tokenized format and added to a vector. Each vector element looks like this...
"username{firstname{lastname" IE/ USER_B{JACK{SMITH
(2) The username is NEVER null but the firstname and lastname can be and often are null.
(3) When the Vector is returned each row of user information is detokenized and put into a row in a table.
(4) The user can click on a row to go to EditUser.jsp and all of that user's data is passed as parameters to that page.
EditUser.jsp
(1) Each peice of the user's info is retrieved using request.getParameter
(2) The data is put into the form which can then be used to edit the user's information.
(3) On submit the form submits the form data to UpdateUser.jsp
My problem is figuring out how can I make my table on Main.jsp display correctly when firstname and/or lastname are null. I tried setting any null strings to &-nbsp on Main.jsp so it would look nice in the table. Unfortunately, when the form is submitted it then sends those blank spaces to EditUser.jsp. They need to be null.
Does anyone have any suggestions as to how I can approach this? Any suggestions would be appreciated.
Thanks,
CrystalVisualBOracle|-0
Main.jsp
(1) Goes to class where several users are selected. Each user's user info is put into tokenized format and added to a vector. Each vector element looks like this...
"username{firstname{lastname" IE/ USER_B{JACK{SMITH
(2) The username is NEVER null but the firstname and lastname can be and often are null.
(3) When the Vector is returned each row of user information is detokenized and put into a row in a table.
(4) The user can click on a row to go to EditUser.jsp and all of that user's data is passed as parameters to that page.
EditUser.jsp
(1) Each peice of the user's info is retrieved using request.getParameter
(2) The data is put into the form which can then be used to edit the user's information.
(3) On submit the form submits the form data to UpdateUser.jsp
My problem is figuring out how can I make my table on Main.jsp display correctly when firstname and/or lastname are null. I tried setting any null strings to &-nbsp on Main.jsp so it would look nice in the table. Unfortunately, when the form is submitted it then sends those blank spaces to EditUser.jsp. They need to be null.
Does anyone have any suggestions as to how I can approach this? Any suggestions would be appreciated.
Thanks,
CrystalVisualBOracle|-0