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
Post a Comment