html_checkbox示例

package com.qingyuan.httpclient;

public class AllServerInfo
{
    private String ip;
    
    private String port;
    
    private String contextPath;
    
    private String clusterName;
    
    private String serverType;
    
    private String lastActivityTime;
    
    private String activity;
    
    private String description;
    
    public String getIp()
    {
        return ip;
    }
    
    public void setIp(String ip)
    {
        this.ip = ip;
    }
    
    public String getPort()
    {
        return port;
    }
    
    public void setPort(String port)
    {
        this.port = port;
    }
    
    public String getContextPath()
    {
        return contextPath;
    }
    
    public void setContextPath(String contextPath)
    {
        this.contextPath = contextPath;
    }
    
    public String getClusterName()
    {
        return clusterName;
    }
    
    public void setClusterName(String clusterName)
    {
        this.clusterName = clusterName;
    }
    
    public String getServerType()
    {
        return serverType;
    }
    
    public void setServerType(String serverType)
    {
        this.serverType = serverType;
    }
    
    public String getLastActivityTime()
    {
        return lastActivityTime;
    }
    
    public void setLastActivityTime(String lastActivityTime)
    {
        this.lastActivityTime = lastActivityTime;
    }
    
    public String getActivity()
    {
        return activity;
    }
    
    public void setActivity(String activity)
    {
        this.activity = activity;
    }
    
    public String getDescription()
    {
        return description;
    }
    
    public void setDescription(String description)
    {
        this.description = description;
    }
    
    public AllServerInfo()
    {
        
    }
    
    public AllServerInfo(String ip, String port, String contextPath, String clusterName, String serverType,
        String lastActivityTime, String activity, String description)
    {
        super();
        this.ip = ip;
        this.port = port;
        this.contextPath = contextPath;
        this.clusterName = clusterName;
        this.serverType = serverType;
        this.lastActivityTime = lastActivityTime;
        this.activity = activity;
        this.description = description;
    }

    public String toString()
    {
        return "";
    }
}


package com.qingyuan.httpclient;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ServerInfoServlet extends HttpServlet
{
    
    /** serialVersionUID */
    private static final long serialVersionUID = -8367229371456636932L;

   
    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("");
        this.doPost(request, response);
    }
    
    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        
        response.setContentType("text/html;charset=gbk");
        PrintWriter out = response.getWriter();
        List arrayList = new ArrayList();
        AllServerInfo server = new AllServerInfo("25.111.108.133","8080","ddc","ddc","timer","2015-01-04","active","");
        AllServerInfo server2 = new AllServerInfo("25.111.108.197","8080","ddc","ddc","json","2015-01-04","inactive","");
        AllServerInfo server3 = new AllServerInfo("25.111.108.112","8080","ddc","ddc","ajax","2015-01-04","inactive","");
        AllServerInfo server4 = new AllServerInfo("25.111.108.113","8080","ddc","ddc","ajax","2015-01-04","inactive","");
        AllServerInfo server5 = new AllServerInfo("25.111.108.114","8080","ddc","ddc","json","2015-01-04","inactive","");
        AllServerInfo server6 = new AllServerInfo("25.111.108.115","8080","ddc","ddc","ajax","2015-01-04","inactive","");
        arrayList.add(server);arrayList.add(server2);arrayList.add(server3);
        arrayList.add(server4);arrayList.add(server5);arrayList.add(server6);
        request.setAttribute("allserver", arrayList);
        RequestDispatcher dispatcher = request.getRequestDispatcher("/server.jsp"); 
        dispatcher .forward(request, response); 
    }
    
}

html_checkbox示例_第1张图片

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.qingyuan.httpclient.AllServerInfo"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



  
    
    
  
  
  
     
	   
	  <%
	       Map  map = new HashMap();
		   List remoteServers = (List)request.getAttribute("allserver");
	     
	       for (int i =0; i < remoteServers.size(); i++)
	       { %>
	        
	         <% } %>
	        
ip addressportcontext clusternameservertypelastacitvetime activedescription
<%=remoteServers.get(i).getIp()%> <%=remoteServers.get(i).getPort()%> <%=remoteServers.get(i).getContextPath()%> <%=remoteServers.get(i).getClusterName()%> <% String serverType = remoteServers.get(i).getServerType(); if (serverType == null) { serverType = " "; } Integer num = map.get(serverType); if(num == null) { num = 1; } else { num = num +1; } map.put(serverType,num); out.print(serverType); %> <%=remoteServers.get(i).getLastActivityTime()%> <%=remoteServers.get(i).getActivity()%> <%=remoteServers.get(i).getDescription()%>
totalrecords: <%=remoteServers.size()%> <% for(Map.Entry entry : map.entrySet()) { %> <%=entry.getKey()%>: <%= entry.getValue()%> <% } %>
servertype: <% for(Map.Entry entry : map.entrySet()) { %> <%= entry.getKey()%>  <% } %>

------------------------------------------------------------------------------------------------------------
杂碎:<[不相干的东西]>
// 自定义html标签中的属性:



<%= entry.getKey()%>;
	
var server = new Object();
var ipStr ="";
server.ipStr = ipStr;
window.returnValue = server;
window.close();
var orgaArray = new Array();
window.onload = initOrgaArray;


// http://suo.iteye.com/blog/508572 
window.returnValue使用方法


returnValue是javascript中html的window对象的属性,目的是返回窗口值,当用window.showModalDialog函数打开一个IE的模式窗口
(模式窗口知道吧,就是打开后不能操作父窗口,只能等模式窗口关闭时才能操作)时,用于返回窗口的值,下面举个例子

// HTML_INPUT详细属性方法事件介绍
http://wenku.baidu.com/link?url=Lu-jj5NGqM0iigcnau6AGShdKjfWqoWFrVfQai026rBr
S2bZvzfMn-yfGiprRK5e60dBKaOy3mTifdluvgpaUf8rni_xShcdttJPqgpE9ZS


// html <[自定义标记属性]>

http://www.360doc.com/content/09/1030/14/426899_8092609.shtml

// Map  map = new HashMap();
// Integer num = map.get(serverType);

Integer java.util.Map.get(Object key)
Returns the value to which this map maps the specified key. Returns null if the 
map contains no mapping for this key. A return value of null does not necessarily 
indicate that the map contains no mapping for the key; it's also possible that the 
map explicitly maps the key to null. The containsKey operation may be used to 
distinguish these two cases. 
More formally, if this map contains a mapping from a key k to a value v such that 
(key==null ? k==null : key.equals(k)), then this method returns v; otherwise it 
returns null.


你可能感兴趣的:(html_checkbox示例)