I have this jsp :
<div id="searchGrid">
<table id="list" class="scroll"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</div>
<s:hidden id="hdnFonction" value="<s:property value='fonction'/>" />
<h1><s:property value='fonction'/></h1>
<script type="text/javascript">
$(document).ready(function(){
var fn = window[$("#hdnFonction").val()];
alert($("#hdnFonction").val());
fn();
});
</script>
so between h1 tags I have the right value (the string name of a function)
but in the alert box I have the struts2 ‘property’ tag like the struts tag is interpreted after the document ready… which would be strange no ?
You can’t nest Struts2 tags inside of one another like that, so the
<s:property>tag is being parsed as text, rather than as a Struts2 tag.You’ll have to store the value of
<s:property value="fonction"/>into a scripting variable, and then use that as the value in your<s:hidden>tag.