Why doesn't EL(Expression Language) recognize header.content-length?

If this post was helpful to you, please leave a comment. :) Thank you!

[form.html]
<form action="result.jsp" method="post">
    Name: <input type="text" name="name" />
    <input type="submit" />
</form>
Name:

[result.jsp]
<body>
EL header.content-length : ${header.content-length}<br>
EL header["content-length"] : ${header["content-length"]}<br>
</body>
EL header.content-length : 0
EL header["content-length"] : 9

: EL accepts "-" as arithmetic operation. so EL recognizes content - length.


These results demonstrate how to interpret "-".

[form.html]
<form action="result.jsp" method="post">
    content: <input type="text" name="content" placeholder="7" />
    length: <input type="text" name="length" placeholder="5" />
    <input type="submit" />
</form>
content: length:

[result.jsp]
<body>
<%
    request.setAttribute("content", request.getParameter("content"));
    request.setAttribute("length", request.getParameter("length"));
%>
    EL requestScope.content-length : ${requestScope.content-length}<br>
    EL header.content-length : ${header.content-length}<br>
</body>
EL requestScope.content-length : 2
EL header.content-length : -5

Comments