<%@page import="javax.jdo.*,PrjPackage.*,java.util.Iterator,java.net.*"%> <%@page isThreadSafe="false" %> <%-- more efficient and safe in a website which is not too loaded --%> <%! static { WebAppMgr.enhanceAll(); } %> www.downloads.com <% PersistenceManager pm = WebAppMgr.getPersistenceManager(application); try{ // Obtain a PersistenceManager instance: String mode=request.getParameter("mode"); String catid= request.getParameter("catid"); String compn = request.getParameter("compn"); String progn = request.getParameter("progn"); String progv = request.getParameter("progv"); String myURL=request.getParameter("myURL"); // String stat=request.getParemeter("stat"); if(catid!=null) { if (!("".equals(compn)) && !("".equals(progn)) && !("http://".equals(progv)) && compn!=null && progn!=null && progv!=null) { URL url=new URL(progv); try{ pm.currentTransaction().begin(); Object id = pm.newObjectIdInstance(Cate.class,catid); Cate dir =(Cate)pm.getObjectById(id, true); myIt myitem=new myIt(compn,progn,progv,0); pm.makePersistent(myitem); dir.addIts(myitem); pm.currentTransaction().commit(); } catch(Exception x) { %> <%=x.getMessage()%> <%;} finally { if (pm.currentTransaction().isActive()) pm.currentTransaction().rollback(); } }else { if (!("http://".equals(myURL)) && myURL!=null) { try{ pm.currentTransaction().begin(); Object id = pm.newObjectIdInstance(Cate.class,catid); Cate dir =(Cate)pm.getObjectById(id, true); myIt myitem=new myIt(myURL); pm.makePersistent(myitem); dir.addIts(myitem); pm.currentTransaction().commit(); } catch(Exception x) {%><%//=x.getMessage()%><%;} finally { if (pm.currentTransaction().isActive()) pm.currentTransaction().rollback(); } } } }%>



CATEGORIES

 add Category or Item, Click here


    <% String catNum=request.getParameter("id"); if(catNum==null) { Extent extent = pm.getExtent(Cate.class,false); Iterator itr = extent.iterator(); int ii=1; int inde=2; while (itr.hasNext()) { Cate cat = (Cate)itr.next(); if ("html".equals(mode)) {%> <%=ii++%>) <%=cat.toString()%>

    <%} else{%> <%=ii++%>) <%=cat.toString()%>

    <%} inde++; } extent.close(itr); if (mode==null) { %> <%if(!"html".equals(mode)) {%> <%} } }else { Object id = pm.newObjectIdInstance(myIt.class,catNum); Cate dir = (Cate)pm.getObjectById(id, true); %> Category <%=dir.toString()%>
      <% Iterator itr = dir.getmyIt().iterator(); while (itr.hasNext()) { myIt item = (myIt)itr.next();%>
       <%=item.getCN()%>

         Download from <%=item.getPN()%>

        <%=item.getPV()%>

      <% } if("html".equals(mode)) {%> Back Home <%} else {%> Back Home <%} // pm.close();%>

    <% pm.close(); } } catch(Exception x) {%>

    Error Happend :<%=x.getMessage()%>

    try again <%} finally { if (!pm.isClosed()) pm.close(); } %>