javascript - Issues about embedding js code in jsp
PHP中文网
PHP中文网 2017-07-05 11:04:08
0
2
871

This is a system built by my company. In it, we often see HTML code embedded in the if-else statement of jsp. I have not found this syntax in all the jsp and javascript books, and what I know The thing is that the jsp code will be compiled on the server side and the result will be sent to the browser, while html and js will be executed directly on the browser side. So what is the compilation or execution mechanism of code in this form?

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
曾经蜡笔没有小新

<%%>What is wrapped is the logical code part, and what is not wrapped is output directly.
Like this

<% if(one==1){%>
    <p>如果one是1,你就能看到我</p>
<% }else {%>
    <p>你只看到我,说明one不是1咯</p>
<% } %>

For example, when the browser requests a certain jsp, the jsp renders the above code into html on the server side, and then returns it to the browser. I can’t understand the content of the <%%> part on the browser side.

Perhaps the questioner can look for knowledge about "templates"?

巴扎黑

It is recommended that you learn about servlets

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template