简体   繁体   中英

JSP tag alert in javascript

How can I alert JSP tag inside javascript?? Is it possible? I want to alert

 <%=%>

I tried:

 alert("<%=%>")

but it is not working.

No need escape the character:

It is working here

alert("<%=%>")

Check console for errors, which blocking it to alert.

Try this:

alert("\<\%=\%\>");

The '\\' characters escape the following character to stop them being interpreted as jsp delimiters.

You can try that:

<script language="javascript">  
function one()  
{  
    alert("var: "+<%= var %> );  
}
</script>  
<%
String a = "123";
%>


var v = '<%=a%>';
alert(v);

try it like this;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM