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

📄 trainsearchpro.jsp

📁 《jsp案例开发》这本书的源代码。包括源代码和相关的具体配置操作步骤。非常不错
💻 JSP
字号:
<%@ page    language="java"    contentType="text/html; charset=GBK"    import="imis.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.util.*,java.sql.*,java.io.*"%><%    request.setCharacterEncoding("GBK");    session=request.getSession();    trainStruct ts = (trainStruct)session.getAttribute("trst") ;    if(ts!=null){    session.removeAttribute("trst") ;    }    userStruct session_us=(userStruct)session.getAttribute("user");    if(session_us==null){    response.sendRedirect("../../login.html");    }    else if((session_us.getAccess().intValue() ==0)||(session_us.getAccess().intValue()==1)||(session_us.getAccess().intValue()==2)||(session_us.getAccess().intValue()==8)){          response.sendRedirect("../../error/access.html") ;    }  else{      try{        Context trainctx = new InitialContext();        Object trainref = trainctx.lookup("TrainController");        TrainControllerHome trainControllerHome = (TrainControllerHome) PortableRemoteObject.narrow(trainref, TrainControllerHome.class);        TrainController traincontroller = trainControllerHome.create();        String trname = request.getParameter("trainname") ;        String trperson = request.getParameter("person") ;        String trtrainperson = request.getParameter("trainperson") ;        Collection collect=new ArrayList();        Collection sel_collect=new ArrayList();       // Collection tr=new ArrayList();        if(!trname.equals("")){          collect = traincontroller.getByName(trname) ;        }else if(!trperson.equals("")){          collect = traincontroller.getByPerson(trperson) ;        }else if(!trtrainperson.equals("")){          collect = traincontroller.getByTrainperson(trtrainperson) ;        }else{          collect = traincontroller.getTrainAll() ;        }        Vector rongqi= new Vector();        //作过滤       trainStruct trainst=null;        Judge judge=new Judge();      Collection temcollection = new ArrayList();        Iterator ii=collect.iterator() ;        while (ii.hasNext() ){           trainst = new trainStruct();           trainst = (trainStruct)ii.next() ;           if (judge.decide(session_us.unitid ,trainst.unitid )){               rongqi.addElement(trainst);           }        }        for(int l=0;l<rongqi.size()-1;l++)          for(int k=l+1;k<rongqi.size();k++)            {            if(((trainStruct)rongqi.elementAt(l)).trainname.equals(((trainStruct)rongqi.elementAt(k)).trainname))                     {                     rongqi.remove(k);                     k--;                       }             }for(int l=0;l<rongqi.size();l++){temcollection.add(rongqi.elementAt(l));}sel_collect.addAll(temcollection);session.setAttribute("trsearchresult",sel_collect) ;response.sendRedirect("trainsearch.jsp");      }      catch(Exception e){         e.printStackTrace() ;      }  }%>

⌨️ 快捷键说明

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