为什么在<input>标签中能写JSTL代码?
<input type="text" class="span12" name="loginname" autocomplete="off" <c:if test="${loginname!=null}">value="${loginname}"</c:if> placeholder="邮箱/用户名/已验证手机" />
巴扎黑2017-04-18 09:24:46
JSP
标准标签库(JSP Standard Tag Library,JSTL
)是一个JSP
标签集合,它封装了JSP
应用的通用核心功能。和JSP
里面的标签是可以一起使用的,而JSP
包含静态部分(标准的HTML
标签、静态的页面内容等)和动态内容(Java程序控制的内容),实际上JSP
是Servlet
的一种特殊的形式,每一个JSP
的页面就是一个Servlet
的实例。所以在<input>
标签里面加入JSTL
代码,等同于完成一个完成的业务逻辑Servlet
, the two can be used together.
高洛峰2017-04-18 09:24:46
Because the jsp file will be compiled into a java class by the servlet container when it is requested for the first time, the JSTL in it will be compiled and converted.
PHP中文网2017-04-18 09:24:46
tomcat will read the jsp file and parse the non-html tags in the jsp. Like here, tomcat will read this <c:if test=></c:if> code and parse it with a parser (file header taglib corresponding class), in the final analysis, jsp will be converted into outputstream (standard html code) through tomcat compile to client (ie, ff, chrome)
怪我咯2017-04-18 09:24:46
Jstl codes have a fixed format and writing method when writing. They will first be parsed by servlet containers such as tomcat to generate corresponding result data. This process occurs on the server side; while html tag parsing occurs on the browser side