What does the dollar curly brackets ${} mean in JSP?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 15:08:18

问题


What does ${} means in JSP? For example,

<c:if test="${!empty cookie.lang}">
    <fmt:setLocale value="${cookie.lang.value}" />
</c:if>

回答1:


its an El expression basically it outputs the value that result from evaluating the expression, to put it simply, it allows you to access the values of the properties of your java beans using "dots" instead of using getters and setters, using it you can access instances of beans that can be in session,request, or page scope




回答2:


It is Expression Language. Before EL evolved, the same purpose was achieved by using scriptlets <%=..%>The primary purpose of using this syntax is to avoid scriptlets in jsp. Scriptlets and the enclosed java code is considered bad practise because jsps are not 'supposed' to have java code. At least that is the theory.




回答3:


The ${} referes to EL expressions. You usually access some managed beans on the server via the EL expression.



来源:https://stackoverflow.com/questions/5736842/what-does-the-dollar-curly-brackets-mean-in-jsp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!