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

📄 subdel.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 if(user.getAccess().intValue()==3||user.getAccess().intValue()==4){

%>

<%



officeUnitStruct ous = new officeUnitStruct();
try{
       Context ctx = new InitialContext();
       Object ref = ctx.lookup("OfficeUnitController");
       OfficeUnitControllerHome officeUnitControllerHome = (OfficeUnitControllerHome) PortableRemoteObject.narrow(ref, OfficeUnitControllerHome.class);
       OfficeUnitController officeUnitController=officeUnitControllerHome.create();

       Context uctx = new InitialContext();
       Object uref = uctx.lookup("UserController");
       UserControllerHome userControllerHome = (UserControllerHome) PortableRemoteObject.narrow(uref, UserControllerHome.class);
       UserController userController = userControllerHome.create();

       String id = request.getParameter("unitid");
       Integer idd = new Integer(id);
System.out.println("idd="+idd);
       Collection icoll=userController.getAll();
       Iterator ii = icoll.iterator();
       while(ii.hasNext())
       {
         userStruct us=(userStruct)ii.next();
         if(us.unitid.intValue() == idd.intValue()){
           System.out.println("us.unitid="+us.unitid+"idd="+idd+"userid="+us.userId);
           userController.removeRecord(us.userId);
         }
}

     boolean ok = false;
     ok = officeUnitController.remove(idd);
     if(ok){
         response.sendRedirect("subdelsuccess.html");
     }

}
catch(Exception e){
e.printStackTrace();
response.sendRedirect("../../error/deleteerror.html");
 }

%>


<%}else{
    response.sendRedirect("../../error/accesserror.html");
}%>

⌨️ 快捷键说明

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