-none- 2007-08-14 - By Laurie Harper
Back Session A Mwamufiya wrote: > Hi, > > I started a thread on this topic a while back, but the example I was guided to was hard to understand and implement. > > The question is straight forward: How do you get the value of a checkbox from within an action? > > - I have named my <s:checkbox> in the jsp, and have a private String element with the same name in my action > - I have created get/set methods > > Each time I try to obtain the value when a button is pressed, I get null, regardless of whether the checkbox is clicked or not. > > It's easy and straight forward to get the value of other tags (textfield, selectbox, ...), so I'm thinking that there's something more for checkboxes. Do I need to set an interceptor? Please let me know whether I'm missing something here.
It's hard to see if there's anything missing without seeing what you have... Assuming you are using the default interceptor stack, you don't need to add anything. If you have a custom stack, you may be missing something relevant.
Other than that, specifying a 'name' attribute on the s:checkbox tag that has a corresponding getter/setter pair in the action should be sufficient, so if it's not working there must be something out of whack somewhere. I would suggest reducing it to the simplest possible jsp page / action / configuration that reproduces the problem, and then post what you have for review.
L.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|