Thanks for your question. When manipulating the view programmatically you must be aware that you're taking the reins from the tag layer at a fundamental level. Therefore, you must be very aware of how the lifecycle works with respect to the timing of when properties are written to and read from. There's nothing wrong with doing this, but it's just a concern you have to be aware of.
First, make sure TestBean is in request scope. Second, make the getter for the menu property lazily initialize the menu ivar to a new instance of HtmlSelectOneMenu, populated as you've done in your ActionListner (you don't need the actionListener for this purpose any more). Third, make sure to call setValueExpression("value", yourExpression") to the place where you want the selected value to be stored.
Thank you very much for your reply. I changed the scope of my bean from session to request scope, and it works like a charm. Also, thank you for suggesting lazy initialization for my variables, I'll keep that in mind. Once again, many thanks for your help!