I have a "jsp" file. In that file I have "Javascript" scripting.
Within <script>
tags,only javascript is allowed but, how is "Expression Language" executed?
<body>
<script type="text/javascript">
var b=${requestScope.name};
</script>
</body>
bring that variable from request scope to page scope,
<c:set var="myVar" value="${request.myVar}" />
after this you can try this :
<script>
var myVar= '${myVar}' ;
</script>
Though I am not sure if it's the best approach; but this should do.
Executed.
As "Expression Language" is executed on the server side the statement
${requestScope.name}
executed at server side and its value is available to JavaScript at client side. now at the client side the line becomes
var b='corresponding expression language executed value';
JSP is server side. You cannot access the script variables. These variables are only executed client-side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With