开发者

default radio to yes in struts 1.3

开发者 https://www.devze.com 2023-03-10 08:07 出处:网络
<nested:radio property=\"sendFlag\" value=\"Yes\" onclick=\"showDiv();\" />Yes<nested:radio property=\"sendFlag\" value=\"No\" onclick=\"hideDiv();\" />No
<nested:radio property="sendFlag" value="Yes" onclick="showDiv();" />Yes<nested:radio property="sendFlag" value="No" onclick="hideDiv();" />No

The above code defaults to No, on my jsp. Is there 开发者_运维问答a way in which I can allow the Yes button to be selected by default


On your ActionForm where sendFlag attribute is found, do this:

private boolean sendFlag = true;

If that doesn't work, override the reset() method by setting the sendFlag to true.

That way, when Struts renders the sendFlag, it will tick it.

0

精彩评论

暂无评论...
验证码 换一张
取 消