我有2个单选按钮,根据特定条件,其中一个可以是默认的单选按钮。我一直试图让他们违约而没有成功。
JSP页面:
<fieldset>
<legend>Select Target File</legend>
<s:radio id="targetFileRadioSelect" name="targetFileRadio" title="Select Baseline Configuration File" list="#{'S' : 'Select Baseline Configuration File'}" value ="targetFileValue"/>
<s:select list="targetFilesList" name="selectedTargetFile" />
<s:radio id="targetFileRadioCreate" name="targetFileRadio" title="Create Base Baseline Configuration File" list="#{'C' : 'Create Base Baseline Configuration File'}" value ="targetFileValue"/>
<label>File Name:</label>
<input id="targetFileName" name="targetFileName" size="20" maxlength="50" style="visibility : visible" type="text" value="<s:property value='targetFileName'/>" />
<label>File Description:</label>
<input id="targetFileDescription" name="targetFileDescription" size="20" maxlength="50" style="visibility : visible" type="text" value="<s:property value='targetFileDescription'/>" />
</fieldset>
我在动作类中创建了属性,这就是它的设置方式:
private String targetFileValue;
public String getTargetFileValue() {
return targetFileValue;
}
public void setTargetFileValue(String targetFileValue) {
this.targetFileValue = targetFileValue;
}
if(extensionMatch == null)
{
// No extension matched default to the Create New Radio Button
setTargetFileValue("C");
}
else
{
// An extension match was found default to Select Baseline Radio Button and make the matching extension be first in the list
setTargetFileValue("S");
}
有什么我可能会看的吗?