Hi All How can I show preselected values in struts drop down list box when I bring up the JSP for the first time ? Thanks in advance Ravindra
SCJP, SCJD, SCWCD, SCBCD, SCEA
Adam Hardy
Ranch Hand
Joined: Oct 09, 2001
Posts: 564
posted
0
You have to set the properties of the formbean to the appropriate value during your action. Then in the JSP the corresponding option will be selected. This means the JSP should be accessed first by an action, not by a direct call to the JSP. Set up an action mapping for it. There is of course a quick and dirty work-around - you could just set the value of the property in the formbean with code in the declaration or the reset(). [ November 27, 2002: Message edited by: Adam Hardy ]
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
ravi janap
Ranch Hand
Joined: Nov 04, 2000
Posts: 389
posted
0
Hi Adam The JSP is being accessed by a action and not being invoked directly. The properties in the form bean match the form field attribute name in JSP. I have been succesful in making one drop down value preselected using this solution. I am just wondering where I am going wrong ? Thanks Ravindra
Adam Hardy
Ranch Hand
Joined: Oct 09, 2001
Posts: 564
posted
0
Well, how are you initialising the formbean properties? This should be done in the formbean reset() method or alternatively on declaration of the property member variables, if they're fixed.