我的 JSP 页面中有一个三个单选按钮。我正在根据选择的单选按钮显示多选框。但是在提交表单时,我从两个选择框中得到空值。其他选择框工作正常。
谁能帮我?
<script type="text/javascript">
$(document).ready(function(){
$('.show').hide();
$("input[name$='application']").click(function() {
var test = $(this).val();
$("div.show").hide();
$('#showemma').hide();
$('#showdmfota').hide();
$('#showuep').hide();
$("#show" + test).show();
});
});
</script>
<title>Add Config Changes</title>
</head>
<body>
<%
Server env = new Server();
Map<String, List<String>> map = env.getServer();
Properties property = new Properties();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
property.load(classLoader.getResourceAsStream("error.properties"));
%>
<h3> Add Configuration Change</h3> <br><br>
<form action="_config" method="post">
<table align="center" id ="login">
<tr>
<td>Application</td>
<td>
<div class="radio" style="font-size:12px;">
<label><input type="radio" name="application" id="fota" value="dmfota"> DMFOTA</label>
<label><input type="radio" name="application" id="uep" value="uep"> UEP</label>
<label><input type="radio" name="application" id="emma" value="emma"> EMMA</label>
</div>
</td>
<td id="error"><p id ="applicationError"><%=property.getProperty("applicationError") %></p></td>
</tr>
<% for (String serverNamekey : map.keySet()){%>
<tr id="show<%= serverNamekey %>" class="show" style='display:none'>
<td>Server</td>
<td>
<% List<String> servers = map.get(serverNamekey); %>
<select name="server" id="server" multiple="multiple" style="width:150px; height: 150px;">
<%for (String serverName : servers){ %>
<option value="<%=serverName%>"><%=serverName%></option>
<%} %>
</select>
</td>
<td id="error"><p id ="serverError"><%=property.getProperty("serverError") %></p></td>
</tr>
<%} %>
<tr>
<td colspan =2><input type="submit" value="Add Change Log" id="configSubmit" class="submit"></td>
</tr>
</table>
</form>
</body>
</html>
</table>
</form>
</body>