java - How can I get the session values from an external.js by using Struts2 jQuery -
i need recover value session in external js. before, did in script embedded in jsp lines , worked properly:
$(window).load(function(){ var selectedserver = "<s:property value='%{#session.selectedserver}'/>"; var selectedmarket = "<s:property value='%{#session.selectedmarket}'/>"; });
but now, want external js , alert(selectedserver); after these lines, show me literal: <s:property value='%{#session.selectedserver}'/>
, not value.
¿is syntax different in external.js
?
any suggestion appreciated.
you can use javascript global variables in external script, or use function parameters pass values should obtain in jsp external function.
<script> var selectedserver = "<s:property value='%{#session.selectedserver}'/>"; var selectedmarket = "<s:property value='%{#session.selectedmarket}'/>"; </script>
function(selectedserver, selectedmarket){ }
Comments
Post a Comment