从test.jsp到test_jsp.java(文件分析)

test_jsp.java中源码:
这个类是final类继承了org.apache.jasper.runtime.HttpJspBase类,实现了org.apache.jasper.runtime.JspSourceDependent接口
public final class test_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent
   
如果在jsp中有"include"语句,则会在java中用静态初始化块来创建Vector,并添加数据。
例如:
  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/test/../../common/commheader.jsp");
  }

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

方法_jspService用来处理request及给出回应response
public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.midi.VendorActionEntrance;
import com.midi.IVendorConstants;

public final class test_jsp extends org.apache.jasper.runtime.HttpJspBase
    
implements org.apache.jasper.runtime.JspSourceDependent {

  
private static java.util.Vector _jspx_dependants;

  
static {
    _jspx_dependants 
= new java.util.Vector(1);
    _jspx_dependants.add(
"/caraudit/jsp/biz/warehouse/../../common/commheader.jsp");
  }


  
public java.util.List getDependants() {
    
return _jspx_dependants;
  }


  
public void _jspService(HttpServletRequest request, HttpServletResponse response)
        
throws java.io.IOException, ServletException {

    JspFactory _jspxFactory 
= null;
    PageContext pageContext 
= null;
    HttpSession session 
= null;
    ServletContext application 
= null;
    ServletConfig config 
= null;
    JspWriter out 
= null;
    Object page 
= this;
    JspWriter _jspx_out 
= null;


    
try {
      _jspxFactory 
= JspFactory.getDefaultFactory();
      response.setContentType(
"text/html;charset=gb2312");
      pageContext 
= _jspxFactory.getPageContext(this, request, response,
                  
nulltrue8192true);
      application 
= pageContext.getServletContext();
      config 
= pageContext.getServletConfig();
      session 
= pageContext.getSession();
      out 
= pageContext.getOut();
      _jspx_out 
= out;

      out.write(
" ");
    
    response.setHeader(
"Cache-Control","no-store"); //HTTP 1.1 
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 
    response.setDateHeader ("Expires"0); //prevents caching at the proxy server 

      out.write(
" ");
      out.write(
' ');
      out.write(
' ');
    String strUrl 
= (String) request.getParameter("srcUrl");
    VendorActionEntrance vae 
= new VendorActionEntrance();
    vae.doPost(request, response);            
    
    Integer iAf 
= (Integer) request.getAttribute(IVendorConstants.AFFECTEDROW);
    
if (iAf.intValue() == -1{
        response.sendRedirect(
"../../common/error.jsp");
        
return;
    }


      out.write(
"   <html>   <head>     <title>test.jsp</title>    </head>     <body>test   </body> </html> ");
    }
 catch (Throwable t) {
      
if (!(t instanceof SkipPageException)){
        out 
= _jspx_out;
        
if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        
if (pageContext != null) pageContext.handlePageException(t);
      }

    }
 finally {
      
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }

  }

}

 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值