Created
October 5, 2012 17:23
-
-
Save ZuluagaSD/3841143 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebServlet(name = "Principal", urlPatterns = {"/Principal"}) | |
public class Principal extends HttpServlet { | |
@Override | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) | |
throws ServletException, IOException { | |
String user = request.getParameter("user"); | |
String pass = request.getParameter("pass"); | |
String ip = request.getParameter("ip"); | |
PrincipalDAO principalDAO = new PrincipalDAO(); | |
// ArrayList<String[]> resultArr = principalDAO.Connect(user, pass, ip); | |
// Testing | |
ArrayList<String[]> resultArr = new ArrayList<String[]>(); | |
String[] a = {"SCMPRB013MDE", "poweredOn", "running", "Microsoft Windows Server 2003 (32-bit)", "172.26.1.29", "SCMPRB013MDE.ads.loc", "2", "2", "1", "Colcafe_MES",}; | |
String[] b = {"SCMADS023MDE", "poweredOn", "notRunning", "Microsoft Windows Server 2008 R2 (64-bit)", "null", "null", "4", "1", "1", "Infraestructura_1",}; | |
String[] c = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",}; | |
resultArr.add(a); | |
resultArr.add(b); | |
resultArr.add(c); | |
PrintWriter pout = response.getWriter(); | |
pout.print("<h1>I´ve found: " + resultArr.size() + " Virtual Machines</h1>"); | |
pout.print("<table border='1' style=''><tr>"); | |
pout.print("<th>#</th>"); | |
pout.print("<th>Virtual Machine Name:</th>"); | |
pout.print("<th>Status:</th>"); | |
pout.print("<th>VMWare Tools State:</th>"); | |
pout.print("<th>Operating System</th>"); | |
pout.print("<th>IP Address:</th>"); | |
pout.print("<th>Host:</th>"); | |
pout.print("<th>Memory in GB:</th>"); | |
pout.print("<th>Number of Cores:</th>"); | |
pout.print("<th>Number of Data Stores:</th>"); | |
pout.print("<th>Number</th>"); | |
pout.print("</tr>"); | |
for (int i = 0; i < resultArr.size(); i++) { | |
pout.print("<tr>"); | |
pout.print("<td>" + (i + 1) + "</td>"); | |
for (int j = 0; j < 10; j++) { | |
pout.print("<td>" + resultArr.get(i)[j] + "</td>"); | |
} | |
pout.print("</tr>"); | |
} | |
pout.print("</table>"); | |
pout.close(); | |
} | |
@Override | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) | |
throws ServletException, IOException { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
resultArr.get(i).length