⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlist.jsp

📁 这是一个学习jsp的基本程序
💻 JSP
字号:
<%@ page
    language="java"
    contentType="text/html; charset=GBK"
    import="imis.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.util.*"
%>
<%
  request.setCharacterEncoding("GBK");
  session=request.getSession();
  userStruct user=(userStruct)session.getAttribute("user");
  if(user==null){
  response.sendRedirect("../../login.html");
  }
else{

%>
<%

  session=request.getSession();
   Collection collect=(Collection)session.getAttribute("check");
      userStruct us=new userStruct();
      Iterator i=collect.iterator();
      int count=0;
      int pagecount=0;
      int pages=0;
      int pagesize=10;
      while(i.hasNext()){
      count++;
      i.next();
      }
      if(count%pagesize==0)
      pagecount=count/pagesize;
      else pagecount=count/pagesize+1;
      String strpages=request.getParameter("pages");
      if(strpages==null)
          pages=1;
      else {
          pages=new Integer(strpages).intValue();
          if(pages<=0)
          pages=1;
      }

      Iterator rs =collect.iterator();
      int m;
      for(m=1;m<=(pages-1)*pagesize;m++){
          rs.next();
      }




%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>MSA Office</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb_2312-80">
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
<link rel="stylesheet" href="../../css/msa.css" type="text/css">
<script language="JavaScript" src="../../public/js/table_display.js"></script>
<script language="JavaScript" src="../../public/js/all_checked.js"></script>
<script language="JavaScript" src="../../public/js/user_menu.js"></script>
<script language="javascript" src="../../public/util/openSelect.js"></script>
<script language="javascript" src="../../public/js/getdate.js"></script>
<script language="javascript">
init1();
</script>
<SCRIPT>
window.onload=init
</SCRIPT>
</HEAD>
<BODY class="bg" topMargin=20 leftmargin="0" marginwidth="0" marginheight="0" onclick="h_cele_date()">
<DIV align=center>
    <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
    <TR>
      <TD><IMG height=4 src="../../MacOS/lefttop.gif" width=6></TD>
      <TD background=../../MacOS/top.gif colSpan=3><IMG height=4
      src="../../MacOS/top.gif" width=1></TD>
      <TD><IMG height=4 src="../../MacOS/righttop.gif"></TD>
    </TR>
    <TR>
      <TD vAlign=top background=../../MacOS/lwing.gif rowSpan=3><IMG height=18
      src="../../MacOS/left.gif" width=6></TD>
      <TD vAlign=top background=../../MacOS/titlebg.gif width="16">
        <DIV><a href="../../index.jsp"><img src="../../MacOS/logo.gif" width="16" height="16" border="0" alt="返回MSA_Office首页"></a></DIV>
      </TD>

      <TD vAlign=top noWrap align=center width="100%"
    background=../../MacOS/titlebg.gif><SPAN
      style="BACKGROUND-COLOR: #cecece"><FONT class=strong> MSA - OFFICE </font></SPAN></TD>
        <TD><a href="javascript:self.close()"><IMG height=18 src="../../MacOS/right_b2.gif" width=18 border="0" alt="关闭窗口"></a></TD>
      <TD vAlign=top background=../../MacOS/rwing.gif rowSpan=3><IMG height=18
      src="../../MacOS/right.gif" width=7></TD>
    </TR>
    <TR>
      <TD background=../../MacOS/hr.gif colSpan=3><IMG height=2
      src="../../MacOS/hr.gif" width=1></TD>
    </TR>
    <TR>
        <TD colSpan=3 align="center"> <br> <table width="600" border="1" cellspacing="1" bordercolor="#666666">
            <tr bgcolor="#fafafa">
              <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="2">
  <form name="form1" method="post" action="usersearch1.jsp">
                  <tr bgcolor="#666666">
                    <td width="1008" height="15" colspan="4"> <font class="strongw" >用户信息管理</font></td>
                  </tr>
                  <tr>
                    <td colspan="4">用户管理&gt;&gt;用户信息查询</td>
                  </tr>
                  <tr>
                    <td colspan="4"><font class="strong" >  用户ID:</font>
                      <input type="text" name="userid" class="file">
                      <input type="submit" name="Submit" value="查询" >
                      <input name="reset" type="reset" class="file" id="reset2" value="还原">
                      &lt;&lt;<a href="#" onclick=ChangeDisplay(query)>高级查询</a>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4"><table class=title id=query style="DISPLAY: none" width="100%" border="0" cellspacing="1" cellpadding="2">


                        <tr>
                          <td width="131" bgcolor="#e0e0e0"> <font class="strong">用户权限:</font></td>
                          <td width="463" bgcolor="#e0e0e0">
       <% if(user.userAccess.equals(new Integer(0))){%>
                        <select name="access">
                        <option value="-1">请选择</option>
                        <option value="3">航标处业务主管</option>
                        <option value="6">海区业务主管</option>
                        <option value="11">航标站</option>
                        <option value="12">综合</option>
                        <option value="0">用户管理员</option>
                      </select><%}%>
                      <%if(user.userAccess.equals(new Integer(1))){%>
                         <select name="access">
                        <option value="-1">请选择</option>
                        <option value="9">海事局领导</option>
                        <option value="10">立项录入员</option>
                        <option value="1">用户管理员</option>
                      </select><%}%>
                          </td>
                        </tr>

                      </table></td>
                  </tr>
                </form>
              </table>

              <table class=title cellspacing=1 cellpadding=2 width="100%" border=0>
                <form name="form2" method="post" action="">
                  <tr bgcolor="#666666">
                    <td colspan="4"> <div align="left"><strong><font class="strongw">用户信息列表</font></strong></div></td>
                  </tr>
                  <tr align=middle>
                    <td width="16%"><div align="center"><strong><font  class="strong">用户ID</font></strong></div></td>
                    <td width="25%"><div align="center"><strong><font  class="strong">
                        用户名称</font></strong></div></td>
                    <td width="32%"><div align="center"><strong>用户单位</strong></div></td>
                    <td width="27%"><div align="center"><strong>用户权限</strong></div></td>
                  </tr>


                    <%

                    for(m=1;m<=pagesize;m++){
                        if(rs.hasNext()){
                            us=(userStruct)rs.next();

                        if(m%2==0){
                       %>
                       <tr align=middle bgcolor="#e0e0e0">
                       <%
                         }else
                       {
                       %>
                       <tr align=middle bgcolor="#fafafa">
                       <%
                       }
                       %>
                    <td width="16%" ><a href="userdetails.jsp?userid=<%=us.userId%>">
                        <%=us.userId%></a>
                      </td>
                    <td width="25%" ><a href="userdetails.jsp?userid=<%=us.userId%>"><%=us.userName%></a></td>
                       <%
                         officeUnitStruct ous = new officeUnitStruct();
                        OfficeUnitControllerHome officeUnitControllerHome = null;

                        OfficeUnitController officeUnitController = null;

    //get naming context
         Context ctx = new InitialContext();

         //look up jndi name
         Object ref = ctx.lookup("OfficeUnitController");

         //cast to Home interface
      officeUnitControllerHome = (OfficeUnitControllerHome) PortableRemoteObject.narrow(ref, OfficeUnitControllerHome.class);
          officeUnitController=officeUnitControllerHome.create();
          Collection c=officeUnitController.getUnitid(us.unitid);
          Iterator j=c.iterator();
          ous=(officeUnitStruct)j.next();
System.out.println("name1");
String  unit="";
     if(!ous.equals(""))
     	unit=ous.processname;
     else
      unit = "该单位不存在";
System.out.println("name2");
                      %>
                    <td width="32%" ><%=unit%> </td>

                      <%
                       String access="";
                      if(us.userAccess.equals(new Integer(0))||us.userAccess.equals(new Integer(1)))
                        access="用户管理员";
                      if(us.userAccess.equals(new Integer(2)))
                        access="维护员";
                      if(us.userAccess.equals(new Integer(3)))
                        access="航标处业务主管";
                      if(us.userAccess.equals(new Integer(4)))
                        access="基层测绘主管";
                      if(us.userAccess.equals(new Integer(5)))
                        access="海区录入员";
                      if(us.userAccess.equals(new Integer(6)))
                        access="海区业务主管";
                      if(us.userAccess.equals(new Integer(7)))
                        access="海区测绘主管";
                      if(us.userAccess.equals(new Integer(8)))
                        access="基层物资";
                      if(us.userAccess.equals(new Integer(9)))
                        access="海事局领导";
                      if(us.userAccess.equals(new Integer(10)))
                        access="立项录入员";
                      if(us.userAccess.equals(new Integer(11)))
                        access="航标站";
					  if(us.userAccess.equals(new Integer(12)))
                        access="综合";



                          %>
                    <td width="27%" ><%=access%></td>

                  <%

                        }
                    }
              if(count!=0){

                 %>


                  <tr bgcolor="#e0e0e0">
                    <td colspan="4">
                  <%
                    if(pages!=1){
                      %>
                     <a href="userlist.jsp?pages=<%=(pages-1)%>"><img src="../../images/prev.gif" width="40" height="12" border="0"></a>
                    <%}else{
                    %>
                    <a href="userlist.jsp?pages=1"> <img src="../../images/prev.gif" width="40" height="12" border="0"></a>
                    <%
                    }
                    %>
                   &nbsp;&nbsp;&nbsp;<a href="userlist.jsp?pages=1">第一页</a>&nbsp;&nbsp;&nbsp;<a href="userlist.jsp?pages=<%=pagecount%>">最后一页</a>&nbsp;&nbsp;&nbsp;
                    <%if(pages!=pagecount) {
                    %>
                    <a href="userlist.jsp?pages=<%=(pages+1)%>"> <img src="../../images/next.gif" width="40" height="12" border="0"></a>
                    <%}else{%>
                    <a href="userlist.jsp?pages=<%=pagecount%>"> <img src="../../images/next.gif" width="40" height="12" border="0"></a>
                    <%
                      }
                   }
                    %>
                   &nbsp;第<%=pages%>页&nbsp;共<%=count%>条信息&nbsp;分<%=pagecount%>页显示</td>
                  </tr>
                  <tr align=center bgcolor="#e0e0e0">
                    <td colspan="4" height="30"> <div align="center">

                        <input type="button" name="Submit25" value="添加用户" class="file" onClick="location='userinput.jsp'">
                      </div></td>
                  </tr>
                </form>
              </table>
              </td>
            </tr>
          </table>
         <br><br>
            <img src="../../images/msalogo.gif" width="272" height="50">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr>
              <td height="3"><img src="a.gif" width="1" height="1"></td>
            </tr>
            <tr>
              <td background="../../MacOS/hr.gif"><img src="../../MacOS/hr.gif" width="1" height="2"></td>
            </tr>
             <tr>
              <td height="3"><img src="a.gif" width="1" height="1"></td>
            </tr>
          </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td> <div align="right"><a href="../../help.htm" target="blank" style="cursor:help" title="使用帮助"><img src="../../MacOS/help.gif" width="16" height="16" border="0">HELP</a></div></td>
          </tr>
        </table></TD>
    </TR>
    <TR>
      <TD height="7"><IMG height=7 src="../../MacOS/leftbottom.gif" width=6></TD>
      <TD background=../../MacOS/bottom.gif colSpan=3><IMG height=7
      src="../../MacOS/bottom.gif" width=1></TD>
      <TD><IMG height=7 src="../../MacOS/rightbottom.gif"
width=7></TD>
    </TR>
    </TABLE>
  <BR>
  <TABLE cellSpacing=1 cellPadding=2 width="300" border=0>
    <TBODY>
      <TR>
        <TD align=center><FONT class=footer><IMG height=1
      src="MacOS/hr_black.gif" width="100%"><BR>
	  Orient Super Net MSA-OFFICE System V1.2
            </FONT></TD>
      </TR>
    </TBODY>
  </TABLE>
</DIV>
</BODY></HTML>
<%}%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -