Package org.apache.jsp

Source Code of org.apache.jsp.groups_jsp

package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import com.opensymphony.module.user.UserManager;
import java.util.Collection;
import java.util.Iterator;
import com.opensymphony.module.user.User;
import java.net.URLEncoder;
import com.opensymphony.module.user.Group;

public class groups_jsp extends HttpJspBase {


  private static java.util.Vector _jspx_includes;

  static {
    _jspx_includes = new java.util.Vector(1);
    _jspx_includes.add("/manager/nav.jsp");
  }

  public java.util.List getIncludes() {
    return _jspx_includes;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
            null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n");

  UserManager um = UserManager.getInstance();

  if (request.getParameter("addGroup") != null)
  {
    Group newgroup = um.createGroup(request.getParameter("name"));
  }
  else if (request.getParameter("delGroup") != null)
  {
    Group removegroup = um.getGroup(request.getParameter("delGroup"));
    removegroup.remove();
  }
      out.write("\r\n\r\n");
      out.write("<h1>Groups");
      out.write("</h1>\r\n");
      out.write("<hr>\r\n");
      out.write("<ol>\r\n");

  Collection groups = um.getGroups();
  for (Iterator iterator = groups.iterator(); iterator.hasNext();)
  {
    Group group = (Group) iterator.next();
          out.write("\r\n\t\t");
      out.write("<li>");
      out.print( group.getName() );
      out.write(" [");
      out.write("<a href=\"viewgroup.jsp?name=");
      out.print( URLEncoder.encode(group.getName()) );
      out.write("\">View");
      out.write("</a> | ");
      out.write("<a href=\"groups.jsp?delGroup=");
      out.print( URLEncoder.encode(group.getName()) );
      out.write("\">Del");
      out.write("</a>]");
      out.write("</li>\r\n\t\t");

  }
      out.write("\r\n");
      out.write("</ol>\r\n\r\n");
      out.write("<hr>\r\n\r\n");
      out.write("<form action=\"groups.jsp\">\r\n");
      out.write("<b>Add Group");
      out.write("</b>");
      out.write("<br>\r\nName: ");
      out.write("<input type=\"text\" name=\"name\">");
      out.write("<br>\r\n");
      out.write("<input type=\"submit\" name=\"addGroup\" value=\"Add group\">\r\n");
      out.write("</form>\r\n\r\n");
      out.write("<hr>\r\n");
      out.write("<a href=\"default.jsp\">Home");
      out.write("</a> |\r\n");
      out.write("<a href=\"users.jsp\">Users");
      out.write("</a> |\r\n");
      out.write("<a href=\"groups.jsp\">Groups");
      out.write("</a>\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0)
        out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
}
TOP

Related Classes of org.apache.jsp.groups_jsp

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.