Using JSP values in Javascript -


I want to use values ​​in Javascript as follows,

   & Lt; Script type = 'text / javascript' & gt; $ ("#logopt") .change (function () (if ($ ("# logopt option: selected"). Text () == "full log") {warning ("hi"); document.getElementById (" Box "). InnerHTML + '' & lt;% = logs%>; '}}});   

But it does not show anything, what's my fault? What is the correct way to reach JSP values ​​using scriptlets?

I have the '& amp; Lt;% = logs; ' have tried and tried, but this is and lt;% = logs% & gt; is displayed but there is no value in log .

I believe that if you change

  document .getElementById ("box"). InnerHTML + = & lt;% = log% & gt;   

to

  document.getElementById ("box"). InnerHTML + '' & lt;% = logs% & gt; ';   

This will work. For valid javascript you will have to have the string literal in single / double quotation marks.

Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -