Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* 
   * Copyright (C) 2010---2013 星星(wuweixing)<349446658@qq.com>
   * 
   * This file is part of Wabacus 
   * 
   * Wabacus is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 package com.wabacus.system.component.application.jsp;
 
 import java.util.List;
 
 
 
 public class JspTemplateApp extends AbsApplicationType
 {
     private JspComponentBean jspConfigBean;
 
     public JspTemplateApp(AbsContainerType parentContainerType,IComponentConfigBean comCfgBean,ReportRequest rrequest)
     {
         super(parentContainerType,comCfgBean,rrequest);
         =(JspComponentBean)comCfgBean;
     }
 
     public void initUrl(IComponentConfigBean applicationConfigBean,ReportRequest rrequest)
     {}
 
     public void displayOnPage(AbsComponentTag displayTag)
     {
         if(.getUrl()==null||.getUrl().trim().equals(""))
         {
             .println("&nbsp;");
             return;
         }
         {
             .println("&nbsp;");
             return;
         }
         String width=null;
         if(this.getParentContainerType()!=null)
         {
             width=this.getParentContainerType().getChildDisplayWidth(this.);
             if(width==null||width.trim().equals("")) width="100%";
             if(.getTop()!=null&&!.getTop().trim().equals(""))
             {
                 .println("<table  cellspacing='0' cellpadding='0' width=\""+width+"\" style=\"MARGIN:0;\">");
                 .println("<tr><td height=\""+.getTop()+"\">&nbsp;</td></tr></table>");
             }
             .println("<table  cellspacing='0' cellpadding='0' width=\""+width+"\" id=\""+.getGuid()+"\"");
             if(.getHeight()!=null&&!.getHeight().trim().equals(""))
             {
                 .println(" height=\""+.getHeight()+"\" ");
             }
             .println("><tr><td valign=\"top\">");
         }
         .println("<span id=\"WX_CONTENT_"+.getGuid()+"\">");
         if(.isInIFrame())
         {
             String jspContent="<iframe src=\""+.getUrl()+"\"";
             if(.getIframestyleproperty()!=null)
             {
                 jspContent=jspContent+" "+.getIframestyleproperty();
             }
             jspContent=jspContent+"></iframe>";
             .println(jspContent);
         }else
         {
             .getRequest().setAttribute("WX_JSPCOMPONENTBEAN",this.);
             if(this..getBelongToCcbean() instanceof ReportBean)
             {
                 AbsReportType reportTypeObj=.getDisplayReportTypeObj(this..getBelongToCcbean().getId());
                 .getRequest().setAttribute("WX_COMPONENT_OBJ",reportTypeObj);
             }
             try
            {
                rd.include(.getRequest(),.getWResponse().getResponse());
            }catch(Exception e)
            {
                throw new WabacusRuntimeException("显示JSP"+.getUrl()+"失败",e);
            }
        }
        .println("</span>");
        if(this.getParentContainerType()!=null)
        {
            .println("</td></tr></table>");
            if(this..getBottom()!=null&&!this..getBottom().trim().equals(""))
            {
                .println("<table  cellspacing='0' cellpadding='0' width=\""+width+"\" style=\"MARGIN:0;\">");
                .println("<tr><td height=\""+this..getBottom()+"\">&nbsp;</td></tr></table>");
            }
        }
    }
    public String getRealParenttitle()
    {
        String parenttitle=.getParenttitle();
        if(parenttitle==nullreturn "";
        return parenttitle.trim();
    }
    protected String getComponentTypeName()
    {
        return "application.jsp";
    }
    public void displayOnExportDataFile(Object templateObj,boolean isFirstime)
    {
        displayOnPage(null);
    }
    
    public void printApplication(List<PrintSubPageBeanlstPrintPagebeans)
    {
        if(this..getPrintwidth()!=null&&!this..getPrintwidth().trim().equals(""))
        {
            this..println("<div width=\""+this..getPrintwidth()+"\">");
        }
        String jspUrl=null;
        if(.isInIFrame())
        {
            jspUrl=.getUrl();
            if(jspUrl.toLowerCase().trim().startsWith("http://"))
            {
                jspUrl=null;
            }else if(!jspUrl.trim().startsWith(.))
            {
                jspUrl=Tools.replaceAll(.+"/"+jspUrl,"//","/");
            }
        }else
        {
            .getRequest().setAttribute("WX_JSPCOMPONENTBEAN",this.);
            if(this..getBelongToCcbean() instanceof ReportBean)
            {
                AbsReportType reportTypeObj=.getDisplayReportTypeObj(this..getBelongToCcbean().getId());
                .getRequest().setAttribute("WX_COMPONENT_OBJ",reportTypeObj);
            }
            jspUrl=.getUrl().trim();
        }
        if(jspUrl!=null&&!jspUrl.trim().equals(""))
        {
            try
            {
                RequestDispatcher rd=.getRequest().getRequestDispatcher(jspUrl);
                rd.include(.getRequest(),.getWResponse().getResponse());
            }catch(Exception e)
            {
                throw new WabacusRuntimeException("打印JSP"+jspUrl+"失败",e);
            }
        }
        if(this..getPrintwidth()!=null&&!this..getPrintwidth().trim().equals(""))
        {
            this..println("</div>");
        }
    }
New to GrepCode? Check out our FAQ X