Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "mappedfile" parameter in JspServlet stand for?

Im reading https://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html

There is parameter :

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

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.

like image 357
meobeo173 Avatar asked Dec 07 '25 07:12

meobeo173


1 Answers

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.

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");

And when <JspInterceptor mappedFile="false" /> something like this:

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

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

like image 66
Naman Avatar answered Dec 10 '25 02:12

Naman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!