session中存有UserVO值对象,其中有networkListMap(当前用户所创建的network,以network的name为key,network的信息为value),当前用户所在的network信息(name,description),当前用户可以点击页面上的network列表切换network.
<select name="select" class="formlog" id="networkSelect">
<s:iterator value="#session.UserVO.networkListMap" status="networks">
<option value="${key}" <s:if test="%{#session.UserVO.name==key}">selected="selected"</s:if> onclick="VpnService.switchNetwork()">
<s:property value="key"/>
</option>
</s:iterator>
</select>
//运用命名空间封装JS方法
var VpnService = {
switchNetwork : function(){
window.location.href = webPath+ "/defaultNetwork?name="+ $("#networkSelect").val();
}
}