0

I hope everyone is doing well!

I was wondering if there was a way to write JSP code inside a Javascript if-statement?

For instance, the testVoid() method from the funStuff.java class changes a certain String in the class, and then retK() returns that String.

However, the JSP code runs irrespective of the condition in the if-statement. I saw another post that stated using JSTL could resolve this, but I am not sure how to write the intended code segment using JSTL.

Any help would be appreciated! Thanks!

<script>
if (false) {
<%
  funStuff.testVoid();
%>  
}

console.log('<%= funStuff.retK() %>');
</script>
  • [What is the difference between client-side and server-side programming?](https://stackoverflow.com/q/13840429) – VLAZ Dec 31 '21 at 17:26

0 Answers0