Пример #1
0
  @Action
  public void doPost() throws ServletException, IOException, PortalServiceException {

    response.setCharacterEncoding("utf-8");
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();

    String pk_group = request.getParameter("pk_group");
    PtPageVO[] pages = new PtPageVO[] {};
    pages = PortalServiceUtil.getPageQryService().getPageByGroup(pk_group);
    Document doc = buildXml(pages);
    XMLUtil.printDOMTree(out, doc, 0, "UTF-8");
    out.println();
  }
Пример #2
0
  public Document buildXml(PtPageVO[] vos) {
    Document doc = XMLUtil.getNewDocument();
    Element root = doc.createElement("Pages");
    doc.appendChild(root);
    if (vos == null) return doc;

    for (int i = 0; i < vos.length; i++) {
      PtPageVO vo = vos[i];
      Element child = doc.createElement("Page");
      child.setAttribute("id", vo.getParentid());
      child.setAttribute("name", vo.getPagename());
      child.setAttribute("pk_page", vo.getPk_portalpage());
      root.appendChild(child);
    }
    return doc;
  }