Package com.simoncat.actions

Source Code of com.simoncat.actions.ServerMonitorAction

package com.simoncat.actions;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.simoncat.vo.Server;
import com.simoncat.beans.InstallWebAppOutput;
import com.simoncat.Constants;
import java.util.Collection;
import java.util.ArrayList;

import com.simoncat.beans.XMLServers;

import com.simoncat.vo.HTMLFormField;

public final class ServerMonitorAction extends Action {

   public ActionForward execute(ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response) throws Exception {
      System.out.println("1")
      //HttpSession session = request.getSession();
      System.out.println("2");   
      Server ss[];
        
   
      XMLServers xmlserver = new XMLServers();
      ss=xmlserver.readXmls("", this.getServlet().getServletContext());
      System.out.println("3")


      // Now, let's prepare output
      InstallWebAppOutput iwao = new InstallWebAppOutput();
      iwao.setPageTitle    ("Server Monitor");
      iwao.setFormAction   ("Install.do");
      iwao.setEnctype("multipart/form-data");
      iwao.setFormMethod   ("POST");
     
      // HTML form's fields
    Collection fco = new ArrayList();
      HTMLFormField hff1 = new HTMLFormField();
      hff1.setTitle ("c1");
      hff1.setName  ("c1");
      hff1.setType  ("hidden");
      hff1.setSize  ("25");
      hff1.setValue ( null );
      fco.add (hff1);
      HTMLFormField hff2 = new HTMLFormField();
      hff2.setTitle ("c2");
      hff2.setName  ("c2");
      hff2.setType  ("text");
      hff2.setSize  ("25");
      hff2.setValue ( null );
      fco.add (hff2);


      iwao.setFields(fco);


    System.out.println("4")

       Collection coo = new ArrayList();
      for(int j=0;j<ss.length;j++
              coo.add (ss[j]);
  System.out.println("5");    

      iwao.setServers(coo);
  System.out.println("6")
      if (Constants.xmlOutputOnly) {
          request.setAttribute ("content", Constants.xmlContentType);
      } else {
          request.setAttribute ("content", Constants.htmlContentType);
          request.setAttribute ("style", "installWebApp.xsl");
      }
System.out.println("7")
      request.setAttribute ("form", iwao);
System.out.println("8")
      return (mapping.findForward(Constants.XMLHandler));
   }

}
TOP

Related Classes of com.simoncat.actions.ServerMonitorAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.