href="${ctx}/goPageCenter?code=promos">优惠活动</a>
${ctx}这个啥意思,$符号啥意思?
黄舟2017-04-18 09:48:47
ctx is a variable, and ${} includes it to get its value. For example, there is a map.
Its structure is key, value. map.put("ctx",www.baidu.com);
Then what ${ctx} gets is www.baidu.com
高洛峰2017-04-18 09:48:47
Get the value in the field in jsp,
1 page current page, get it by setting the value on the current page, <c:set var="ctx" value="http:// localhost:8080/"> ;
,${pageScope.ctx} value is "http://localhost:8080/"; <c:set var="ctx" value="http:// localhost:8080/">
,${pageScope.ctx}值为"http://localhost:8080/";
2 request.setAttribute("ctx", "http://localhost:8080/")
, ${requestScope.ctx}值为"http://localhost:8080/";
3 request.getSession().setAttribute("ctx", "http://localhost:8080/")
, ${sessionScope.ctx}值为"http://localhost:8080/";
4 request.getSession().getServeltContext().setAttribute("ctx", "http://localhost:8080/")
2 request.setAttribute("ctx", "http://localhost:8080/")< /code>, ${requestScope.ctx} value is "http://localhost:8080/";
request.getSession().setAttribute("ctx", "http://localhost:8080/" )
, ${sessionScope.ctx} value is "http://localhost:8080/"; 4 request.getSession().getServeltContext().setAttribute("ctx", "http:/ /localhost:8080/")
, the value of ${applicationScope.ctx} is "http://localhost:8080/";
ringa_lee2017-04-18 09:48:47
${} This way of writing is called el expression. In jsp, it is used to search for the value of the key-value pair in page, request, session, and application until it is found.
Normally there is one in your jsp page ctx setting, the code generated by the normal IDE using the JSP template will also automatically generate the code for this setting. It is the data from the global context - the domain name address requested by the project