什么是“映射文件"? JspServlet中的参数代表什么? [英] What does "mappedfile" parameter in JspServlet stand for?

查看:94
本文介绍了什么是“映射文件"? JspServlet中的参数代表什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 https://tomcat.apache.org/tomcat- 7.0-doc/jasper-howto.html

有参数:

映射文件-我们是否应该在每行输入一条打印语句的情况下生成静态内容,以简化调试工作?正确或错误,默认 是的.

mappedfile - Should we generate static content with one print statement per input line, to ease debugging? true or false, default true.

但是我不知道该参数的详细用法是什么,我曾尝试在Google上搜索它,但没有帮助.有人可以告诉我这是什么吗?

But i can not understand what is the detail usage of this parameter, i've tried to google it but didn't help. Can someone please tell me what it is.

推荐答案

mappedfile为true时,容器会为JSP文件中的每个HTML文本行生成"out.print()".如果为false,则将来自多行的HTML文本连接起来并输出到一个"out.print()"中,这就是它简化调试的方式.

When mappedfile is true, container generates "out.print()" for each HTML text line in the JSP file. And when false, the HTML text from multiple lines are concatenated and output in one "out.print()" and that's how it ease debugging.

<JspInterceptor mappedFile="true" />容器将生成类似以下内容的

When <JspInterceptor mappedFile="true" /> container will generate something like:

out.write("<!DOCTYPE html>\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>Test</title>\r\n");
out.write("</head>\r\n");

而当<JspInterceptor mappedFile="false" />像这样的时候:

out.write("<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><title>Index</title></head>");

tomcat (3,4)的较旧版本默认具有此选项false,而从tomcat 5开始的较新版本具有此选项默认为true.

Older version of tomcat (3,4) have this option by default false and newer version starting from tomcat 5 have this option default true.

这篇关于什么是“映射文件"? JspServlet中的参数代表什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆