| Author |
html:select vanishing values
|
Ardoks Mathews
Greenhorn
Joined: Feb 21, 2005
Posts: 2
|
|
Hi I am using a html:select with multiple = true , i am populating it with a string array and accessing selecting values with another values like code gere <html:select property="arrsel" multiple ="true"> <html ptions property="arrpop" /> </html:select> where arrsel is the string array which gets filled up on selecting values and arrpop is string array for fetching values from form object, it is working fine but problem i am having is after selecting values if due to some validation error or or i have to go back the the select box becomes empty there are no values left which were coming earlier, although all other values in other fields like html:text are coming back fine, can somebidy help me with this please I am using a reset method in form object as public void reset(ActionMapping mapping, HttpServletRequest request) { arrpop = new String[0]; } which if i don't use it get a null pointer exception that arrpop is null, i found on net i should use it. I initialise my arrays like this in form private String[] arrpop; private String[] arrsel ; and have got getter and setter for them I am using session scope, so scope should not be a problem. Thanks so much
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Ardokos, Try replacing the codde in your reset method with the following: The reset() method does get called if validation fails, so this is why your values are getting wiped out. If you repplace arrpop with an empty array only if it is null, I think this should solve the problem. Merrill
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: html:select vanishing values
|
|
|