您的位置:首页 > 编程语言 > Java开发

Eclipse中JSP生成的class文件去了哪里?

2016-04-21 09:46 381 查看
转自:http://www.cnblogs.com/xing901022/p/4352999.html

  首先应该了解的是Tomcat在Eclipse的映射关系,参考前一篇博文所述:Tomcat的服务器目录配置

  可以了解到,Tomcat在Eclipse中提供了三种位置配置选项:

  1 Use workspace metadata

  2 Use Tomcat installation

  3 Use custom location

  分别对应三种情况说一下,注意要把Server中发布的目录全部删除,然后clean后才能修改该配置项。

  如果你在Eclipse中双击Server配置选项,在Server Location中分别选了如下的选项:

package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import java.io.*;

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

String s = "xingoo";//声明变量
int add(int a,int b){//声明函数
return a+b;
}

private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

private static java.util.List _jspx_dependants;

private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;

public Object getDependants() {
return _jspx_dependants;
}

public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}

public void _jspDestroy() {
}

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

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

try {
response.setContentType("text/html; charset=utf-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;

out.write('\r');
out.write('\n');
out.write('    ');
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t<h1>JSP</h1>\r\n");
out.write("\t\r\n");
out.write("\t<!-- 客户端可见 -->\r\n");
out.write("\t");
out.write('\r');
out.write('\n');
out.write('    ');
out.write("\r\n");
out.write("\ts=");
out.print(s );
out.write("<br> ");
out.write("\r\n");
out.write("\t1+2=");
out.print(add(1,2) );
out.write("<br>\r\n");
out.write("\t");

//单行注释 ————————————————快捷键ctrl+/
/* 多行注释 ____________快捷键ctrl+shift+/ */
out.println("s="+s+"<br>");

out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else log(t.getMessage(), t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}


View Code

  声明注释,都可以很详细的看到。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: